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

resilient-document-pipeline

Skill này làm gì

Skill này là quy trình tạo tài liệu trong điều kiện khó khăn: công cụ hỏng, nhiều định dạng đầu ra và ký tự đặc biệt. Dành cho người cần một tài liệu hoàn chỉnh ngay cả khi không tra cứu được.

Khi nào nên dùng

  • ✓Khi đọc tệp hoặc tìm kiếm web liên tục trả về lỗi trong lúc làm tài liệu.
  • ✓Khi tôi cần cùng một tài liệu dưới dạng Word, PDF và HTML từ một nguồn.
  • ✓Khi tài liệu có dấu gạch dài, dấu nháy cong, mũi tên hoặc ký hiệu khác.

Liên kết skill

https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/document-gen-fallback-enhanced-merged/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-enhanced-merged/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ìm kiếm web liên tục thất bại khi tôi viết báo cáo. Hãy viết từ kiến thức của bạn và cho tôi bản Word và bản PDF.”

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

Cách hoạt động

Sau nhiều lần công cụ thất bại, AI viết nội dung từ kiến thức sẵn có, làm sạch ký tự đặc biệt, thử các cách chuyển đổi lần lượt và kiểm tra từng đầu ra.

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.

Resilient Document Generation Pipeline

When to Use This Skill

Use this workflow when generating documents in challenging environments where:

  • Tool failures are likely or have occurred: read_file, search_web, read_webpage, or execute_code_sandbox return errors
  • Multiple formats are needed: Generate .docx, .pdf, .html from the same source
  • Unicode/special characters are present: Documents contain em dashes, curly quotes, arrows, symbols, or non-ASCII text
  • Primary conversion methods may fail: LaTeX/pandoc may not be available or misconfigured

This skill combines early failure detection, domain-knowledge content creation, progressive conversion fallbacks, and Unicode safety into a single resilient workflow.

Core Workflow Overview

┌─────────────────────────────────────────────────────────────────┐
│  1. DETECT tool failures (2+ indicators → pivot immediately)   │
└────────────────┬────────────────────────────────────────────────┘
                 │
┌────────────────▼────────────────────────────────────────────────┐
│  2. CREATE content with write_file using embedded domain       │
│     knowledge (professionally structured markdown)              │
└────────────────┬────────────────────────────────────────────────┘
                 │
┌────────────────▼────────────────────────────────────────────────┐
│  3. SANITIZE unicode (create LaTeX-safe version for PDF)       │
└────────────────┬────────────────────────────────────────────────┘
                 │
┌────────────────▼────────────────────────────────────────────────┐
│  4. CONVERT with progressive fallbacks:                        │
│     pandoc → reportlab → fpdf2 → wkhtmltopdf                   │
└────────────────┬────────────────────────────────────────────────┘
                 │
┌────────────────▼────────────────────────────────────────────────┐
│  5. VERIFY outputs exist and are valid                          │
└─────────────────────────────────────────────────────────────────┘

Step-by-Step Workflow

Step 1: Detect Tool Failure Pattern

Before attempting document generation, check for failure indicators:

TOOL_FAILURE_INDICATORS = [
    "read_file returns binary/image data instead of text",
    "search_web returns unknown error or empty results",
    "read_webpage returns unknown error on multiple URLs",
    "execute_code_sandbox fails unexpectedly",
    "pandoc command fails with 'unknown error'",
    "Multiple consecutive tool failures on data retrieval"
]

Decision point: If 2+ indicators are present within the first 2-3 iterations:

  1. Stop attempting to fix the failing tools
  2. Acknowledge the limitation briefly in your output
  3. Commit to generating the document with available knowledge
  4. Proceed to Step 2 immediately

Step 2: Create Content with write_file

Write your document as professionally structured Markdown using embedded domain knowledge:

write_file
path: /tmp/document_source.md
content: |
  # [Document Title]
  
  ## Executive Summary
  [Brief overview of key content - use domain knowledge]
  
  ## Background
  [Context and scope - leverage embedded expertise]
  
  ## Main Content
  [Organized sections with headers, lists, tables]
  
  ## Limitations & Notes
  [Transparent about data source limitations if relevant]
  
  ## Recommendations/Next Steps
  [Actionable guidance based on available information]

Best practices for content:

  • Use general domain knowledge appropriately when external data is unavailable
  • 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:
> **Note**: Specific [metric/data point] would typically be sourced from 
> [expected source]. The guidance below reflects established best practices.

Step 3: Sanitize Unicode Characters (Pre-PDF Conversion)

Critical: PDF generation via pandoc typically uses LaTeX, which has limited Unicode support. Create a sanitized version:

Option A: Manual write_file (Recommended for control)

write_file
path: /tmp/document_source_sanitized.md
content: |
  [Same content as Step 2, but with these replacements:]

Character replacement table:

Character Issue Safe Replacement
— (em dash) May not render
Câu hỏi thường gặp

Nội dung có được kiểm chứng với nguồn không?

Không khi dùng phương án dự phòng, vì nó dựa vào kiến thức sẵn có, nên AI cần nói rõ điều đó.

Thế nào là lỗi công cụ?

Hướng dẫn nói đến các lỗi lặp lại từ đọc tệp, tìm kiếm web hoặc chạy code.

Những định dạng nào được tạo ra?

Hướng dẫn bao gồm .docx, .pdf và .html được tạo từ cùng một nguồn.

Chi tiết

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

Unified document generation with tool failure detection, domain knowledge fallback, progressive conversion, and Unicode safety

repo: HKUDS/AgentPilot

Độ phổ biến

Sao GitHub
7.8k
Vị trí xếp hạng
#12863
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ự