document-gen-dual-backend
यह क्या करती है
यह स्किल AI को बताती है कि ज़्यादातर दस्तावेज़ कामों के लिए सीधे कमांड चलाए, और जटिल मामलों के लिए सहायक एजेंट रखे। यह उन लोगों के लिए है जिन्हें Markdown से Word, PDF या HTML फ़ाइलें चाहिए।
कब इस्तेमाल करें
- ✓जब मुझे Markdown से एक सरल Word, PDF या HTML दस्तावेज़ बनवाना हो।
- ✓जब सामग्री सादी हो और AI पहले से जानता हो कि कौन सा रूपांतरण कमांड इस्तेमाल करना है।
- ✓जब गड़बड़ी के बाद दस्तावेज़ का काम बैकएंड के बीच अपने-आप बदलना पड़े।
Skill का लिंक
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/document-gen-fallback-enhanced-enhanced-9f3b1f/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“कृपया इस Markdown को PDF और Word फ़ाइल में बदलिए। इसे सरल रखिए, और बैकअप तभी इस्तेमाल कीजिए जब कुछ टूटे।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
ज़्यादातर कामों में AI सामग्री लिखता है और सीधे pandoc या ReportLab चलाता है। जटिल मामलों में वह दो PDF रास्ते इस्तेमाल करता है, एक pandoc से और एक ReportLab से, और हर आउटपुट जाँचता है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे 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
अक्सर पूछे जाने वाले सवाल
मुख्य तरीका क्या है?
सीधे कमांड डिफ़ॉल्ट हैं, क्योंकि वे ज़्यादातर दस्तावेज़ ज़रूरतें पूरी करते हैं।
सहायक एजेंट की ज़रूरत कब होती है?
सिर्फ़ जटिल मामलों में, जहाँ अपने-आप एरर संभालना या बैकएंड बदलना ज़रूरी हो।
क्या यह आउटपुट जाँचता है?
हाँ, गाइड हर बनाई गई फ़ाइल की पुष्टि करने को कहती है।
जानकारी
लेखक का मूल विवरण
Document generation with direct pandoc/ReportLab execution (lightweight default) and optional shell_agent fallback for complex scenarios
repo: HKUDS/AgentPilot
लोकप्रियता
- GitHub स्टार
- 7.8k
- रैंकिंग में स्थान
- #12860
- लाइसेंस
- MIT
- अपडेट की गई
- 1/11/2026
कमेंट
- …
इस repository की और skills
agentpilot
7.8kआपके एजेंट को AgentPilot से प्रोजेक्ट को चरण-दर-चरण सुधारने में मदद करती है, जिसमें बदलाव सुझाए, परखे और स्कोर किए जाते हैं।
openspace
7.8kआपके एजेंट को OpenSpace सेट करने में मदद करती है, जो एजेंट स्किल्स सहेजता और वापस लाता है, और MCP के ज़रिए आपके AI ऐप से जुड़ता है।
rsi-arena
7.8kआपके एजेंट को AIME और Terminal-Bench जैसे मानक AI बेंचमार्क टेस्ट सेट करने और चलाने में मदद करती है, ताकि सुधार के तरीकों की तुलना हो सके।
experiment-guide
7.8kआपके एजेंट को छोटे प्रयोग बनाने, उनके नतीजे पढ़ने और जाँच के दौरान उपयोगी निष्कर्ष लिखने में मदद करती है।
मिलती-जुलती skills
feishu-doc
394kयह आपके एजेंट को document टूल से Feishu क्लाउड दस्तावेज़ पढ़ने, बनाने और बदलने में मदद करती है, जिसमें टेक्स्ट, इमेज और टेबल शामिल हैं।
feishu-drive
394kयह आपके एजेंट को बॉट के साथ साझा किए गए Feishu क्लाउड फ़ोल्डर में फ़ाइलें देखने, व्यवस्थित करने और उन पर टिप्पणी करने देती है।
feishu-perm
394kयह आपके एजेंट को Feishu फ़ाइल तक किसकी पहुंच है, यह जांचने और बदलने देती है, और आपके अनुरोध के लिए सबसे छोटी अनुमति चुनती है।