Chuyển đến nội dung
Skillpedia
PDF, Word và slide7.8k · #12865

document-gen-fallback

Skill này làm gì

Skill này chia việc tạo tài liệu thành một tệp nguồn và các bước chuyển đổi riêng. Dành cho người muốn thấy từng bước đang làm gì khi tác vụ tài liệu thất bại.

Khi nào nên dùng

  • ✓Khi một trợ lý trả về lỗi không rõ với tài liệu cần tạo ở nhiều định dạng.
  • ✓Khi tôi cần thấy chính xác chỗ chuyển đổi bị sai.
  • ✓Khi tôi muốn lưu văn bản nguồn thành Markdown trước, rồi mới chuyển đổi.

Liên kết skill

https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/document-gen-fallback/SKILL.md

Sao 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

Hãy dùng skill này để giúp tôi: https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/document-gen-fallback/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Tôi cần cùng một báo cáo dưới dạng tệp Word và tệp HTML. Hãy lưu thành Markdown trước rồi chuyển đổi từng định dạng riêng.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

AI ghi nội dung vào tệp Markdown, chạy pandoc một lần cho mỗi định dạng đích, và kiểm tra từng tệp đầu ra có tồn tại.

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.

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.

Câu hỏi thường gặp

Vì sao phải ghi tệp Markdown trước?

Nó tạo một nguồn rõ ràng mà tất cả các định dạng đầu ra cùng dùng.

Công cụ nào chuyển đổi tệp?

Hướng dẫn dùng pandoc cho từng định dạng đích.

Thành công được kiểm tra thế nào?

Hướng dẫn yêu cầu xác nhận các tệp đầu ra tồn tại và hợp lệ.

Chi tiết

Mô tả gốc của tác giả

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

repo: HKUDS/AgentPilot

Độ phổ biến

Sao GitHub
7.8k
Vị trí xếp hạng
#12865
Giấy phép
MIT
Cập nhật
1/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự