fallback-doc-with-delegation
Skill này làm gì
Skill này hướng dẫn AI agent tạo tài liệu sau khi công cụ dữ liệu thất bại. Nó dành cho những người cần một tài liệu hoàn chỉnh, có thể là PDF định dạng đẹp hoặc file văn bản hay markdown đơn giản.
Khi nào nên dùng
- ✓Khi đọc PDF hoặc tìm kiếm web thất bại nhưng tài liệu vẫn phải được tạo ra.
- ✓Khi tài liệu thuộc định dạng phức tạp như PDF định dạng đẹp.
- ✓Khi tài liệu là văn bản đơn giản hoặc markdown và có thể được viết trực tiếp.
Liên kết skill
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/write-file-fallback-report-enhanced/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Công cụ đọc PDF và tìm kiếm web của tôi đều thất bại. Hãy vẫn làm tài liệu tóm tắt, nếu được thì làm thành PDF định dạng đẹp.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent chọn phương pháp theo độ phức tạp. Với tài liệu định dạng, nó đưa một nhiệm vụ rõ ràng cho shell agent, còn với văn bản hoặc markdown đơn giản thì nó ghi file trực tiếp bằng công cụ ghi file.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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
Câu hỏi thường gặp
Khi nào agent dùng shell agent?
Skill nói dùng cho PDF và các tài liệu định dạng khác.
Khi nào một file đơn giản là đủ?
Skill nói văn bản đơn giản hoặc markdown có thể được viết trực tiếp bằng công cụ ghi file.
Nó có còn cần dữ liệu đã thất bại không?
Skill nói hãy chuyển sang tạo tài liệu thay vì mắc kẹt ở việc lấy dữ liệu đã thất bại.
Chi tiết
Mô tả gốc của tác giả
Generate professional documents after tool failures using shell_agent for complex formats or write_file for simple text/markdown
repo: HKUDS/AgentPilot
Độ phổ biến
- Sao GitHub
- 7.8k
- Vị trí xếp hạng
- #13032
- Giấy phép
- MIT
- Cập nhật
- 1/11/2026
Bình luận
- …
Thêm skill từ kho mã này
agentpilot
7.8kGiúp agent của bạn cải thiện dự án từng bước bằng cách chuẩn bị tác vụ và chạy vòng lặp AgentPilot, gồm đề xuất, kiểm thử và chấm điểm thay đổi.
openspace
7.8kGiúp agent của bạn thiết lập OpenSpace, công cụ lưu và lấy lại skill của agent, rồi kết nối nó với ứng dụng AI của bạn qua MCP.
rsi-arena
7.8kGiúp agent của bạn thiết lập và chạy các bài kiểm thử benchmark AI chuẩn, như AIME và Terminal-Bench, để so sánh các phương pháp cải tiến khác nhau.
experiment-guide
7.8kGiúp agent của bạn lên kế hoạch các thí nghiệm nhỏ, đọc kết quả và ghi lại phát hiện khi tìm cách cải thiện một chương trình.
Skill tương tự
obsidian-vault-maintainer
394kGiúp agent của bạn giữ gọn kho ghi nhớ kiểu Obsidian, với liên kết wiki hoạt động tốt, thuộc tính nhất quán và các phần tự tạo an toàn.
wiki-maintainer
394kGiúp agent của bạn duy trì wiki bộ nhớ OpenClaw với các trang có thể lặp lại, khối được quản lý an toàn và kiểm tra mâu thuẫn hoặc thiếu sót.
obsidian
394kCho phép agent của bạn đọc, tìm, tạo và sửa ghi chú, công việc, liên kết và thuộc tính trong Obsidian bằng dòng lệnh Obsidian chính thức.