document-python-direct
Fungsinya
Skill ini menunjukkan kepada agent AI untuk menjalankan kode dokumennya secara langsung di shell untuk spreadsheet dan PDF. Skill ini ditujukan untuk orang yang menginginkan keluaran andal tanpa batasan agent shell.
Kapan dipakai
- βSaat pekerjaan spreadsheet atau PDF kompleks berisiko mencapai batas langkah agent shell.
- βSaat agent shell menghasilkan error yang tidak dijelaskan pada pekerjaan pemformatan.
- βSaat Anda menginginkan kontrol yang tepat atas impor dan penanganan error dalam skrip dokumen.
Link skill
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/spreadsheet-direct-python-merged-f07ee1/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
βBuat ringkasan Excel dan laporan PDF dari data saya sekaligus. Gunakan skrip Python yang dijalankan langsung agar errornya jelas.β
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Agent menulis kode Python ke file dan menjalankannya lewat shell dalam satu langkah. Skrip membuat file dan mencetak pesan, lalu agent membaca output itu untuk memastikan keberhasilan.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.
Direct Python Execution for Document and Spreadsheet 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 reports, checklists, or forms
- Applying formulas, formatting, or data transformations
- Working with
openpyxl,pandas,reportlab,fpdf2, 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 spreadsheet 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
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 > process_document.py << 'EOF'
import openpyxl
from openpyxl import Workbook
# Your spreadsheet code here
wb = openpyxl.load_workbook('file.xlsx')
# ... operations ...
wb.save('output.xlsx')
print('Success')
EOF
# Step 2: Execute the script
python3 process_document.py
Alternative Pattern: Inline Heredoc (Simple Scripts Only)
For short, simple scripts when NOT using shell_agent as the executor:
python3 << 'EOF'
import openpyxl
# Simple operation
wb = openpyxl.load_workbook('file.xlsx')
wb.save('output.xlsx')
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]
for row in ws.iter_rows(min_row=2, max_col=5):
pass
wb.save('tour_data_processed.xlsx')
Example 3: Complex Formatting Operations
from openpyxl import load_workbook
from openpyxl.styles import Font, PatternFill, Alignment
wb = load_workbook('report.xlsx')
ws = wb.active
header_fill = PatternFill(start_color='4472C4', fill_type='solid')
header_font = Font(bold=True, color='FFFFFF')
for cell in ws[1]:
cell.fill = header_fill
cell.font = header_font
cell.alignment = Alignment(horizontal='center')
wb.save('report_formatted.xlsx')
PDF Generation Examples
Example 4: Basic PDF Report with reportlab
from reportlab.lib.pagesizes import letter
from reportlab.pdfgen import canvas
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer
# Create PDF document
doc = SimpleDocTemplate('report.pdf', pagesize=letter)
styles = getSampleStyleSheet()
story = []
# Add content
story.append(Paragraph('Monthly Report', styles['Heading1']))
story.append(Spacer(1, 12))
story.append(Paragraph('Generated successfully.', styles['Normal']))
# Build PDF
doc.build(story)
print('PDF created successfully')
Example 5: PDF Checklist with fpdf2
from fpdf import FPDF
# Create PDF instance
pdf = FPDF()
pdf.add_page()
pdf.set_font('Arial', 'B', 16)
# Title
pdf.cell(0, 10, 'Safety Checklist', ln=True, align='C')
pdf.ln(10)
# Checklist items
pdf.set_font('Arial', '', 12)
items = ['Check equipment', 'Verify connections', 'Test system', 'Document results']
for i, item in enumerate(items, 1):
pdf.cell(5, 10, f'[ ] {item}', ln=True)
# Save
pdf.output('checklist.pdf')
print('Checklist PDF generated')
Example 6: Combined Spreadsheet + PDF Workflow
impor
Pertanyaan umum
Mengapa file yang disimpan membantu?
Skill ini menyatakan menulis skrip ke file .py terlebih dahulu menghindari masalah parsing heredoc pada agent shell.
Pustaka apa yang disebut?
Skill ini menyebut openpyxl, pandas, reportlab, dan fpdf2 sebagai pustaka umum untuk pekerjaan ini.
Siapa yang paling diuntungkan?
Orang yang memerlukan spreadsheet atau PDF yang dibuat secara andal dari skrip, tanpa rangkaian langkah yang panjang.
Detail
Deskripsi asli dari pembuat
Use direct Python execution for reliable spreadsheet and document/PDF generation operations
repo: HKUDS/AgentPilot
Popularitas
- Bintang GitHub
- 7.8k
- Peringkat
- #13013
- Lisensi
- MIT
- Diperbarui
- 1/11/2026
Komentar
- β¦
Skill lain dari repositori ini
agentpilot
7.8kMembantu agent Anda meningkatkan proyek langkah demi langkah dengan menyiapkan tugas dan menjalankan loop AgentPilot yang mengusulkan, menguji, dan memberi skor pada perubahan.
openspace
7.8kMembantu agent Anda menyiapkan OpenSpace, alat yang menyimpan dan mengambil skill agent, lalu menghubungkannya ke aplikasi AI Anda melalui MCP.
rsi-arena
7.8kMembantu agent Anda menyiapkan dan menjalankan tes benchmark AI standar, seperti AIME dan Terminal-Bench, untuk membandingkan berbagai metode perbaikan.
experiment-guide
7.8kMembantu agent Anda merencanakan eksperimen kecil, membaca hasilnya, dan mencatat temuan saat menyelidiki cara memperbaiki sebuah program.
Skill serupa
feishu-doc
394kMembantu agent Anda membaca, membuat, dan mengedit dokumen cloud Feishu, termasuk teks, gambar, dan tabel, dengan memakai alat dokumen.
feishu-drive
394kMemungkinkan agent Anda menelusuri, mengatur, dan memberi komentar pada file di folder cloud Feishu yang sudah dibagikan kepada bot.
feishu-perm
394kMembantu agent Anda memeriksa dan mengubah siapa yang dapat mengakses file Feishu, dengan memilih izin terkecil yang memenuhi permintaan Anda.