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がスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
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_agentreturns 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:
- Environment check → Verify tools are available
- Content creation → Use
write_fileto create source Markdown - Auto-sanitization → Conditionally sanitize based on target format (PDF needs it, DOCX/HTML don't)
- Format conversion → Use appropriate tool for each format with fallback options
- 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
コメント
- …
このリポジトリの他のスキル
agentpilot
7.8kエージェントが、作業を準備し、変更案を提案してテストし、評価するAgentPilotのループを実行することで、プロジェクトを段階的に改善できるよう支援します。
openspace
7.8kエージェントが、スキルを保存し取り出すツールであるOpenSpaceをセットアップし、MCPを通じてAIアプリに接続できるよう支援します。
rsi-arena
7.8kエージェントが、AIMEやTerminal-Benchなどの標準的なAIベンチマークテストをセットアップして実行し、異なる改善方法を比較できるよう支援します。
experiment-guide
7.8kエージェントが、プログラムを改善する方法を調べる間に、小さな実験を計画し、その結果を読み、発見を記録できるよう支援します。
似ているスキル
feishu-doc
394kテキスト、画像、表を含むFeishuのクラウドドキュメントを、ドキュメントツールを使って読み、作成し、編集するようエージェントを支援します。
feishu-drive
394kボットと共有されたFeishuのクラウドフォルダ内のファイルを閲覧、整理、コメントできるようエージェントを支援します。
feishu-perm
394kFeishuのファイルにアクセスできる人を確認し、変更するようエージェントを支援します。依頼を満たす最小の権限を選びます。