Pular para o conteúdo
Skillpedia
Código em geral7,8 mil · #12880

fallback-file-creation

O que ela faz

Esta skill dá à IA uma forma manual, baseada em shell, de criar e verificar arquivos quando as ferramentas de execução de código continuam falhando. Ela é para quem precisa que formatos específicos de arquivo sejam criados com confiabilidade.

Quando usar

  • ✓Quando a execução de código ou os auxiliares de shell falharam várias vezes em uma tarefa de arquivo.
  • ✓Quando preciso que um PDF ou arquivo Word seja criado e as ferramentas usuais não funcionam.
  • ✓Quando quero que cada arquivo seja verificado depois de gravado.

Link da skill

https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/fallback-file-creation/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/fallback-file-creation/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

“As ferramentas de código continuam falhando no meu arquivo. Verifique a pasta, escreva o script no shell e confirme que o arquivo realmente está lá.”

5 skills novas por semana. 1 minuto de leitura.

Como funciona

A IA confirma a pasta de trabalho, escreve scripts com um heredoc de shell, roda-os usando um caminho explícito e verifica se cada arquivo de saída existe.

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

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

Fallback File Creation Workflow

Use this skill when execute_code_sandbox or shell_agent fails repeatedly for file creation tasks. This pattern provides a manual but reliable approach to create and verify files.

When to Use

  • Code execution tools fail after multiple retries
  • You need to create specific file formats (PDF, DOCX, etc.)
  • Direct shell commands are more reliable than generated scripts
  • You need explicit verification of file outputs

Step-by-Step Instructions

Step 1: Verify Working Directory

Before any file operations, confirm your current location:

pwd
ls -la

This ensures you're creating files in the correct workspace directory.

Step 2: Create Scripts via Heredoc

Use shell heredocs to create scripts with properly escaped syntax:

cat > /path/to/script.sh << 'EOF'
#!/bin/bash
# Your script content here
# Variables are NOT expanded inside 'EOF' (quoted)
echo "Creating file..."
# Commands to generate output
EOF

Key escaping rules:

  • Use 'EOF' (quoted) to prevent variable expansion inside the heredoc
  • Use EOF (unquoted) if you want shell variables to expand
  • Escape any $, backticks, or special characters if using unquoted EOF

Step 3: Execute with Explicit Path

Always run scripts with their full or explicit relative path:

chmod +x /path/to/script.sh
/path/to/script.sh
# or
bash /path/to/script.sh

Avoid relying on . or implicit paths.

Step 4: Verify Output

After execution, verify files were created correctly:

# Check file exists and size
ls -lh /path/to/output.file

# For PDFs: inspect metadata
pdfinfo /path/to/output.pdf

# For DOCX: check structure
unzip -l /path/to/output.docx | head -20

# For any file: check content preview
file /path/to/output.file
head -c 500 /path/to/output.file

Step 5: Iterative Debugging

If verification fails:

  1. Check error messages from script execution
  2. Verify all dependencies are available (which command)
  3. Test individual commands from the script manually
  4. Re-run with verbose output (bash -x script.sh)

Example: Creating a PDF Document

# Step 1: Verify directory
pwd
ls -la

# Step 2: Create conversion script
cat > /workspace/create_pdf.sh << 'EOF'
#!/bin/bash
cd /workspace
libreoffice --headless --convert-to pdf checklist.odt --outdir .
EOF

# Step 3: Execute
chmod +x /workspace/create_pdf.sh
/workspace/create_pdf.sh

# Step 4: Verify
ls -lh /workspace/checklist.pdf
pdfinfo /workspace/checklist.pdf

Example: Creating a DOCX Document

# Step 1: Verify directory
pwd
ls -la

# Step 2: Create document script
cat > /workspace/create_docx.sh << 'EOF'
#!/bin/bash
cd /workspace
pandoc -f markdown -t docx action_tracker.md -o action_tracker.docx
EOF

# Step 3: Execute
chmod +x /workspace/create_docx.sh
/workspace/create_docx.sh

# Step 4: Verify
ls -lh /workspace/action_tracker.docx
unzip -l /workspace/action_tracker.docx | head -20

Best Practices

  1. Always verify before and after - Check directory state before starting and after completion
  2. Use absolute or explicit paths - Avoid ambiguity in file locations
  3. Quote heredoc delimiters - Use 'EOF' to prevent unwanted variable expansion
  4. Make scripts executable - Always chmod +x before running
  5. Inspect file metadata - Use format-specific tools (pdfinfo, unzip -l, file) to verify content
  6. Keep scripts simple - Each script should do one thing well
  7. Clean up temporary files - Remove intermediate files after successful completion

Troubleshooting

Issue Solution
Script not found Use full path: /workspace/script.sh
Permission denied Run chmod +x script.sh
File not created Check script output, verify working directory in script
Wrong file format Verify conversion tool supports target format
Corrupted output Re-run with verbose mode, check intermediate files
Perguntas frequentes

Por que usar um heredoc?

Ele permite que a IA escreva um script inteiro em um arquivo com um único comando de shell.

Por que verificar a pasta de trabalho antes?

Isso garante que os arquivos sejam criados no espaço de trabalho correto.

As variáveis são expandidas dentro do script?

Com um marcador EOF entre aspas, não são, o que mantém o texto do script exatamente como escrito.

Detalhes

Descrição original do autor

Fallback pattern for reliable file creation when code execution tools fail

repo: HKUDS/AgentPilot

Popularidade

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

Essa skill é útil?

0

Entre para votar.

Comentários

  • …

Mais skills deste repositório

Skills parecidas