document-gen-resilient-workflow
O que ela faz
Esta skill é um método passo a passo para criar documentos Word, PDF ou HTML, com alternativas e detalhes de erro. Ela é para quem tem tarefas de documento que continuam falhando com erros desconhecidos.
Quando usar
- ✓Quando um comando de shell retorna um erro desconhecido, sem detalhes úteis.
- ✓Quando um PDF falha porque um motor LaTeX está ausente ou há um problema de codificação.
- ✓Quando a criação de documentos já falhou várias vezes em trabalhos semelhantes.
Link da skill
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/document-gen-fallback-enhanced-enhanced/SKILL.mdCopie e cole na sua IA (Claude, ChatGPT ou Cursor) pedindo para seguir as instruções.
Como usar
O jeito mais fácil: copie a mensagem e cole na sua IA. Ela lê a skill e segue as instruções.
Mensagem pronta para colar
Para Claude Code, Codex ou Cursor: rode na pasta do projeto e a skill fica instalada.
Baixe o SKILL.md e coloque na pasta de skills do seu agente.
Exemplo do que pedir para a IA
“Criar meu PDF continua falhando com um erro desconhecido. Verifique as ferramentas, tente outro motor e me diga o que deu errado.”
5 skills novas por semana. 1 minuto de leitura.
Como funciona
A IA verifica a pasta de trabalho e as ferramentas, escreve o conteúdo, captura a saída de erro, tenta os motores de PDF em ordem até um funcionar e confirma que o arquivo de saída pode ser lido.
Conteúdo técnico (SKILL.md original)
Texto original do autor, em inglês, direto do GitHub.
Resilient Document Generation Workflow
When to Use
Use this skill when document generation tasks encounter tool errors or failures, especially:
run_shellcommands return 'unknown error' without diagnostic details- PDF generation fails with LaTeX encoding or missing engine errors
- You need fallback options when primary conversion methods fail
- Workspace or path issues cause file access problems
- Unicode/special characters cause rendering issues in PDF output
shell_agenthas failed multiple times on similar tasks
Core Technique
Split document generation into observable, verifiable steps with explicit error capture and progressive fallback:
- Validate workspace → Confirm current directory and write permissions
- Pre-flight checks → Verify required tools (pandoc, LaTeX engines) are available
- Content creation → Use
write_filefor source Markdown with full visibility - Unicode sanitization → Preprocess for PDF conversion when needed
- Progressive conversion → Try multiple engines/methods until one succeeds
- Explicit error capture → Redirect stderr to diagnose failures
- Verification → Confirm output files exist and are readable
⚠️ Critical: Tool Error Patterns
'unknown error' from run_shell: This typically indicates:
- Sandbox execution context issues (not the command itself)
- Missing stderr capture preventing diagnosis
- Transient file access problems
Solution: Use explicit error capture with 2>&1 and verify tool availability first:
run_shell
command: pandoc --version 2>&1 || echo "PANDOC NOT AVAILABLE"
Pre-Flight Checklist
Before starting conversion, verify your environment:
## Pre-Flight Checks
### Check 1: Verify working directory
run_shell
command: pwd && ls -la
### Check 2: Verify pandoc availability
run_shell
command: pandoc --version 2>&1 | head -3 || echo "PANDOC MISSING"
### Check 3: Check LaTeX engines
run_shell
command: which pdflatex xelatex wkhtmltopdf 2>&1 || echo "Some engines missing"
### Check 4: Check Python libraries (fallback option)
run_shell
command: python3 -c "import fpdf; print('fpdf OK')" 2>&1 || echo "fpdf missing"
run_shell
command: python3 -c "import docx; print('python-docx OK')" 2>&1 || echo "python-docx missing"
Complete Step-by-Step Workflow
Step 1: Validate Workspace
Confirm you're in the correct directory and can write files:
run_shell
command: pwd && echo "Test write" > /tmp/workspace_test_$$.txt && ls -la /tmp/workspace_test_$$.txt && rm /tmp/workspace_test_$$.txt
If this fails, you may have directory permission issues. Use absolute paths for all files.
Step 2: Create Source Content with write_file
Write document content as Markdown to a source file:
write_file
path: /tmp/document_source.md
content: |
# Document Title
## Section 1
Content here...
Step 3: Unicode Sanitization (PDF Only)
Only needed for PDF conversion via LaTeX engines. DOCX and HTML handle Unicode natively.
Create a sanitized version replacing LaTeX-problematic characters:
write_file
path: /tmp/document_source_sanitized.md
content: |
# Document Title
[Same content with: em-dash → --, curly quotes → straight, → arrows → text, etc.]
Common replacements (see full table below):
| Original | Replace With |
|---|---|
— (em dash) |
-- |
" " (curly quotes) |
" " (straight) |
… (ellipsis) |
... |
→ ← (arrows) |
-> <- |
✓ ✗ |
[x] [ ] |
© ® ™ |
(c) (r) (tm) |
Alternative: Use sanitization script (see Scripts section below).
Step 4: Progressive Format Conversion
Try multiple methods in order of preference. Capture stderr explicitly for diagnosis.
Method A: DOCX Conversion (Most Reliable)
run_shell
command: pandoc /tmp/document_source.md -o output.docx 2>&1 && echo "SUCCESS" || echo "FAILED: $?"
If this fails, try with explicit UTF-8 flag:
run_shell
command: pandoc /tmp/document_source.md -f markdown+utf8 -o output.docx 2>&1
Method B: PDF Conversion (Progressive Fallback)
Try engines in this order until one succeeds:
run_shell
command: pandoc /tmp/document_source_sanitized.md -o output.pdf 2>&1 | tee /tmp/pdf_error.log && echo "PDF SUCCESS"
If Method B fails, check error log and try next engine:
run_shell
command: pandoc /tmp/document_source_sanitized.md --pdf-engine=xelatex -o output.pdf 2>&1 | tee
Perguntas frequentes
Quais ferramentas ela verifica primeiro?
Ela verifica o pandoc e os motores LaTeX antes de converter.
Por que capturar a saída de erro?
Os detalhes do erro mostram a causa real, para que a IA não precise adivinhar.
E se o problema for a pasta?
O guia manda verificar a pasta atual e as permissões de escrita antes de converter.
Detalhes
Descrição original do autor
Robust document generation with engine fallback chain, error diagnostics, and Python alternatives
repo: HKUDS/AgentPilot
Popularidade
- Estrelas no GitHub
- 7,8 mil
- Posição no ranking
- #12862
- Licença
- MIT
- Atualizada em
- 01/11/2026
Comentários
- …
Mais skills deste repositório
agentpilot
7,8 milAjuda seu agente a melhorar um projeto passo a passo, preparando uma tarefa e executando o ciclo do AgentPilot, que propõe, testa e pontua mudanças.
openspace
7,8 milAjuda seu agente a configurar o OpenSpace, uma ferramenta que armazena e busca skills de agentes, e a conectá-la ao seu app de IA pelo MCP.
rsi-arena
7,8 milAjuda seu agente a configurar e rodar testes padrão de benchmark de IA, como AIME e Terminal-Bench, para comparar diferentes métodos de melhoria.
experiment-guide
7,8 milAjuda seu agente a planejar pequenos experimentos, ler seus resultados e registrar descobertas enquanto investiga como melhorar um programa.
Skills parecidas
feishu-doc
394 milAjuda seu agente a ler, criar e editar documentos na nuvem do Feishu, incluindo textos, imagens e tabelas, usando a ferramenta de documentos.
feishu-drive
394 milPermite que seu agente navegue, organize e comente arquivos de uma pasta na nuvem do Feishu que foi compartilhada com o bot.
feishu-perm
394 milAjuda seu agente a verificar e alterar quem pode acessar um arquivo do Feishu, escolhendo a menor permissão que atende ao seu pedido.