Zum Inhalt springen
Skillpedia
PDF, Word & Folien7.8k · #12860

document-gen-dual-backend

Was er macht

Dieser Skill sagt der KI, für die meisten Dokumentaufgaben direkte Befehle zu nutzen und für komplexe Fälle einen Helfer-Agenten zu behalten. Er richtet sich an Menschen, die Word-, PDF- oder HTML-Dateien aus Markdown brauchen.

Wann du ihn nutzt

  • ✓Wenn ich ein einfaches Dokument in Word, PDF oder HTML aus Markdown brauche.
  • ✓Wenn der Inhalt schlicht ist und die KI bereits weiß, welcher Konvertierungsbefehl passt.
  • ✓Wenn eine Dokumentaufgabe nach Fehlern automatisch zwischen Backends wechseln muss.

Link zum Skill

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

Kopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.

So nutzt du ihn

Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.

Fertige Nachricht zum Einfügen

Nutze diesen Skill, um mir zu helfen: https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/document-gen-fallback-enhanced-enhanced-9f3b1f/SKILL.md Lies die SKILL.md unter diesem Link und folge ihren Anweisungen für meine Aufgabe.
Soll deine KI Skills wie diesen selbst finden?Installiere den kostenlosen Skillpedia-MCP: eine Zeile, und sie durchsucht vor jeder Aufgabe 15.000+ Skills.In 1 Minute installieren →

Beispielanfrage an deine KI

“Bitte wandle dieses Markdown in ein PDF und eine Word-Datei um. Halte es einfach und nutze Ausweichlösungen nur, wenn etwas kaputtgeht.”

5 neue Skills pro Woche. 1 Minute Lesezeit.

So funktioniert es

Bei den meisten Aufgaben schreibt die KI den Inhalt und führt pandoc oder ReportLab direkt aus. Für komplexe Fälle nutzt sie zwei PDF-Wege, einen mit pandoc und einen mit ReportLab, und prüft jede Ausgabe.

Technischer Inhalt (originale SKILL.md)

Originaltext des Autors, auf Englisch, direkt von 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:

  1. Content creation → Use write_file to create source document (Markdown)
  2. Choose PDF backend → Decide between pandoc (rich formatting) or ReportLab (programmatic control)
  3. Unicode handling → Apply sanitization for pandoc; ReportLab handles Unicode natively
  4. Format conversion → Use run_shell with appropriate commands for each format
  5. 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
Häufige Fragen

Was ist der Standardweg?

Direkte Befehle sind der Standard, weil sie den größten Teil der Dokumentbedürfnisse abdecken.

Wann wird der Helfer-Agent gebraucht?

Nur für komplexe Fälle, die automatische Fehlerbehandlung oder den Wechsel zwischen Backends brauchen.

Prüft er die Ausgabe?

Ja. Die Anleitung sagt, jede erzeugte Datei zu prüfen.

Details

Originalbeschreibung des Autors

Document generation with direct pandoc/ReportLab execution (lightweight default) and optional shell_agent fallback for complex scenarios

repo: HKUDS/AgentPilot

Beliebtheit

GitHub-Sterne
7.8k
Platz im Ranking
#12860
Lizenz
MIT
Aktualisiert
1.11.2026

Ist dieser Skill nützlich?

0

Anmelden um abzustimmen.

Kommentare

  • …

Weitere Skills aus diesem Repository

Ähnliche Skills