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

document-gen-dual-backend

하는 일

이 스킬은 대부분의 문서 작업에 직접 명령을 쓰고, 복잡한 경우에는 도우미 에이전트를 두도록 AI에게 안내합니다. Markdown으로 Word, PDF 또는 HTML 파일을 만들어야 하는 사람에게 맞습니다.

사용하는 경우

  • ✓간단한 문서를 Markdown에서 Word, PDF 또는 HTML로 만들어야 할 때.
  • ✓내용이 단순하고 AI가 어떤 변환 명령을 쓸지 이미 알고 있는 경우.
  • ✓오류 후 변환 방법을 자동으로 바꿔야 하는 문서 작업을 할 때.

스킬 링크

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

AI에게 요청하는 예시

“이 Markdown을 PDF와 Word 파일로 바꿔 주세요. 간단하게 만들고, 무언가 깨질 때만 예비 방법을 써 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

대부분의 작업에서 AI가 내용을 쓰고 pandoc이나 ReportLab을 직접 실행합니다. 복잡한 경우에는 pandoc과 ReportLab 두 가지 PDF 경로를 함께 쓰고 각 결과를 확인합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Document Generation: Dual-Backend Workflow (Unicode-Safe)

When to Use

Default Approach: Lightweight Direct Execution (Recommended for 90% of tasks)

For most document generation tasks, use direct write_file + run_shell without shell_agent:

  • Generating documents in standard formats (.docx, .pdf, .html) from Markdown
  • Content is straightforward with minimal special characters
  • You already know the pandoc/ReportLab commands needed
  • Quick single-format or multi-format output is needed

Fallback Approach: shell_agent Delegation (For Complex Scenarios Only)

Use shell_agent delegation only when:

  • Automated fallback handling between backends requires complex logic
  • Dynamic content generation needs programmatic decision-making
  • You need to capture and analyze error messages for intelligent retry logic

When shell_agent May Be Useful (Optional)

Only consider shell_agent delegation for:

  • Complex error recovery requiring automated backend switching
  • Dynamic workflows with conditional branching based on generation results

Core Technique

For simple tasks (default): Use direct write_file + run_shell with pandoc or ReportLab (no shell_agent needed)

For complex tasks requiring fallback logic: Split the workflow into discrete, observable steps with two PDF generation paths:

Path A (Pandoc): Best for Markdown-to-PDF conversion with rich text formatting Path B (ReportLab): Best for programmatic PDF generation without LaTeX dependencies

Workflow steps:

  1. Content creation → Use write_file to create source document (Markdown)
  2. Choose PDF backend → Decide between pandoc (rich formatting) or ReportLab (programmatic control)
  3. Unicode handling → Apply sanitization for pandoc; ReportLab handles Unicode natively
  4. Format conversion → Use run_shell with appropriate commands for each format
  5. Verification → Check output files exist and are valid

⚠️ Backend Selection Guide

Requirement Recommended Backend Rationale
Markdown source with headers, lists, tables Pandoc Native Markdown parsing
Heavy Unicode/special characters ReportLab Native UTF-8 support, no sanitization needed
LaTeX not available ReportLab Pure Python, no external dependencies
Precise layout control (positions, graphics) ReportLab Programmatic canvas control
Quick DOCX + PDF + HTML batch Pandoc Single tool, multiple outputs
Tables with complex formatting Pandoc Better table rendering
Dynamic/charts/graphs in PDF ReportLab Drawing operations support

Unicode & LaTeX Compatibility Warning

Critical for Pandoc Path: 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

ReportLab Path: Handles Unicode natively. Pass content as UTF-8 strings; no character sanitization required.

Step-by-Step Workflow

Quick Start: Lightweight Direct Execution (Default for Most Tasks)

This is the recommended approach for most document generation tasks. No shell_agent delegation needed:

# Step 1: Write Markdown content
write_file
path: /tmp/doc.md
content: |
  # My Document
  
  Simple content here.

# Step 2: Convert with pandoc (direct)
run_shell
command: pandoc /tmp/doc.md -o output.docx

# Step 3: Verify
run_shell
command: ls -lh output.docx

For PDF with potential Unicode issues:

# Create sanitized version if needed
write_file
path: /tmp/doc_sanitized.md
content: |
  # My Document
  Content with safe ASCII characters only.

run_shell
command: pandoc /tmp/doc_sanitized.md -o output.pdf

For Unicode-heavy content (use ReportLab directly):

write
자주 묻는 질문

주요 방법은 무엇인가요?

직접 명령이 기본입니다. 대부분의 문서 작업을 처리할 수 있기 때문입니다.

도우미 에이전트는 언제 필요한가요?

자동 오류 처리나 변환 방법 전환이 필요한 복잡한 경우에만 필요합니다.

결과물을 확인하나요?

네, 가이드는 만들어진 각 파일을 확인하라고 안내합니다.

상세 정보

작성자의 원본 설명

Document generation with direct pandoc/ReportLab execution (lightweight default) and optional shell_agent fallback for complex scenarios

repo: HKUDS/AgentPilot

인기도

GitHub 스타
7.8k
순위
#12860
라이선스
MIT
업데이트
2026. 11. 1.

이 스킬이 유용한가요?

0

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

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬