fallback-doc-with-delegation
できること
このスキルは、データツールが失敗した後、AIエージェントが文書を作る方法を示します。整形されたPDFや、プレーンテキストやMarkdownのファイルなど、完成した文書が必要な人向けです。
使う場面
- ✓PDFの読み取りや検索が失敗した後も、文書を作らなければならないとき。
- ✓整形されたPDFなど、複雑な形式の文書が必要なとき。
- ✓プレーンテキストやMarkdownの単純な文書で、直接書けるとき。
スキルのリンク
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/write-file-fallback-report-enhanced/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“PDFリーダーとウェブ検索の両方が失敗しました。できれば整形されたPDFとして、要約文書を作ってください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントは、複雑さに応じて方法を選びます。整形された文書の場合は、明確な作業をシェルエージェントに渡します。単純なテキストやMarkdownの場合は、ファイル書き込みツールで直接書きます。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Fallback Document Generation with Delegation
When to Use This Skill
Use this workflow when attempting to generate a document or report, but multiple primary data source tools fail simultaneously:
read_filereturns binary/image data instead of text (common with PDFs)search_webreturns errors or no resultsexecute_code_sandboxfails unexpectedly- Other data retrieval tools are unavailable
Key insight: Rather than getting stuck on failed data retrieval, pivot immediately to generating the document using the most appropriate available method—either shell_agent for complex formats or write_file for simple text.
Step-by-Step Instructions
Step 1: Detect Tool Failure Pattern
Recognize when you're in a fallback scenario:
TOOL_FAILURE_INDICATORS = [
"read_file returns binary or image data",
"search_web returns unknown error or empty results",
"execute_code_sandbox fails repeatedly",
"Multiple consecutive tool failures on data retrieval"
]
Decision point: If 2+ indicators are present, proceed to Step 2.
Step 2: Choose the Appropriate Fallback Method
Critical Decision: Select between shell_agent and write_file based on document complexity:
Use shell_agent when... |
Use write_file when... |
|---|---|
| Generating PDFs or formatted documents | Creating simple markdown/text files |
| Complex layout or styling needed | Plain structured content is sufficient |
| External libraries required (reportlab, pandoc) | No special formatting libraries needed |
| Multi-step generation process | Single-pass content generation |
| Verification/validation needed | Direct file creation is adequate |
Decision Tree:
Is the output a PDF or complex formatted document?
├── YES → Use shell_agent (delegates to skilled agent)
└── NO → Is it markdown or plain text?
├── YES → Use write_file (direct content generation)
└── NO → Use shell_agent (handles uncertainty)
Step 3A: Execute with shell_agent (Complex Documents)
For PDFs and complex formatting:
# Delegate to shell_agent with clear task description
shell_agent(
task="Generate a professional [document type] about [topic]. "
"Use appropriate libraries (e.g., reportlab for PDFs). "
"Include: [list key sections/requirements]. "
"Save to working directory as [filename]."
)
Advantages of shell_agent:
- Agent autonomously handles library selection and usage
- Automatically retries and fixes errors
- Can use multiple tools internally (run_shell, execute_code_sandbox)
- Validates output before completion
Example:
shell_agent(
task="Create a 1-page SBAR (Situation-Background-Assessment-Recommendation) "
"template PDF with 4 sections. Each section should have guiding points "
"and blank lined spaces for user input. Use reportlab library. "
"Save as SBAR_template.pdf in current directory."
)
Step 3B: Execute with write_file (Simple Documents)
For markdown and plain text:
# Generate content with embedded domain knowledge
report_content = f"""# [Document Title]
## Executive Summary
[Brief overview of key findings/content]
## Background
[Context and scope - use embedded knowledge]
## Main Content
[Organized sections with headers, lists, tables as appropriate]
## Limitations & Notes
[Transparent about data source limitations if relevant]
## Recommendations/Next Steps
[Actionable guidance based on available information]
"""
write_file(path="output/report.md", content=report_content)
Step 4: Structure Content Professionally
Regardless of method, ensure professional organization:
# [Document Title]
## Executive Summary
[Brief overview of key findings/content]
## Background
[Context and scope - use embedded knowledge]
## Main Content
[Organized sections with headers, lists, tables as appropriate]
## Limitations & Notes
[Transparent about data source limitations if relevant]
## Recommendations/Next Steps
[Actionable guidance based on available information]
Step 5: Leverage Embedded Domain Knowledge
When external data is unavailable:
- Use general domain knowledge appropriately
- Clearly distinguish between verified facts and general guidance
- Include actionable frameworks rather than specific unverified data
- Add placeholder notes where specific data would enhance the document
Examp
よくある質問
エージェントはいつシェルエージェントを使いますか?
PDFなど、整形された文書の場合に使うようスキルは述べています。
プレーンなファイルで十分なのはいつですか?
シンプルなテキストやMarkdownは、ファイル書き込みツールで直接書けるとスキルは述べています。
失敗したデータはまだ必要ですか?
取得に失敗し続けるのではなく、文書を作ることに切り替えるよう述べています。
詳細
作者による元の説明
Generate professional documents after tool failures using shell_agent for complex formats or write_file for simple text/markdown
repo: HKUDS/AgentPilot
人気
- GitHubのスター
- 7.8k
- ランキング
- #13032
- ライセンス
- 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エージェントが、プログラムを改善する方法を調べる間に、小さな実験を計画し、その結果を読み、発見を記録できるよう支援します。
似ているスキル
obsidian-vault-maintainer
394kObsidianと相性のよいメモリボールトを整理して、動くウィキリンク、統一されたプロパティ、安全に生成されるセクションを保つようエージェントを支援します。
wiki-maintainer
394k同じ内容を繰り返し保てるページ、安全な管理ブロック、矛盾や抜けの確認を使って、OpenClawのメモリウィキを維持するようエージェントを支援します。
obsidian
394k公式のObsidianコマンドラインを使って、Obsidianのメモ、タスク、リンク、プロパティを読み、検索し、作成し、編集するようエージェントを支援します。