Pular para o conteúdo
Skillpedia
PDF, Word e slides7,8 mil · #12857

doc-gen-unicode-diagnostic

O que ela faz

Esta skill dá à IA um método passo a passo para geração de documentos que evita erros pouco claros. Ela é para quem cria documentos com caracteres especiais ou enfrenta falhas repetidas na exportação.

Quando usar

  • ✓Quando a geração de PDF falha com erros de codificação ou de LaTeX.
  • ✓Quando a geração de documento retorna um erro pouco claro e sem detalhes.
  • ✓Quando o documento contém caracteres especiais ou símbolos que precisam de tratamento cuidadoso.

Link da skill

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

Copie 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

Use esta skill para me ajudar: https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/document-gen-fallback-enhanced-enhanced-3d3a9a/SKILL.md Leia o arquivo SKILL.md desse link e siga as instruções dele na minha tarefa.
Quer que a sua IA encontre skills como esta sozinha?Instale o MCP grátis do Skillpedia: uma linha, e ela pesquisa entre 15.000+ skills antes de cada tarefa.Instalar em 1 minuto →

Exemplo do que pedir para a IA

“Minha exportação de PDF continua falhando com um erro de LaTeX, e o texto tem símbolos. Encontre a causa e gere o PDF.”

5 skills novas por semana. 1 minuto de leitura.

Como funciona

A IA verifica primeiro quais ferramentas de documento estão instaladas, depois limpa os caracteres especiais, tenta uma sequência de motores de PDF e captura as mensagens de erro para diagnosticar qualquer falha.

Conteúdo técnico (SKILL.md original)

Texto original do autor, em inglês, direto do GitHub.

Document Generation with Diagnostic Workflow (Unicode-Safe)

When to Use

Use this skill when document generation tasks fail or return unclear errors, especially when:

  • Generating documents in multiple formats (.docx, .pdf, .html)
  • PDF generation fails with encoding/LaTeX errors
  • shell_agent returns "unknown error" without diagnostics
  • Documents contain special characters, symbols, or non-ASCII text
  • You need systematic error diagnosis rather than blind retries

⚠️ Critical: Why This Skill Exists

Recent executions show 43% effectiveness because agents:

  • Skip unicode sanitization before PDF conversion
  • Don't try xelatex engine (better Unicode support)
  • Don't capture stderr for proper diagnosis
  • Exhaust iterations on repeated failures without systematic troubleshooting

This skill fixes those gaps with mandatory steps.

Pre-Flight Validation (NEW - Required Step 0)

Before starting document generation, verify your toolchain:

run_shell
command: which pandoc && pandoc --version | head -3
run_shell
command: which pdflatex xelatex wkhtmltopdf 2>/dev/null || echo "Some engines missing"
run_shell
command: python3 -c "import sys; print(sys.version)"

If pandoc is missing, install it:

run_shell
command: apt-get update && apt-get install -y pandoc

For PDF support, install LaTeX engines:

run_shell
command: apt-get install -y texlive-latex-recommended texlive-fonts-recommended texlive-xetex

Core Technique

Manually split the workflow into observable, diagnostic steps:

  1. Pre-flight → Verify toolchain availability
  2. Content creation → Use write_file for markdown source (visible content)
  3. Unicode sanitization → MANDATORY for PDF: Create sanitized version
  4. Format conversion with fallback → Try engines in order, capture stderr
  5. Verification → Check outputs exist and validate content

Unicode & LaTeX Compatibility (MANDATORY for PDF)

PDF generation via LaTeX has limited Unicode support. Before PDF conversion, you MUST sanitize:

Character Issue Safe Replacement
— (em dash) LaTeX incompatibility --
– (en dash) LaTeX incompatibility -
" " (curly quotes) Encoding errors " " (straight)
' ' (curly apostrophe) Encoding errors ' (straight)
… (ellipsis) May not render ...
→ ← ↑ ↓ (arrows) LaTeX incompatibility -> <- ^ v
✓ ✗ (checkmarks) May not render [x] [ ]
★ ● (symbols) May not render * -
© ® ™ Require packages (c) (r) (tm)
Non-ASCII (é, ñ, ü) Font-dependent Keep for xelatex, sanitize for pdflatex

DOCX and HTML handle Unicode natively - use original markdown for these formats.

Step-by-Step Workflow

Step 0: Pre-Flight Validation

run_shell
command: which pandoc || (apt-get update && apt-get install -y pandoc)
run_shell
command: which xelatex || echo "xelatex not available - will use fallback"

Step 1: Create Source Content with write_file

write_file
path: /tmp/document_source.md
content: |
  # Document Title
  
  ## Section 1
  Your content here with full Unicode support...
  
  ## Section 2
  Special chars: "quotes" — dashes … ellipsis ✓ checkmarks

Step 2: Create Sanitized Version for PDF (MANDATORY)

Option A: Manual sanitization with write_file

write_file
path: /tmp/document_source_sanitized.md
content: |
  # Document Title
  
  ## Section 1
  Your content here...
  
  ## Section 2
  Special chars: "quotes" -- dashes ... ellipsis [x] checkmarks

Option B: Automated sanitization script

First create the script:

write_file
path: /tmp/sanitize_for_pdf.sh
content: |
  #!/bin/bash
  INPUT="$1"
  OUTPUT="${2:-${1%.md}_sanitized.md}"
  sed -e 's/—/--/g' -e 's/–/-/g' \
      -e 's/"([^"]*)"/"\1"/g' -e "s/'([^']*)'/\`\1\`/g" \
      -e 's/…/.../g' -e 's/→/->/g' -e 's/←/<-/g' \
      -e 's/✓/[x]/g' -e 's/✗/[ ]/g' \
      -e 's/©/(c)/g' -e 's/®/(r)/g' -e 's/™/(tm)/g' \
      "$INPUT" > "$OUTPUT"
  echo "Sanitized: $INPUT -> $OUTPUT"
run_shell
command: chmod +x /tmp/sanitize_for_pdf.sh && /tmp/sanitize_for_pdf.sh /tmp/document_source.md /tmp/document_source_sanitized.md

Step 3: Convert to DOCX (from original, supports Unicode)

run_shell
command: pandoc /tmp/document_source.md -o output.docx 2>&1

Capture stderr with 2>&1 t

Perguntas frequentes

Quais ferramentas precisam estar instaladas?

O guia cita o pandoc e motores LaTeX como pdflatex ou xelatex para a saída em PDF.

Por que capturar as mensagens de erro?

Ler a saída de erro permite à IA encontrar a causa real em vez de tentar de novo às cegas.

Qual motor lida melhor com Unicode?

O guia diz que o xelatex tem melhor suporte a texto fora do ASCII do que o pdflatex.

Detalhes

Descrição original do autor

Systematic document generation with unicode sanitization, engine fallback chain, and explicit error diagnosis

repo: HKUDS/AgentPilot

Popularidade

Estrelas no GitHub
7,8 mil
Posição no ranking
#12857
Licença
MIT
Atualizada em
01/11/2026

Essa skill é útil?

0

Entre para votar.

Comentários

  • …

Mais skills deste repositório

Skills parecidas