doc-gen-unicode-diagnostic
できること
このスキルは、原因不明のエラーを避けるための、文書作成の段階的な方法をAIに与えます。特殊な文字を含む文書を作る人や、書き出しの失敗が繰り返し起きている人向けです。
使う場面
- ✓PDFの作成が、エンコーディングやLaTeXのエラーで失敗したとき。
- ✓文書の作成が、詳細のない原因不明のエラーを返すとき。
- ✓文書に、慎重な扱いが必要な特殊な文字や記号が含まれているとき。
スキルのリンク
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/document-gen-fallback-enhanced-enhanced-3d3a9a/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“PDFの書き出しがLaTeXのエラーで何度も失敗します。テキストには記号が含まれています。原因を見つけて、PDFを作ってください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
AIはまず、どの文書ツールがインストールされているかを確認し、特殊な文字を整えてから、一連のPDFエンジンを試し、失敗時にはエラーメッセージを取り込んで原因を診断します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Document Generation with Diagnostic Workflow (Unicode-Safe)
When to Use
Use this skill when document generation tasks fail or return unclear errors, especially when:
- Generating documents in multiple formats (
.docx,.pdf,.html) - PDF generation fails with encoding/LaTeX errors
shell_agentreturns "unknown error" without diagnostics- Documents contain special characters, symbols, or non-ASCII text
- You need systematic error diagnosis rather than blind retries
⚠️ Critical: Why This Skill Exists
Recent executions show 43% effectiveness because agents:
- Skip unicode sanitization before PDF conversion
- Don't try
xelatexengine (better Unicode support) - Don't capture stderr for proper diagnosis
- Exhaust iterations on repeated failures without systematic troubleshooting
This skill fixes those gaps with mandatory steps.
Pre-Flight Validation (NEW - Required Step 0)
Before starting document generation, verify your toolchain:
run_shell
command: which pandoc && pandoc --version | head -3
run_shell
command: which pdflatex xelatex wkhtmltopdf 2>/dev/null || echo "Some engines missing"
run_shell
command: python3 -c "import sys; print(sys.version)"
If pandoc is missing, install it:
run_shell
command: apt-get update && apt-get install -y pandoc
For PDF support, install LaTeX engines:
run_shell
command: apt-get install -y texlive-latex-recommended texlive-fonts-recommended texlive-xetex
Core Technique
Manually split the workflow into observable, diagnostic steps:
- Pre-flight → Verify toolchain availability
- Content creation → Use
write_filefor markdown source (visible content) - Unicode sanitization → MANDATORY for PDF: Create sanitized version
- Format conversion with fallback → Try engines in order, capture stderr
- Verification → Check outputs exist and validate content
Unicode & LaTeX Compatibility (MANDATORY for PDF)
PDF generation via LaTeX has limited Unicode support. Before PDF conversion, you MUST sanitize:
| 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 | ... |
→ ← ↑ ↓ (arrows) |
LaTeX incompatibility | -> <- ^ v |
✓ ✗ (checkmarks) |
May not render | [x] [ ] |
★ ● (symbols) |
May not render | * - |
© ® ™ |
Require packages | (c) (r) (tm) |
| Non-ASCII (é, ñ, ü) | Font-dependent | Keep for xelatex, sanitize for pdflatex |
DOCX and HTML handle Unicode natively - use original markdown for these formats.
Step-by-Step Workflow
Step 0: Pre-Flight Validation
run_shell
command: which pandoc || (apt-get update && apt-get install -y pandoc)
run_shell
command: which xelatex || echo "xelatex not available - will use fallback"
Step 1: Create Source Content with write_file
write_file
path: /tmp/document_source.md
content: |
# Document Title
## Section 1
Your content here with full Unicode support...
## Section 2
Special chars: "quotes" — dashes … ellipsis ✓ checkmarks
Step 2: Create Sanitized Version for PDF (MANDATORY)
Option A: Manual sanitization with write_file
write_file
path: /tmp/document_source_sanitized.md
content: |
# Document Title
## Section 1
Your content here...
## Section 2
Special chars: "quotes" -- dashes ... ellipsis [x] checkmarks
Option B: Automated sanitization script
First create the script:
write_file
path: /tmp/sanitize_for_pdf.sh
content: |
#!/bin/bash
INPUT="$1"
OUTPUT="${2:-${1%.md}_sanitized.md}"
sed -e 's/—/--/g' -e 's/–/-/g' \
-e 's/"([^"]*)"/"\1"/g' -e "s/'([^']*)'/\`\1\`/g" \
-e 's/…/.../g' -e 's/→/->/g' -e 's/←/<-/g' \
-e 's/✓/[x]/g' -e 's/✗/[ ]/g' \
-e 's/©/(c)/g' -e 's/®/(r)/g' -e 's/™/(tm)/g' \
"$INPUT" > "$OUTPUT"
echo "Sanitized: $INPUT -> $OUTPUT"
run_shell
command: chmod +x /tmp/sanitize_for_pdf.sh && /tmp/sanitize_for_pdf.sh /tmp/document_source.md /tmp/document_source_sanitized.md
Step 3: Convert to DOCX (from original, supports Unicode)
run_shell
command: pandoc /tmp/document_source.md -o output.docx 2>&1
Capture stderr with 2>&1 t
よくある質問
どのツールをインストールする必要がありますか?
ガイドは、pandocと、PDF出力のためのpdflatexやxelatexなどのLaTeXエンジンを挙げています。
なぜエラーメッセージを取り込むのですか?
エラーの出力を読めば、やみくもに再試行せず、本当の原因を見つけられるからです。
どのエンジンがUnicodeをよく扱えますか?
ガイドは、xelatexがpdflatexよりASCII以外の文字によく対応していると述べています。
詳細
作者による元の説明
Systematic document generation with unicode sanitization, engine fallback chain, and explicit error diagnosis
repo: HKUDS/AgentPilot
人気
- GitHubのスター
- 7.8k
- ランキング
- #12857
- ライセンス
- 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のファイルにアクセスできる人を確認し、変更するようエージェントを支援します。依頼を満たす最小の権限を選びます。