document-gen-resilient-workflow
하는 일
이 스킬은 Word, PDF, HTML 같은 문서를 만드는 AI를 안내하며, 도구가 고장 날 때 대체 방법을 씁니다. 특히 특수 문자가 있는 신뢰할 수 있는 문서가 필요한 사람을 위한 것입니다.
사용하는 경우
- ✓LaTeX가 없거나 인코딩 오류로 PDF 생성이 실패할 때.
- ✓하나의 원본에서 여러 형식으로 문서가 나와야 할 때.
- ✓텍스트에 변환을 깨뜨리는 기호나 영어가 아닌 문자가 있는 경우.
스킬 링크
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/document-gen-fallback-enhanced-enhanced-2794b4/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“제 메모를 Word 파일과 PDF로 만들어야 하고, 악센트 문자가 제대로 보여야 합니다.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
AI는 내용을 Markdown으로 작성하고, 필요하면 특수 문자를 정리하고, 하나가 성공할 때까지 PDF 엔진을 순서대로 시도하며, 출력 파일이 유효한지 확인합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Resilient Document Generation Workflow (Multi-Engine Fallback)
When to Use
Use this skill when document generation tasks fail or when shell_agent returns unknown errors, especially for:
- Generating documents in multiple formats (
.docx,.pdf,.html) - PDF generation fails due to missing LaTeX, encoding issues, or tool errors
- Documents contain special characters, symbols, or non-ASCII text
- You need maximum reliability with automatic fallback options
Core Technique
Split document generation into discrete, observable steps with cascading fallbacks for PDF generation:
- Content creation → Use
write_fileto create source Markdown - Unicode sanitization → Use Python script for reliable character replacement
- Format conversion → Try multiple PDF engines in sequence until one succeeds
- Verification → Check file exists, has non-zero size, and is valid
⚠️ Unicode & PDF Engine Guide
Different PDF engines have different Unicode support:
| Engine | Unicode Support | Best For | Fallback Position |
|---|---|---|---|
pdflatex |
Limited (ASCII-focused) | Simple documents | 1st (fastest) |
xelatex |
Full Unicode | Documents with non-ASCII | 2nd |
wkhtmltopdf |
Good Unicode | Web-style documents | 3rd |
reportlab (Python) |
Full control | Programmatic PDFs | 4th |
fpdf2 (Python) |
Full control | Simple text PDFs | 5th (last resort) |
Character Replacement Table
| Character | Issue | Safe Replacement |
|---|---|---|
— (em dash) |
LaTeX incompatibility | -- |
– (en dash) |
LaTeX incompatibility | - |
" " (curly quotes) |
Encoding errors | " " (straight) |
' ' (curly apostrophe) |
Encoding errors | ' (straight) |
… (ellipsis) |
May not render | ... |
→ ← ↑ ↓ |
LaTeX incompatibility | -> <- ^ v |
✓ ✗ |
May not render | [x] [ ] |
★ ● |
May not render | * - |
© ® ™ |
May require packages | (c) (r) (tm) |
é ñ ü |
Font-dependent | Keep for xelatex, replace for pdflatex |
Step-by-Step Workflow
Step 1: Create Source Content with write_file
Write your document content as Markdown to a source file:
write_file
path: /tmp/document_source.md
content: |
# Document Title
## Section 1
Content here...
## Section 2
More content...
Step 2: Sanitize Unicode with Python Script
Create a reusable Python sanitizer for reliable character replacement:
write_file
path: /tmp/sanitize_unicode.py
content: |
#!/usr/bin/env python3
import sys
import re
if len(sys.argv) < 2:
print("Usage: sanitize_unicode.py <input.md> [output.md]")
sys.exit(1)
input_file = sys.argv[1]
output_file = sys.argv[2] if len(sys.argv) > 2 else input_file.replace('.md', '_sanitized.md')
replacements = {
'—': '--', # em dash
'–': '-', # en dash
'"': '"', # left curly quote
'"': '"', # right curly quote
"'": "'", # left curly apostrophe
"'": "'", # right curly apostrophe
'…': '...', # ellipsis
'→': '->', # right arrow
'←': '<-', # left arrow
'↑': '^', # up arrow
'↓': 'v', # down arrow
'✓': '[x]', # checkmark
'✗': '[ ]', # cross
'★': '*', # star
'●': '-', # bullet
'©': '(c)', # copyright
'®': '(r)', # registered
'™': '(tm)', # trademark
}
with open(input_file, 'r', encoding='utf-8') as f:
content = f.read()
for old, new in replacements.items():
content = content.replace(old, new)
with open(output_file, 'w', encoding='utf-8') as f:
f.write(content)
print(f"Sanitized: {input_file} -> {output_file}")
Apply sanitization for PDF:
run_shell
command: python3 /tmp/sanitize_unicode.py /tmp/document_source.md /tmp/document_source_sanitized.md
Note: Keep original for DOCX/HTML (these formats handle Unicode well).
Step 3: Convert to Target Formats with Cascading Fallbacks
For DOCX (from original, no sanitization needed):
run_shell
command: pandoc /tmp/document_source.md -o output.docx
For PDF (try multiple engines in sequence):
Attempt 1: pdflatex (fastest, limited Unicode)
run_shell
command: pandoc /tmp/document_source_sanitized.md -o output.pdf --pdf-engine=pdflatex
*If pdflatex fails, Attempt 2: xelatex (full Unicode)
자주 묻는 질문
어떤 PDF 엔진을 시도하나요?
pdflatex, xelatex, wkhtmltopdf, reportlab, fpdf2를 정해진 순서의 옵션으로 나열합니다.
유니코드 지원이 왜 중요한가요?
일부 PDF 엔진은 ASCII가 아닌 문자를 잘 처리하지 못하므로, 안내서는 어떤 엔진을 쓸지 설명합니다.
결과를 확인하나요?
네. 파일이 있고, 내용이 있고, 유효한지 확인하라고 안내서가 말합니다.
상세 정보
작성자의 원본 설명
Multi-engine document generation with cascading PDF fallbacks and robust Unicode handling
repo: HKUDS/AgentPilot
인기도
- GitHub 스타
- 7.8k
- 순위
- #12856
- 라이선스
- 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 파일에 누가 접근할 수 있는지 확인하고 바꾸도록 돕습니다.