document-direct-python
O que ela faz
Esta skill orienta o agente de IA a criar documentos como pastas de trabalho do Excel, relatórios em PDF e formulários por meio de execuções diretas de Python. É para pessoas que precisam desses arquivos sem os atrasos de um agente de shell.
Quando usar
- ✓Quando você precisa de documentos em PDF, listas de verificação ou relatórios produzidos com Python.
- ✓Quando um trabalho de documento tem várias etapas e pode ultrapassar os limites do agente.
- ✓Quando um agente de shell falha na formatação ou na leitura de uma pasta de trabalho.
Link da skill
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/spreadsheet-direct-python-merged/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
“Crie um relatório em PDF com o reportlab e uma pasta de trabalho do Excel com o openpyxl a partir dos meus dados. Execute o código diretamente.”
5 skills novas por semana. 1 minuto de leitura.
Como funciona
O agente grava o código Python em um arquivo e o executa pelo shell com python3. O código usa bibliotecas de documentos para montar os arquivos, e o agente confere a saída impressa em busca de erros.
Conteúdo técnico (SKILL.md original)
Texto original do autor, em inglês, direto do GitHub.
Direct Python Execution for Document Generation Tasks
When to Use This Skill
Use direct run_shell with Python scripts for document operations when:
- Reading or writing complex Excel files with multiple sheets
- Generating PDF documents, checklists, or reports
- Applying formulas, formatting, or data transformations
- Working with
openpyxl,pandas,reportlab,FPDF, or similar libraries - The operation involves multiple steps that could exceed agent step limits
- You need precise control over error handling and debugging
- Complex scripts benefit from file-based execution for better reliability
Why Direct Execution?
The shell_agent tool can:
- Hit maximum step limits on complex multi-step operations
- Produce unexplained errors on formatting operations
- Fail on intricate document reads/writes due to iterative parsing
- Fail to parse heredoc syntax correctly, causing 'unknown error' failures
Direct run_shell with Python is more reliable because it:
- Executes in a single step with no iteration limits
- Provides clearer, immediate error messages
- Handles complex operations without step constraints
- Gives full control over library imports and execution flow
- Writing scripts to
.pyfiles first avoids shell_agent parsing issues with heredocs
How to Use
Handling Web Research Failures
When web research tools (search_web, read_webpage) fail or return 'unknown error':
- Assess what you need: Determine if the information is from well-documented regulatory frameworks, standards, or common knowledge that you can provide from internal knowledge.
- Proceed with available knowledge: For pharmacy compliance, OSHA standards, GDPR requirements, and similar well-established frameworks, generate documents using your training knowledge rather than waiting for web access.
- Document assumptions: Clearly note that materials were generated based on standard practices when source verification was unavailable.
- Use direct Python execution: Continue with the recommended
run_shellpattern to generate documents even without web-sourced content.
Example contingency workflow for pharmacy compliance:
# When web research fails, proceed with established regulatory knowledge
from reportlab.lib.pagesizes import letter
from reportlab.pdfgen import canvas
checklist_items = [
"Verify pharmacist license is current and displayed",
"Maintain controlled substance inventory logs",
"Ensure proper storage temperatures for medications",
"Keep patient counseling records for controlled substances",
"Display required pharmacy signage and notices"
]
# Generate PDF using these standard compliance items
This approach was successfully used in task 045aba2e-4093-42aa-ab7f-159cc538278c_phase2 where all web tools failed but pharmacy compliance PDFs were still created successfully.
Recommended Pattern: Write Script to File First
For complex multi-line scripts, especially when using shell_agent as executor:
# Step 1: Write the Python script to a file
cat > generate_document.py << 'EOF'
import openpyxl
from openpyxl import Workbook
# Your document code here
wb = openpyxl.load_workbook('file.xlsx')
# ... operations ...
wb.save('output.xlsx')
print('Success')
EOF
# Step 2: Execute the script
python3 generate_document.py
Alternative Pattern: Inline Heredoc (Simple Scripts Only)
For short, simple scripts when NOT using shell_agent as the executor:
python3 << 'EOF'
import pandas as pd
df = pd.read_excel('input.xlsx')
df.to_excel('output.xlsx', index=False)
print('Done')
EOF
Spreadsheet Examples
Example 1: Read and Transform Excel Data
Write to file first, then execute:
import pandas as pd
# Load data from specific sheet
df = pd.read_excel('input.xlsx', sheet_name='Revenue')
# Apply transformations
df['Net_Revenue'] = df['Gross_Revenue'] * (1 - df['Tax_Rate'])
# Save results
df.to_excel('output.xlsx', index=False, sheet_name='Processed')
Example 2: Multi-Sheet Operations with openpyxl
from openpyxl import load_workbook
wb = load_workbook('tour_data.xlsx')
# Iterate through sheets
for sheet_name in wb.sheetnames:
ws = wb[sheet_name]
# Apply formatting or calculations
for row in ws.iter_rows(min_row=2, max_col=5):
# Process cells
pass
wb.save('tour_data_processed.xlsx')
PDF Generation Examples
Example 3: Generate PDF Checklist with reportla
Perguntas frequentes
Qual é o principal benefício de uma execução direta?
A skill diz que ela roda em uma única etapa, com mensagens de erro claras e imediatas.
Ela consegue lidar com arquivos Word?
A skill cita documentos Word como um tipo de saída suportado.
O agente sempre usa um arquivo primeiro?
A skill recomenda gravar o script em um arquivo para códigos complexos e de várias linhas.
Detalhes
Descrição original do autor
Use direct Python execution for reliable document creation including spreadsheets, PDFs, and structured reports
repo: HKUDS/AgentPilot
Popularidade
- Estrelas no GitHub
- 7,8 mil
- Posição no ranking
- #13014
- 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.