document-gen-resilient-workflow
하는 일
이 스킬은 Word, PDF 또는 HTML 문서를 만드는 단계별 방법으로, 예비 방법과 오류 정보를 포함합니다. 알 수 없는 오류로 문서 작업이 계속 실패하는 사람에게 맞습니다.
사용하는 경우
- ✓셸 명령이 유용한 정보 없이 알 수 없는 오류를 반환할 때.
- ✓LaTeX 엔진이 없거나 인코딩 문제 때문에 PDF가 실패할 때.
- ✓비슷한 작업에서 문서 생성이 여러 번 실패한 경우.
스킬 링크
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/document-gen-fallback-enhanced-enhanced/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“PDF 만들기가 알 수 없는 오류로 계속 실패합니다. 도구를 확인하고 다른 엔진을 시도한 뒤, 무엇이 잘못됐는지 알려 주세요.”
매주 새 스킬 5개. 읽는 데 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
- 업데이트
- 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 파일에 누가 접근할 수 있는지 확인하고 바꾸도록 돕습니다.