document-gen-unicode-safe
하는 일
이 스킬은 문서 생성을 눈에 보이는 단계로 나누고, 문자 정리와 오류 기록을 함께 합니다. 악센트, 기호 또는 영어가 아닌 텍스트가 들어간 문서를 만드는 사람에게 맞습니다.
사용하는 경우
- ✓셸 도우미가 문서 작업에서 불분명한 오류를 반환할 때.
- ✓문서에 PDF 문제를 일으키는 악센트 문자나 기호가 있을 때.
- ✓여러 형식이 필요하고 각 단계의 결과를 보고 싶은 경우.
스킬 링크
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/document-gen-fallback-enhanced/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“도우미가 문서를 만들다가 계속 실패합니다. 텍스트에 악센트가 있으니 각 단계를 직접 실행해서 어디서 실패하는지 보여 주세요.”
매주 새 스킬 5개. 읽는 데 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 엔진은 곡선 따옴표나 긴 대시 같은 문자를 표시하지 못하므로 더 단순한 문자를 씁니다.
어떤 형식이 만들어지나요?
가이드는 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
- 업데이트
- 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 파일에 누가 접근할 수 있는지 확인하고 바꾸도록 돕습니다.