document-gen-fallback
它能做什么
这项技能把文档制作拆分为一个源文件和若干独立的转换步骤。它适合在文档任务失败时,希望看清每一步在做什么的人。
适用场景
- ✓当辅助工具在需要制作多种格式的文档上返回含糊错误的时候。
- ✓当我需要准确看到转换究竟在哪里出错的时候。
- ✓当我希望先把源文本保存为 Markdown,再进行转换的时候。
技能链接
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/document-gen-fallback/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我需要同一份报告的 Word 文件和 HTML 文件。请先把它保存为 Markdown,然后分别转换每种格式。”
每周 5 个新技能,1 分钟读完。
工作原理
AI 会把内容写入一个 Markdown 文件,为每种目标格式各运行一次 pandoc,并检查每个输出文件是否存在。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Document Generation Fallback Workflow
When to Use
Use this skill when shell_agent returns unknown or unclear errors on complex document generation tasks, especially when:
- Generating documents in multiple formats (e.g.,
.docx,.pdf,.html) - The error message doesn't provide clear debugging information
- You need better visibility into each step of the generation process
Core Technique
Instead of delegating the entire document generation to shell_agent, manually split the workflow into discrete, observable steps:
- Content creation → Use
write_fileto create source document (Markdown) - Format conversion → Use
run_shellwithpandocfor each target format - Verification → Check output files exist and are valid
Step-by-Step Workflow
Step 1: Create Source Content with write_file
Write your document content as Markdown to a temporary source file. This gives you full visibility into the content being generated.
write_file
path: /tmp/document_source.md
content: |
# Document Title
## Section 1
Content here...
## Section 2
More content...
Step 2: Convert to Target Formats with run_shell
Use run_shell with explicit pandoc commands for each format. This isolates conversion errors.
run_shell
command: pandoc /tmp/document_source.md -o output.docx
run_shell
command: pandoc /tmp/document_source.md -o output.pdf
Step 3: Verify Outputs
Check that files were created successfully:
run_shell
command: ls -lh output.docx output.pdf
Complete Example
# Generate Negotiation Strategy Document
## Step 1: Write Markdown source
write_file
path: /tmp/negotiation_strategy.md
content: |
# Negotiation Strategy
## Executive Summary
[Content...]
## Resolution Path
[Content...]
## BATNA Analysis
[Content...]
## Step 2: Convert to DOCX
run_shell
command: pandoc /tmp/negotiation_strategy.md -o negotiation_strategy.docx
## Step 3: Convert to PDF
run_shell
command: pandoc /tmp/negotiation_strategy.md -o negotiation_strategy.pdf
## Step 4: Verify
run_shell
command: ls -lh negotiation_strategy.*
Advantages Over shell_agent
| Aspect | shell_agent | Manual Workflow |
|---|---|---|
| Error visibility | Opaque, may retry silently | Each step shows explicit output |
| Recovery | Automatic but may loop | Manual intervention at specific step |
| Debugging | Hard to isolate failure point | Clear which step failed |
| Control | Agent decides approach | You control each conversion |
Common pandoc Commands
# Markdown to Word
pandoc input.md -o output.docx
# Markdown to PDF (requires LaTeX or wkhtmltopdf)
pandoc input.md -o output.pdf
# Markdown to HTML
pandoc input.md -o output.html
# With custom template
pandoc input.md --template=template.html -o output.html
# With metadata
pandoc input.md -o output.pdf --metadata title="Document Title"
Troubleshooting
- PDF generation fails: Ensure LaTeX is installed (
texlivepackage) or use--pdf-engine=wkhtmltopdf - DOCX formatting issues: Add
--reference-doc=template.docxfor custom styles - Unicode/encoding errors: Add
-f markdown+utf8to pandoc command - Missing pandoc: Install via
apt-get install pandocorbrew install pandoc
When to Return to shell_agent
After successfully completing the manual workflow once, you can attempt shell_agent again for similar tasks, now with a known-working fallback if errors recur.
常见问题
为什么先写 Markdown 文件?
它提供了一个清晰的源文件,所有输出格式共享同一份内容。
由哪个工具进行转换?
指南为每种目标格式使用 pandoc。
如何判断成功?
指南要求确认输出文件存在且有效。
详情
作者的原始描述
Fallback workflow for multi-format document generation when shell_agent encounters errors
repo: HKUDS/AgentPilot
热度
- GitHub 星标
- 7.8k
- 排名
- #12865
- 许可证
- MIT
- 更新时间
- 2026/11/1
评论
- …
同一仓库的更多技能
agentpilot
7.8k帮你的智能体准备任务并运行 AgentPilot 循环,逐步改进项目:循环会提出修改、测试修改并为其打分。
openspace
7.8k帮你的智能体设置 OpenSpace,这是一个用于存储和获取智能体技能的工具,并通过 MCP 将其连接到你的 AI 应用。
rsi-arena
7.8k帮你的智能体设置并运行标准 AI 基准测试,例如 AIME 和 Terminal-Bench,用来比较不同的改进方法。
experiment-guide
7.8k帮你的智能体规划小型实验、阅读实验结果并记录发现,同时研究如何改进一个程序。