document-gen-resilient
Fungsinya
Skill ini memberi tahu AI untuk membagi pembuatan dokumen menjadi langkah-langkah kecil yang diperiksa, dengan cadangan jika konversi gagal. Skill ini cocok untuk orang yang pembuatan dokumennya terus gagal atau yang membutuhkan beberapa format file.
Kapan dipakai
- ✓Saat pembuatan dokumen gagal dan helper shell mengembalikan galat yang tidak jelas.
- ✓Saat saya membutuhkan dokumen dalam format .docx, .pdf, dan .html sekaligus.
- ✓Saat pembuatan PDF gagal karena masalah encoding LaTeX atau perangkat lunak yang hilang.
Link skill
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/document-gen-fallback-enhanced-enhanced-96865f/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
“Pembuatan dokumen terus gagal. Tolong buat laporan saya sebagai file Word dan PDF, dengan alat apa pun yang berfungsi di sini.”
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
AI memeriksa alat mana yang tersedia, menulis konten dalam Markdown, memutuskan cara menangani karakter khusus untuk setiap format, mencoba metode utama lalu cadangannya, dan memverifikasi file.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.
Resilient Document Generation Workflow
When to Use
Use this skill when document generation tasks encounter errors or when you need reliable multi-format output:
shell_agentreturns unknown or unclear errors on document generation- Generating documents in multiple formats (e.g.,
.docx,.pdf,.html) - PDF generation fails due to LaTeX encoding or missing dependencies
- You need to handle special characters, symbols, or non-ASCII text safely
- Previous document generation attempts have failed
Core Technique
Instead of delegating the entire document generation to shell_agent, manually split the workflow into discrete, observable steps with built-in fallbacks:
- Tool availability check → Verify pandoc and PDF engines are available
- Content creation → Use
write_fileto create source document (Markdown) - Unicode assessment → Determine if sanitization is needed based on target format
- Format conversion → Try primary method, fall back to alternatives on failure
- Verification → Check output files exist and are valid
⚠️ Format-Specific Unicode Guidance
Critical: Different formats handle Unicode differently. Plan accordingly:
| Format | Unicode Support | Sanitization Needed? | Recommended Engine |
|---|---|---|---|
.docx |
Excellent | No | pandoc (default) |
.html |
Excellent | No | pandoc (default) |
.pdf (pdflatex) |
Limited | Yes | pandoc + sanitization |
.pdf (xelatex) |
Good | Rarely | pandoc --pdf-engine=xelatex |
.pdf (wkhtmltopdf) |
Good | Rarely | pandoc --pdf-engine=wkhtmltopdf |
.pdf (Python) |
Excellent | No | fpdf2 or reportlab |
Step-by-Step Workflow
Step 0: Check Tool Availability
Before starting, verify which tools are available:
run_shell
command: which pandoc && echo "PANDOC: OK" || echo "PANDOC: MISSING"
run_shell
command: which pdflatex && echo "PDFLATEX: OK" || echo "PDFLATEX: MISSING"
run_shell
command: which xelatex && echo "XELATEX: OK" || echo "XELATEX: MISSING"
run_shell
command: python3 -c "import fpdf; print('FPDF2: OK')" 2>/dev/null || echo "FPDF2: MISSING"
Decision Tree Based on Availability:
- pandoc + xelatex available → Use pandoc with xelatex engine (best Unicode support)
- pandoc + pdflatex only → Use pandoc with sanitization (Step 2)
- pandoc missing, Python available → Use Python libraries (Step 3 Alternative)
- All missing → Install dependencies or use shell_agent with explicit instructions
Step 1: Create Source Content with write_file
Write your document content as Markdown to a temporary source file. This gives you full visibility into the content being generated.
write_file
path: /tmp/document_source.md
content: |
# Document Title
## Section 1
Content here...
## Section 2
More content...
Step 2: Assess and Handle Unicode (Conditional)
Before PDF conversion, check if your content contains problematic characters:
run_shell
command: grep -P '[\x{2014}\x{2013}\x{201C}\x{201D}\x{2026}]' /tmp/document_source.md && echo "UNICODE_DETECTED" || echo "UNICODE_CLEAN"
If Unicode detected AND using pdflatex, create a sanitized version:
write_file
path: /tmp/document_source_sanitized.md
content: |
# Document Title
## Section 1
Content here... (with all special chars replaced per table below)
Common Problematic Characters:
| 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] [ ] |
© ® ™ |
May require packages | (c) (r) (tm) |
Note: Keep the original unsanitized file for DOCX/HTML conversion (these formats handle Unicode better).
Step 3: Convert to Target Formats with run_shell
Use run_shell with explicit commands for each format. Try primary method first, fall back on failure.
For DOCX (from original, no sanitization needed):
run_shell
command: pandoc /tmp/document_source.md -o output.docx
For PDF (try in order):
**Option A: xelatex (best
Pertanyaan umum
Mengapa tidak membiarkan satu helper mengerjakan semuanya?
Panduan ini menyatakan bahwa membagi pekerjaan menjadi langkah yang bisa diamati memudahkan melihat di mana kegagalan terjadi.
Bagaimana Word menangani karakter khusus?
Panduan ini menyatakan bahwa .docx menangani Unicode dengan sangat baik dan biasanya tidak memerlukan pembersihan.
Apa cadangan Python-nya?
Panduan ini mengarah ke pustaka seperti reportlab dan fpdf2 ketika alat utama tidak tersedia.
Detail
Deskripsi asli dari pembuat
Multi-path document generation with tool checks, Unicode handling, and Python fallbacks
repo: HKUDS/AgentPilot
Popularitas
- Bintang GitHub
- 7.8k
- Peringkat
- #12859
- 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.