Langsung ke konten
Skillpedia
PDF, Word & slide7.8k · #12858

document-gen-resilient-multiformat

Fungsinya

Skill ini memandu AI mengubah satu sumber dokumen menjadi beberapa format, dengan memeriksa alat terlebih dahulu. Skill ini cocok untuk orang yang ingin satu dokumen dalam berbagai jenis file tanpa menebak apa yang terpasang.

Kapan dipakai

  • ✓Saat saya membutuhkan dokumen yang sama sebagai file Word, PDF, dan halaman web.
  • ✓Saat pandoc atau mesin PDF mungkin tidak terpasang di komputer saya.
  • ✓Saat teks memuat karakter khusus yang berperilaku berbeda di setiap format.

Link skill

https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/document-gen-fallback-enhanced-enhanced-618c9b/SKILL.md

Salin 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

Gunakan skill ini untuk membantu saya: https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/document-gen-fallback-enhanced-enhanced-618c9b/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit →

Contoh permintaan ke AI

“Tolong buat dokumen ini tersedia sebagai Word, PDF, dan HTML, dan beri tahu saya jika ada alat yang hilang.”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

AI memeriksa alat mana yang terpasang, menulis dokumen sumber, menyesuaikan karakter khusus untuk setiap format, mengonversinya, dan memastikan setiap file keluaran ada dan valid.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.

Resilient Document Generation Workflow (Multi-Format + Unicode-Safe)

When to Use

Use this skill when generating documents in multiple formats (.docx, .pdf, .html) and you need:

  • Reliable execution with pre-flight environment verification
  • Automatic Unicode handling based on target format
  • Fallback options when primary tools (pandoc/LaTeX) are unavailable
  • Clear error isolation through discrete, observable steps

Trigger this workflow when:

  • shell_agent returns unknown/unclear errors on document generation
  • You need multiple output formats from one source
  • Documents contain special characters, symbols, or non-ASCII text
  • Previous PDF generation attempts failed due to encoding or missing dependencies

Pre-Flight Environment Check

Before starting, verify your environment has the required tools:

run_shell
command: which pandoc && pandoc --version | head -1
run_shell
command: which pdflatex || which xelatex || which wkhtmltopdf || echo "No PDF engine found"
run_shell
command: python3 -c "import fpdf; print('fpdf2 available')" 2>/dev/null || echo "fpdf2 not available"
run_shell
command: python3 -c "import reportlab; print('reportlab available')" 2>/dev/null || echo "reportlab not available"

If pandoc is missing: Install via apt-get install pandoc or brew install pandoc

If no PDF engine found: Choose fallback approach:

  • Install LaTeX: apt-get install texlive-latex-recommended texlive-fonts-recommended
  • Or use wkhtmltopdf: apt-get install wkhtmltopdf
  • Or use Python fallback (fpdf2/reportlab) - see Alternative PDF Generation section

Core Technique

Split the workflow into discrete, observable steps with automatic format detection:

  1. Environment check → Verify tools are available
  2. Content creation → Use write_file to create source Markdown
  3. Auto-sanitization → Conditionally sanitize based on target format (PDF needs it, DOCX/HTML don't)
  4. Format conversion → Use appropriate tool for each format with fallback options
  5. Verification → Check output files exist and validate content

⚠️ Unicode & Format Compatibility Matrix

Format Unicode Support Sanitization Needed Recommended Engine
.docx Excellent No pandoc (default)
.html Excellent No pandoc (default)
.pdf Limited (LaTeX) Yes xelatex > pdflatex > wkhtmltopdf > fpdf2
.pptx Good No pandoc (if available) or python-pptx

Critical Unicode Characters for PDF

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

Step-by-Step Workflow

Step 0: Pre-Flight Check

Verify environment before proceeding:

run_shell
command: pandoc --version >/dev/null 2>&1 && echo "PANDOC_OK" || echo "PANDOC_MISSING"

If PANDOC_MISSING: Either install pandoc or use Alternative PDF Generation (Python-based)

Step 1: Create Source Content with write_file

Write your document content as Markdown to a source file:

write_file
path: /tmp/document_source.md
content: |
  # Document Title
  
  ## Section 1
  Content with original unicode characters...
  
  ## Section 2
  More content...

Step 2: Conditional Unicode Sanitization

Only sanitize if generating PDF. Create sanitized version for PDF conversion:

write_file
path: /tmp/document_source_sanitized.md
content: |
  # Document Title
  
  ## Section 1
  Content with unicode replaced (em-dash -> --, curly quotes -> straight, etc.)
  
  ## Section 2
  More content...

Optional: Use sanitization script (see Unicode Sanitization Script section below):

run_shell
command: ./sanitize_for_pdf.sh /tmp/document_source.md /tmp/document_source_sanitized.md

Note: Keep the original unsanitized file for DOCX/HTML conversion (these

Pertanyaan umum

Bagaimana jika tidak ada mesin PDF yang ditemukan?

Panduan ini menawarkan cadangan Python seperti fpdf2 atau reportlab.

Apakah alat yang hilang dipasang otomatis?

Panduan ini menyebut pemasangan pandoc atau mesin LaTeX dengan perintah paket sistem ketika alat tersebut hilang.

Mengapa karakter khusus menjadi perhatian?

Setiap format menangani Unicode dengan cara berbeda, sehingga panduan ini memperhitungkannya.

Detail

Deskripsi asli dari pembuat

Resilient multi-format document generation with environment checks, auto-sanitization, and fallback engines

repo: HKUDS/AgentPilot

Popularitas

Bintang GitHub
7.8k
Peringkat
#12858
Lisensi
MIT
Diperbarui
1/11/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa