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

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

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

Use this skill to help me: https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/document-gen-fallback-enhanced-enhanced-2794b4/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으로 작성하고, 필요하면 특수 문자를 정리하고, 하나가 성공할 때까지 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:

  1. Content creation → Use write_file to create source Markdown
  2. Unicode sanitization → Use Python script for reliable character replacement
  3. Format conversion → Try multiple PDF engines in sequence until one succeeds
  4. 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.

이 스킬이 유용한가요?

0

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

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬