resilient-document-pipeline
What it does
This skill is a document workflow for difficult conditions: failing tools, several output formats and special characters. It is for people who need a finished document even when lookups do not work.
When to use it
- βWhen reading files or searching the web keeps returning errors during a document job.
- βWhen I need the same document as Word, PDF and HTML from one source.
- βWhen the document contains em dashes, curly quotes, arrows or other symbols.
Skill link
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/document-gen-fallback-enhanced-merged/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βThe web search keeps failing while I am writing a report. Please write it from your own knowledge and give me Word and PDF versions.β
5 new skills a week. 1 minute to read.
How it works
After repeated tool failures, the AI writes the content from built-in knowledge, cleans special characters, tries conversion methods one after another, and checks each output.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
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, orexecute_code_sandboxreturn errors - Multiple formats are needed: Generate
.docx,.pdf,.htmlfrom 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:
- Stop attempting to fix the failing tools
- Acknowledge the limitation briefly in your output
- Commit to generating the document with available knowledge
- 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 |
FAQ
Is the content checked against sources?
Not when the fallback is used, because it relies on built-in knowledge, so the AI should say so.
What counts as a tool failure?
The guide mentions repeated errors from file reading, web search or code execution tools.
Which formats are produced?
The guide covers .docx, .pdf and .html made from the same source.
Details
Original description by the author
Unified document generation with tool failure detection, domain knowledge fallback, progressive conversion, and Unicode safety
repo: HKUDS/AgentPilot
Popularity
- GitHub stars
- 7.8k
- Ranking position
- #12863
- License
- MIT
- Updated
- 11/1/2026
Comments
- β¦
More skills from this repository
agentpilot
7.8kHelps your agent improve a project step by step by preparing a task and running the AgentPilot loop that proposes, tests and scores changes.
openspace
7.8kHelps your agent set up OpenSpace, a tool that stores and fetches agent skills, and connect it to your AI app through MCP.
rsi-arena
7.8kHelps your agent set up and run standard AI benchmark tests, such as AIME and Terminal-Bench, to compare different improvement methods.
experiment-guide
7.8kHelps your agent plan small experiments, read their results and record findings while it investigates how to improve a program.
Similar skills
feishu-doc
394kHelps your agent read, create, and edit Feishu cloud documents, including text, images, and tables, using the document tool.
feishu-drive
394kLets your agent browse, organize, and comment on files in a Feishu cloud folder that has been shared with the bot.
feishu-perm
394kHelps your agent check and change who can access a Feishu file, choosing the smallest permission that meets your request.