‹ 首页

document-gen-fallback

@hkuds · 收录于 5 天前 · 上游提交 1 周前

Fallback workflow for multi-format document generation when shell_agent encounters errors

适合你,如果使用文档生成工具时经常遇到错误需要备用方案

/ 通过 npx 安装 校验哈希
npx oh-my-skill add hkuds/openspace/document-gen-fallback
/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- hkuds/openspace/document-gen-fallback
/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify hkuds/openspace/document-gen-fallback
安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
6920GitHub stars
~742上下文体积 · 单文件
索引托管

怎么用

商店整理自技能原文 · 版本 2c5cc40 · 表述以原文为准
它做什么

当 shell_agent 出错时,Claude 会改用手动分步流程生成文档:先用 write_file 创建 Markdown 源文件,再用 pandoc 转换为 docx、pdf 等多种格式,最后验证文件是否存在。

什么时候触发

当 shell_agent 在生成多格式文档(如 docx、pdf、html)时返回不明确的错误时触发。

装好后可以这样说
Claude 会运行 pandoc 命令并验证文件生成。
技能原文 SKILL.md作者撰写 · MIT · 2c5cc40

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:

  1. Content creation → Use write_file to create source document (Markdown)
  2. Format conversion → Use run_shell with pandoc for each target format
  3. 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 (texlive package) or use --pdf-engine=wkhtmltopdf
  • DOCX formatting issues: Add --reference-doc=template.docx for custom styles
  • Unicode/encoding errors: Add -f markdown+utf8 to pandoc command
  • Missing pandoc: Install via apt-get install pandoc or brew 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.

按 MIT 许可原样转载,未经改动 · 在 GitHub 查看 →

评论

登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。