document-gen-resilient
하는 일
이 스킬은 문서 생성을 작고 확인 가능한 단계로 나누고, 변환이 실패하면 대체 방법을 쓰라고 AI에게 알려 줍니다. 문서 생성이 계속 실패하거나 여러 파일 형식이 필요한 사람을 위한 것입니다.
사용하는 경우
- ✓문서 생성이 실패하고 셸 도우미가 불분명한 오류를 낼 때.
- ✓같은 시점에 .docx, .pdf, .html 형식의 문서가 필요할 때.
- ✓LaTeX 인코딩 문제나 필요한 소프트웨어 누락으로 PDF 생성이 실패하는 경우.
스킬 링크
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/document-gen-fallback-enhanced-enhanced-96865f/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“문서 생성이 계속 실패합니다. 여기서 작동하는 도구를 써서 제 보고서를 Word 파일과 PDF 파일로 만들어 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
AI는 어떤 도구를 쓸 수 있는지 확인하고, 내용을 Markdown으로 작성하고, 형식마다 특수 문자를 어떻게 다룰지 정하고, 주 방법을 먼저 시도한 뒤 대체 방법으로 넘어가고, 파일을 검증합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Resilient Document Generation Workflow
When to Use
Use this skill when document generation tasks encounter errors or when you need reliable multi-format output:
shell_agentreturns unknown or unclear errors on document generation- Generating documents in multiple formats (e.g.,
.docx,.pdf,.html) - PDF generation fails due to LaTeX encoding or missing dependencies
- You need to handle special characters, symbols, or non-ASCII text safely
- Previous document generation attempts have failed
Core Technique
Instead of delegating the entire document generation to shell_agent, manually split the workflow into discrete, observable steps with built-in fallbacks:
- Tool availability check → Verify pandoc and PDF engines are available
- Content creation → Use
write_fileto create source document (Markdown) - Unicode assessment → Determine if sanitization is needed based on target format
- Format conversion → Try primary method, fall back to alternatives on failure
- Verification → Check output files exist and are valid
⚠️ Format-Specific Unicode Guidance
Critical: Different formats handle Unicode differently. Plan accordingly:
| Format | Unicode Support | Sanitization Needed? | Recommended Engine |
|---|---|---|---|
.docx |
Excellent | No | pandoc (default) |
.html |
Excellent | No | pandoc (default) |
.pdf (pdflatex) |
Limited | Yes | pandoc + sanitization |
.pdf (xelatex) |
Good | Rarely | pandoc --pdf-engine=xelatex |
.pdf (wkhtmltopdf) |
Good | Rarely | pandoc --pdf-engine=wkhtmltopdf |
.pdf (Python) |
Excellent | No | fpdf2 or reportlab |
Step-by-Step Workflow
Step 0: Check Tool Availability
Before starting, verify which tools are available:
run_shell
command: which pandoc && echo "PANDOC: OK" || echo "PANDOC: MISSING"
run_shell
command: which pdflatex && echo "PDFLATEX: OK" || echo "PDFLATEX: MISSING"
run_shell
command: which xelatex && echo "XELATEX: OK" || echo "XELATEX: MISSING"
run_shell
command: python3 -c "import fpdf; print('FPDF2: OK')" 2>/dev/null || echo "FPDF2: MISSING"
Decision Tree Based on Availability:
- pandoc + xelatex available → Use pandoc with xelatex engine (best Unicode support)
- pandoc + pdflatex only → Use pandoc with sanitization (Step 2)
- pandoc missing, Python available → Use Python libraries (Step 3 Alternative)
- All missing → Install dependencies or use shell_agent with explicit instructions
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: Assess and Handle Unicode (Conditional)
Before PDF conversion, check if your content contains problematic characters:
run_shell
command: grep -P '[\x{2014}\x{2013}\x{201C}\x{201D}\x{2026}]' /tmp/document_source.md && echo "UNICODE_DETECTED" || echo "UNICODE_CLEAN"
If Unicode detected AND using pdflatex, create a sanitized version:
write_file
path: /tmp/document_source_sanitized.md
content: |
# Document Title
## Section 1
Content here... (with all special chars replaced per table below)
Common Problematic Characters:
| 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] [ ] |
© ® ™ |
May require packages | (c) (r) (tm) |
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 commands for each format. Try primary method first, fall back on failure.
For DOCX (from original, no sanitization needed):
run_shell
command: pandoc /tmp/document_source.md -o output.docx
For PDF (try in order):
**Option A: xelatex (best
자주 묻는 질문
왜 한 도우미에게 모든 것을 맡기지 않나요?
작업을 관찰 가능한 단계로 나누면 실패가 어디서 일어나는지 쉽게 알 수 있다고 안내서가 말합니다.
Word는 특수 문자를 어떻게 처리하나요?
안내서에 따르면 .docx는 유니코드를 매우 잘 처리하며, 보통 정리가 필요 없습니다.
Python 대체 방법은 무엇인가요?
주요 도구를 쓸 수 없을 때 reportlab이나 fpdf2 같은 라이브러리를 안내합니다.
상세 정보
작성자의 원본 설명
Multi-path document generation with tool checks, Unicode handling, and Python fallbacks
repo: HKUDS/AgentPilot
인기도
- GitHub 스타
- 7.8k
- 순위
- #12859
- 라이선스
- MIT
- 업데이트
- 2026. 11. 1.
댓글
- …
이 저장소의 다른 스킬
agentpilot
7.8k작업을 준비하고 AgentPilot 루프를 실행해 변경을 제안, 테스트, 점수화하면서 프로젝트를 단계적으로 개선하도록 돕습니다.
openspace
7.8k에이전트 스킬을 저장하고 가져오는 도구인 OpenSpace를 설정하고, MCP를 통해 AI 앱에 연결하도록 돕습니다.
rsi-arena
7.8kAIME나 Terminal-Bench 같은 표준 AI 벤치마크 테스트를 설정하고 실행해 서로 다른 개선 방법을 비교하도록 돕습니다.
experiment-guide
7.8k프로그램을 개선하는 방법을 조사하면서 작은 실험을 계획하고, 결과를 읽고, 발견 사항을 기록하도록 돕습니다.
비슷한 스킬
feishu-doc
394k에이전트가 문서 도구를 사용해 텍스트, 이미지, 표를 포함한 Feishu 클라우드 문서를 읽고, 만들고, 편집하도록 돕습니다.
feishu-drive
394k에이전트가 봇과 공유된 Feishu 클라우드 폴더의 파일을 찾아보고, 정리하고, 댓글을 달도록 돕습니다.
feishu-perm
394k에이전트가 요청을 충족하는 가장 작은 권한을 골라, Feishu 파일에 누가 접근할 수 있는지 확인하고 바꾸도록 돕습니다.