document-gen-unicode-safe
यह क्या करती है
यह स्किल दस्तावेज़ बनाने को दिखने वाले चरणों में बाँटती है, जिसमें चिह्नों की सफ़ाई और एरर का रिकॉर्ड शामिल है। यह उन लोगों के लिए है जो उच्चारण वाले अक्षरों, चिह्नों या गैर-अंग्रेज़ी टेक्स्ट वाले दस्तावेज़ बनाते हैं।
कब इस्तेमाल करें
- ✓जब दस्तावेज़ पर शेल सहायक अस्पष्ट एरर लौटाए।
- ✓जब दस्तावेज़ में उच्चारण वाले अक्षर या चिह्न हों जिनसे PDF में समस्या आती है।
- ✓जब मुझे कई फ़ॉर्मैट चाहिए और हर चरण का आउटपुट देखना है।
Skill का लिंक
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/document-gen-fallback-enhanced/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“एक सहायक दस्तावेज़ बनाते समय बार-बार विफल हो रहा है, और टेक्स्ट में उच्चारण वाले अक्षर हैं। कृपया हर चरण खुद कीजिए, ताकि मैं देख सकूँ कि क्या विफल होता है।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
AI Markdown स्रोत लिखता है, PDF टूल्स जो न दिखा सकें उन चिह्नों को साफ़ करता है, हर रूपांतरण को दिखते एरर आउटपुट के साथ चलाता है, और नतीजे जाँचता है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Document Generation Fallback Workflow (Unicode-Safe)
When to Use
Use this skill when shell_agent returns unknown or unclear errors on complex document generation tasks, especially when:
- Generating documents in multiple formats (e.g.,
.docx,.pdf,.html) - The error message doesn't provide clear debugging information
- You need to handle special characters, symbols, or non-ASCII text safely
- PDF generation fails due to LaTeX encoding issues
Core Technique
Instead of delegating the entire document generation to shell_agent, manually split the workflow into discrete, observable steps:
- Content creation → Use
write_fileto create source document (Markdown) - Unicode sanitization → Preprocess markdown to replace problematic characters before PDF conversion
- Format conversion with stderr capture → Use
run_shellwithpandocfor each target format, capturing full stderr output - Verification → Check output files exist and are valid
⚠️ Unicode & LaTeX Compatibility Warning
Critical: 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 |
Step-by-Step Workflow
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: Sanitize Unicode Characters (Pre-PDF Conversion)
Before PDF conversion, create a sanitized version of your markdown with LaTeX-safe characters:
write_file
path: /tmp/document_source_sanitized.md
content: |
# Document Title
## Section 1
Content here... (with all special chars replaced per table above)
Alternative: Use a shell script to sanitize:
run_shell
command: sed -e 's/—/--/g' -e 's/–/-/g' -e 's/"([^"]*)"/"\1"/g' -e 's/'([^']*)/'\1'/g' /tmp/document_source.md > /tmp/document_source_sanitized.md
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 pandoc commands for each format. Use sanitized source for PDF, original for other formats.
Critical: Always capture stderr output (2>&1) to diagnose failures before retrying with alternative engines.
run_shell
command: pandoc /tmp/document_source.md -o output.docx
run_shell
command: pandoc /tmp/document_source.md -o output.html
Step 3a: PDF Conversion - Try xelatex First (Best Unicode Support)
Use xelatex as the first engine - it has better Unicode support and is commonly available in containerized environments:
run_shell
command: pandoc /tmp/document_source_sanitized.md --pdf-engine=xelatex -o output.pdf 2>&1
Step 3b: If xelatex Fails - Capture Full Error and Retry with wkhtmltopdf
Before retrying, examine the full stderr output from Step 3a to understand the failure cause (missing engine, font issues, etc.). Then try wkhtmltopdf as fallback:
run_shell
command: pandoc /tmp/document_source_sanitized.md --pdf-engine=wkhtmltopdf -o output.pdf 2>&1
Step 4: Verify Outputs
Check that files were created successfully:
run_shell
command: ls -lh output.docx output.pdf output.html
Complete Example
# Generate Negotiation Strategy Document
## Step 1: Write Markdown source
write_file
path: /tmp/negotiation_strategy.md
content: |
# Negotiation Strategy
## Executive Summary
[Content with original unicode...]
## Resolution Path
[Content...]
## BATNA Analysis
[Content...]
## Step 2: Creat
अक्सर पूछे जाने वाले सवाल
कुछ चिह्न क्यों बदले जाते हैं?
कुछ PDF इंजन घुमावदार कोट्स या em dash जैसे चिह्न नहीं दिखा सकते, इसलिए सरल रूप इस्तेमाल होते हैं।
कौन से फ़ॉर्मैट बनते हैं?
गाइड Word, PDF और HTML आउटपुट का वर्णन करती है।
क्या एरर छिपाए जाते हैं?
नहीं, गाइड कहती है कि पूरा एरर आउटपुट पकड़ें, ताकि हर विफलता दिखे।
जानकारी
लेखक का मूल विवरण
Unicode-safe fallback workflow for multi-format document generation with character sanitization and explicit error capture
repo: HKUDS/AgentPilot
लोकप्रियता
- GitHub स्टार
- 7.8k
- रैंकिंग में स्थान
- #12864
- लाइसेंस
- 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 फ़ाइल तक किसकी पहुंच है, यह जांचने और बदलने देती है, और आपके अनुरोध के लिए सबसे छोटी अनुमति चुनती है।