document-gen-resilient-workflow
यह क्या करती है
यह स्किल Word, PDF या HTML दस्तावेज़ बनाने की चरण-दर-चरण विधि है, जिसमें बैकअप और एरर का विवरण शामिल है। यह उन लोगों के लिए है जिनके दस्तावेज़ों के काम अज्ञात एरर के साथ बार-बार विफल होते हैं।
कब इस्तेमाल करें
- ✓जब शेल कमांड बिना उपयोगी विवरण के अज्ञात एरर लौटाए।
- ✓जब LaTeX इंजन गायब होने या एन्कोडिंग समस्या की वजह से PDF न बने।
- ✓जब मिलते-जुलते काम में दस्तावेज़ बनाना कई बार विफल हो चुका हो।
Skill का लिंक
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/document-gen-fallback-enhanced-enhanced/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“मेरी PDF बनाना अज्ञात एरर के साथ विफल हो रहा है। कृपया टूल जाँचिए, दूसरा इंजन आज़माइए और बताइए कि क्या गलत हुआ।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
AI कार्य-फ़ोल्डर और टूल्स की जाँच करता है, सामग्री लिखता है, एरर आउटपुट पकड़ता है, PDF इंजन क्रम से आज़माता है जब तक कोई काम न करे, और पुष्टि करता है कि आउटपुट फ़ाइल पढ़ी जा सकती है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Resilient Document Generation Workflow
When to Use
Use this skill when document generation tasks encounter tool errors or failures, especially:
run_shellcommands return 'unknown error' without diagnostic details- PDF generation fails with LaTeX encoding or missing engine errors
- You need fallback options when primary conversion methods fail
- Workspace or path issues cause file access problems
- Unicode/special characters cause rendering issues in PDF output
shell_agenthas failed multiple times on similar tasks
Core Technique
Split document generation into observable, verifiable steps with explicit error capture and progressive fallback:
- Validate workspace → Confirm current directory and write permissions
- Pre-flight checks → Verify required tools (pandoc, LaTeX engines) are available
- Content creation → Use
write_filefor source Markdown with full visibility - Unicode sanitization → Preprocess for PDF conversion when needed
- Progressive conversion → Try multiple engines/methods until one succeeds
- Explicit error capture → Redirect stderr to diagnose failures
- Verification → Confirm output files exist and are readable
⚠️ Critical: Tool Error Patterns
'unknown error' from run_shell: This typically indicates:
- Sandbox execution context issues (not the command itself)
- Missing stderr capture preventing diagnosis
- Transient file access problems
Solution: Use explicit error capture with 2>&1 and verify tool availability first:
run_shell
command: pandoc --version 2>&1 || echo "PANDOC NOT AVAILABLE"
Pre-Flight Checklist
Before starting conversion, verify your environment:
## Pre-Flight Checks
### Check 1: Verify working directory
run_shell
command: pwd && ls -la
### Check 2: Verify pandoc availability
run_shell
command: pandoc --version 2>&1 | head -3 || echo "PANDOC MISSING"
### Check 3: Check LaTeX engines
run_shell
command: which pdflatex xelatex wkhtmltopdf 2>&1 || echo "Some engines missing"
### Check 4: Check Python libraries (fallback option)
run_shell
command: python3 -c "import fpdf; print('fpdf OK')" 2>&1 || echo "fpdf missing"
run_shell
command: python3 -c "import docx; print('python-docx OK')" 2>&1 || echo "python-docx missing"
Complete Step-by-Step Workflow
Step 1: Validate Workspace
Confirm you're in the correct directory and can write files:
run_shell
command: pwd && echo "Test write" > /tmp/workspace_test_$$.txt && ls -la /tmp/workspace_test_$$.txt && rm /tmp/workspace_test_$$.txt
If this fails, you may have directory permission issues. Use absolute paths for all files.
Step 2: Create Source Content with write_file
Write document content as Markdown to a source file:
write_file
path: /tmp/document_source.md
content: |
# Document Title
## Section 1
Content here...
Step 3: Unicode Sanitization (PDF Only)
Only needed for PDF conversion via LaTeX engines. DOCX and HTML handle Unicode natively.
Create a sanitized version replacing LaTeX-problematic characters:
write_file
path: /tmp/document_source_sanitized.md
content: |
# Document Title
[Same content with: em-dash → --, curly quotes → straight, → arrows → text, etc.]
Common replacements (see full table below):
| Original | Replace With |
|---|---|
— (em dash) |
-- |
" " (curly quotes) |
" " (straight) |
… (ellipsis) |
... |
→ ← (arrows) |
-> <- |
✓ ✗ |
[x] [ ] |
© ® ™ |
(c) (r) (tm) |
Alternative: Use sanitization script (see Scripts section below).
Step 4: Progressive Format Conversion
Try multiple methods in order of preference. Capture stderr explicitly for diagnosis.
Method A: DOCX Conversion (Most Reliable)
run_shell
command: pandoc /tmp/document_source.md -o output.docx 2>&1 && echo "SUCCESS" || echo "FAILED: $?"
If this fails, try with explicit UTF-8 flag:
run_shell
command: pandoc /tmp/document_source.md -f markdown+utf8 -o output.docx 2>&1
Method B: PDF Conversion (Progressive Fallback)
Try engines in this order until one succeeds:
run_shell
command: pandoc /tmp/document_source_sanitized.md -o output.pdf 2>&1 | tee /tmp/pdf_error.log && echo "PDF SUCCESS"
If Method B fails, check error log and try next engine:
run_shell
command: pandoc /tmp/document_source_sanitized.md --pdf-engine=xelatex -o output.pdf 2>&1 | tee
अक्सर पूछे जाने वाले सवाल
कौन से टूल्स पहले जाँचे जाते हैं?
रूपांतरण से पहले यह pandoc और LaTeX इंजनों की जाँच करता है।
एरर आउटपुट क्यों पकड़ें?
एरर का विवरण असली कारण दिखाता है, ताकि AI को अंदाज़ा न लगाना पड़े।
अगर समस्या फ़ोल्डर की हो तो?
गाइड कहती है कि रूपांतरण से पहले मौजूदा फ़ोल्डर और लिखने की अनुमति जाँचें।
जानकारी
लेखक का मूल विवरण
Robust document generation with engine fallback chain, error diagnostics, and Python alternatives
repo: HKUDS/AgentPilot
लोकप्रियता
- GitHub स्टार
- 7.8k
- रैंकिंग में स्थान
- #12862
- लाइसेंस
- 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 फ़ाइल तक किसकी पहुंच है, यह जांचने और बदलने देती है, और आपके अनुरोध के लिए सबसे छोटी अनुमति चुनती है।