본문으로 건너뛰기
Skillpedia
PDF, Word, 슬라이드7.8k · #12859

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가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/document-gen-fallback-enhanced-enhanced-96865f/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

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_agent returns 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:

  1. Tool availability check → Verify pandoc and PDF engines are available
  2. Content creation → Use write_file to create source document (Markdown)
  3. Unicode assessment → Determine if sanitization is needed based on target format
  4. Format conversion → Try primary method, fall back to alternatives on failure
  5. 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.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬