document-gen-dual-backend
Fungsinya
Skill ini memberi tahu AI untuk memakai perintah langsung pada sebagian besar tugas dokumen, dan menyimpan agent pembantu untuk kasus yang rumit. Skill ini cocok untuk orang yang membutuhkan file Word, PDF, atau HTML yang dibuat dari Markdown.
Kapan dipakai
- ✓Saat saya membutuhkan dokumen sederhana dalam format Word, PDF, atau HTML yang dibuat dari Markdown.
- ✓Saat isinya polos dan AI sudah tahu perintah konversi yang tepat untuk dipakai.
- ✓Saat sebuah tugas dokumen membutuhkan peralihan otomatis antar-backend setelah terjadi galat.
Link skill
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/document-gen-fallback-enhanced-enhanced-9f3b1f/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
“Tolong ubah Markdown ini menjadi file PDF dan Word. Buat sederhana saja, dan pakai cadangan hanya jika ada yang rusak.”
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Untuk sebagian besar tugas, AI menulis konten dan menjalankan pandoc atau ReportLab secara langsung. Untuk kasus yang rumit, AI memakai dua jalur PDF, satu dengan pandoc dan satu dengan ReportLab, lalu memeriksa setiap keluaran.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.
Document Generation: Dual-Backend Workflow (Unicode-Safe)
When to Use
Default Approach: Lightweight Direct Execution (Recommended for 90% of tasks)
For most document generation tasks, use direct write_file + run_shell without shell_agent:
- Generating documents in standard formats (
.docx,.pdf,.html) from Markdown - Content is straightforward with minimal special characters
- You already know the pandoc/ReportLab commands needed
- Quick single-format or multi-format output is needed
Fallback Approach: shell_agent Delegation (For Complex Scenarios Only)
Use shell_agent delegation only when:
- Automated fallback handling between backends requires complex logic
- Dynamic content generation needs programmatic decision-making
- You need to capture and analyze error messages for intelligent retry logic
When shell_agent May Be Useful (Optional)
Only consider shell_agent delegation for:
- Complex error recovery requiring automated backend switching
- Dynamic workflows with conditional branching based on generation results
Core Technique
For simple tasks (default): Use direct write_file + run_shell with pandoc or ReportLab (no shell_agent needed)
For complex tasks requiring fallback logic: Split the workflow into discrete, observable steps with two PDF generation paths:
Path A (Pandoc): Best for Markdown-to-PDF conversion with rich text formatting Path B (ReportLab): Best for programmatic PDF generation without LaTeX dependencies
Workflow steps:
- Content creation → Use
write_fileto create source document (Markdown) - Choose PDF backend → Decide between pandoc (rich formatting) or ReportLab (programmatic control)
- Unicode handling → Apply sanitization for pandoc; ReportLab handles Unicode natively
- Format conversion → Use
run_shellwith appropriate commands for each format - Verification → Check output files exist and are valid
⚠️ Backend Selection Guide
| Requirement | Recommended Backend | Rationale |
|---|---|---|
| Markdown source with headers, lists, tables | Pandoc | Native Markdown parsing |
| Heavy Unicode/special characters | ReportLab | Native UTF-8 support, no sanitization needed |
| LaTeX not available | ReportLab | Pure Python, no external dependencies |
| Precise layout control (positions, graphics) | ReportLab | Programmatic canvas control |
| Quick DOCX + PDF + HTML batch | Pandoc | Single tool, multiple outputs |
| Tables with complex formatting | Pandoc | Better table rendering |
| Dynamic/charts/graphs in PDF | ReportLab | Drawing operations support |
Unicode & LaTeX Compatibility Warning
Critical for Pandoc Path: PDF generation via pandoc typically uses LaTeX (pdflatex or xelatex), which has limited Unicode support. Common problematic characters include:
| Character | Issue | Safe Replacement |
|---|---|---|
— (em dash) |
May not render | -- or - |
– (en dash) |
May not render | - |
" " (curly quotes) |
Encoding errors | " " (straight quotes) |
' ' (curly apostrophe) |
Encoding errors | ' (straight apostrophe) |
… (ellipsis) |
May not render | ... |
→ ← ↑ ↓ (arrows) |
LaTeX incompatibility | -> <- ^ v |
✓ ✗ (checkmarks) |
May not render | [x] [ ] |
★ ● (symbols) |
May not render | * - |
© ® ™ |
May require packages | (c) (r) (tm) |
| Non-ASCII letters (é, ñ, ü) | Font-dependent | Use xeLaTeX or replace |
ReportLab Path: Handles Unicode natively. Pass content as UTF-8 strings; no character sanitization required.
Step-by-Step Workflow
Quick Start: Lightweight Direct Execution (Default for Most Tasks)
This is the recommended approach for most document generation tasks. No shell_agent delegation needed:
# Step 1: Write Markdown content
write_file
path: /tmp/doc.md
content: |
# My Document
Simple content here.
# Step 2: Convert with pandoc (direct)
run_shell
command: pandoc /tmp/doc.md -o output.docx
# Step 3: Verify
run_shell
command: ls -lh output.docx
For PDF with potential Unicode issues:
# Create sanitized version if needed
write_file
path: /tmp/doc_sanitized.md
content: |
# My Document
Content with safe ASCII characters only.
run_shell
command: pandoc /tmp/doc_sanitized.md -o output.pdf
For Unicode-heavy content (use ReportLab directly):
write
Pertanyaan umum
Apa metode utamanya?
Perintah langsung adalah pilihan default, karena sudah mencakup sebagian besar kebutuhan dokumen.
Kapan agent pembantu dibutuhkan?
Hanya untuk kasus rumit yang memerlukan penanganan galat otomatis atau peralihan antar-backend.
Apakah keluarannya diperiksa?
Ya, panduan ini meminta agar setiap file yang dihasilkan diverifikasi.
Detail
Deskripsi asli dari pembuat
Document generation with direct pandoc/ReportLab execution (lightweight default) and optional shell_agent fallback for complex scenarios
repo: HKUDS/AgentPilot
Popularitas
- Bintang GitHub
- 7.8k
- Peringkat
- #12860
- Lisensi
- MIT
- Diperbarui
- 1/11/2026
Komentar
- …
Skill lain dari repositori ini
agentpilot
7.8kMembantu agent Anda meningkatkan proyek langkah demi langkah dengan menyiapkan tugas dan menjalankan loop AgentPilot yang mengusulkan, menguji, dan memberi skor pada perubahan.
openspace
7.8kMembantu agent Anda menyiapkan OpenSpace, alat yang menyimpan dan mengambil skill agent, lalu menghubungkannya ke aplikasi AI Anda melalui MCP.
rsi-arena
7.8kMembantu agent Anda menyiapkan dan menjalankan tes benchmark AI standar, seperti AIME dan Terminal-Bench, untuk membandingkan berbagai metode perbaikan.
experiment-guide
7.8kMembantu agent Anda merencanakan eksperimen kecil, membaca hasilnya, dan mencatat temuan saat menyelidiki cara memperbaiki sebuah program.
Skill serupa
feishu-doc
394kMembantu agent Anda membaca, membuat, dan mengedit dokumen cloud Feishu, termasuk teks, gambar, dan tabel, dengan memakai alat dokumen.
feishu-drive
394kMemungkinkan agent Anda menelusuri, mengatur, dan memberi komentar pada file di folder cloud Feishu yang sudah dibagikan kepada bot.
feishu-perm
394kMembantu agent Anda memeriksa dan mengubah siapa yang dapat mengakses file Feishu, dengan memilih izin terkecil yang memenuhi permintaan Anda.