本文へスキップ
Skillpedia
PDF・Word・スライド7.8k · #12858

document-gen-resilient-multiformat

できること

このスキルは、一つの文書の元データを複数の形式に変換する手順をAIに示し、先にツールを確認します。何がインストールされているかを推測せずに、一つの文書を複数のファイル形式で使いたい人向けです。

使う場面

  • ✓同じ文書が、Word、PDF、ウェブページの形式で必要なとき。
  • ✓pandocやPDFエンジンがパソコンに入っていないかもしれないとき。
  • ✓テキストに、形式ごとに扱いの異なる特殊な文字が含まれているとき。

スキルのリンク

https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/document-gen-fallback-enhanced-enhanced-618c9b/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/document-gen-fallback-enhanced-enhanced-618c9b/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“この文書をWord、PDF、HTMLで使えるようにしてください。どれかのツールが足りなければ教えてください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

AIは、どのツールがインストールされているかを確認し、元の文書を書き、形式ごとに特殊な文字を調整し、変換して、各出力ファイルが存在して有効かを確かめます。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Resilient Document Generation Workflow (Multi-Format + Unicode-Safe)

When to Use

Use this skill when generating documents in multiple formats (.docx, .pdf, .html) and you need:

  • Reliable execution with pre-flight environment verification
  • Automatic Unicode handling based on target format
  • Fallback options when primary tools (pandoc/LaTeX) are unavailable
  • Clear error isolation through discrete, observable steps

Trigger this workflow when:

  • shell_agent returns unknown/unclear errors on document generation
  • You need multiple output formats from one source
  • Documents contain special characters, symbols, or non-ASCII text
  • Previous PDF generation attempts failed due to encoding or missing dependencies

Pre-Flight Environment Check

Before starting, verify your environment has the required tools:

run_shell
command: which pandoc && pandoc --version | head -1
run_shell
command: which pdflatex || which xelatex || which wkhtmltopdf || echo "No PDF engine found"
run_shell
command: python3 -c "import fpdf; print('fpdf2 available')" 2>/dev/null || echo "fpdf2 not available"
run_shell
command: python3 -c "import reportlab; print('reportlab available')" 2>/dev/null || echo "reportlab not available"

If pandoc is missing: Install via apt-get install pandoc or brew install pandoc

If no PDF engine found: Choose fallback approach:

  • Install LaTeX: apt-get install texlive-latex-recommended texlive-fonts-recommended
  • Or use wkhtmltopdf: apt-get install wkhtmltopdf
  • Or use Python fallback (fpdf2/reportlab) - see Alternative PDF Generation section

Core Technique

Split the workflow into discrete, observable steps with automatic format detection:

  1. Environment check → Verify tools are available
  2. Content creation → Use write_file to create source Markdown
  3. Auto-sanitization → Conditionally sanitize based on target format (PDF needs it, DOCX/HTML don't)
  4. Format conversion → Use appropriate tool for each format with fallback options
  5. Verification → Check output files exist and validate content

⚠️ Unicode & Format Compatibility Matrix

Format Unicode Support Sanitization Needed Recommended Engine
.docx Excellent No pandoc (default)
.html Excellent No pandoc (default)
.pdf Limited (LaTeX) Yes xelatex > pdflatex > wkhtmltopdf > fpdf2
.pptx Good No pandoc (if available) or python-pptx

Critical Unicode Characters for PDF

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 0: Pre-Flight Check

Verify environment before proceeding:

run_shell
command: pandoc --version >/dev/null 2>&1 && echo "PANDOC_OK" || echo "PANDOC_MISSING"

If PANDOC_MISSING: Either install pandoc or use Alternative PDF Generation (Python-based)

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 with original unicode characters...
  
  ## Section 2
  More content...

Step 2: Conditional Unicode Sanitization

Only sanitize if generating PDF. Create sanitized version for PDF conversion:

write_file
path: /tmp/document_source_sanitized.md
content: |
  # Document Title
  
  ## Section 1
  Content with unicode replaced (em-dash -> --, curly quotes -> straight, etc.)
  
  ## Section 2
  More content...

Optional: Use sanitization script (see Unicode Sanitization Script section below):

run_shell
command: ./sanitize_for_pdf.sh /tmp/document_source.md /tmp/document_source_sanitized.md

Note: Keep the original unsanitized file for DOCX/HTML conversion (these

よくある質問

PDFエンジンが見つからない場合は?

ガイドは、fpdf2やreportlabなどのPythonによる代替手段を提示しています。

不足しているツールはインストールされますか?

ガイドは、ツールが不足している場合に、システムのパッケージコマンドでpandocやLaTeXエンジンをインストールすることに触れています。

なぜ特殊な文字が問題になるのですか?

形式ごとにUnicodeの扱いが異なるため、ガイドはそれを考慮に入れています。

詳細

作者による元の説明

Resilient multi-format document generation with environment checks, auto-sanitization, and fallback engines

repo: HKUDS/AgentPilot

人気

GitHubのスター
7.8k
ランキング
#12858
ライセンス
MIT
更新日
2026/11/1

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル