Zum Inhalt springen
Skillpedia
PDF, Word & Folien7.8k · #13013

document-python-direct

Was er macht

Dieser Skill zeigt dem Agenten, wie er seinen Dokumentcode für Tabellen und PDFs direkt in der Shell ausführt. Er richtet sich an Menschen, die verlässliche Ergebnisse ohne die Grenzen eines Shell-Agenten wollen.

Wann du ihn nutzt

  • ✓Wenn eine Tabellen- oder PDF-Aufgabe komplex ist und das Schrittlimit eines Shell-Agenten gefährdet.
  • ✓Wenn ein Shell-Agent bei Formatierungsarbeit unerklärliche Fehler erzeugt hat.
  • ✓Wenn du in einem Dokumentskript genaue Kontrolle über Importe und Fehlerbehandlung willst.

Link zum Skill

https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/spreadsheet-direct-python-merged-f07ee1/SKILL.md

Kopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.

So nutzt du ihn

Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.

Fertige Nachricht zum Einfügen

Nutze diesen Skill, um mir zu helfen: https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/spreadsheet-direct-python-merged-f07ee1/SKILL.md Lies die SKILL.md unter diesem Link und folge ihren Anweisungen für meine Aufgabe.
Soll deine KI Skills wie diesen selbst finden?Installiere den kostenlosen Skillpedia-MCP: eine Zeile, und sie durchsucht vor jeder Aufgabe 15.000+ Skills.In 1 Minute installieren →

Beispielanfrage an deine KI

“Erstelle aus meinen Daten in einem Durchgang eine Excel-Zusammenfassung und einen PDF-Bericht. Nutze ein Python-Skript, das direkt läuft, damit die Fehler klar sind.”

5 neue Skills pro Woche. 1 Minute Lesezeit.

So funktioniert es

Der Agent schreibt den Python-Code in eine Datei und führt ihn in einem einzigen Shell-Schritt aus. Das Skript erstellt die Dateien und gibt eine Meldung aus, die der Agent zur Erfolgskontrolle liest.

Technischer Inhalt (originale SKILL.md)

Originaltext des Autors, auf Englisch, direkt von 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 .py files 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
Häufige Fragen

Warum hilft eine gespeicherte Datei?

Der Skill sagt, dass eine .py-Datei Parsing-Probleme mit Heredocs in einem Shell-Agenten vermeidet.

Welche Bibliotheken werden genannt?

Der Skill nennt openpyxl, pandas, reportlab und fpdf2 als gängige Bibliotheken für solche Aufgaben.

Wer profitiert am meisten?

Menschen, die Tabellen oder PDFs zuverlässig per Skript erstellen lassen wollen, ohne eine lange Kette von Schritten.

Details

Originalbeschreibung des Autors

Use direct Python execution for reliable spreadsheet and document/PDF generation operations

repo: HKUDS/AgentPilot

Beliebtheit

GitHub-Sterne
7.8k
Platz im Ranking
#13013
Lizenz
MIT
Aktualisiert
1.11.2026

Ist dieser Skill nützlich?

0

Anmelden um abzustimmen.

Kommentare

  • …

Weitere Skills aus diesem Repository

Ähnliche Skills