python-script
Create robust Python automation with full logging and safety checks. Use when tasks need complex data processing, authenticated API work, conditional file operations, or error handling beyond simple shell commands.
When & Why to Use This Skill
The Python Scripter skill empowers users to build and execute robust Python automation scripts with a focus on reliability and safety. It streamlines the development lifecycle—from scaffolding and linting to execution—by integrating structured logging, PEP 723 metadata, and mandatory safety checks. This skill is specifically designed for complex tasks that demand sophisticated data processing, secure API interactions, and rigorous error handling beyond the capabilities of basic shell scripts.
Use Cases
- Complex Data Processing: Automating the extraction, transformation, and loading (ETL) of large datasets with comprehensive error logging and validation.
- Secure API Orchestration: Managing multi-step authenticated API workflows that require precise response handling and secure credential management.
- Automated System Maintenance: Performing conditional file operations and directory cleanups with built-in dry-run paths to ensure system stability.
- DevOps Scripting: Creating reproducible environment setup scripts or monitoring tools with structured logging for audit trails and debugging.
| name | python-script |
|---|---|
| description | Create robust Python automation with full logging and safety checks. Use when tasks need complex data processing, authenticated API work, conditional file operations, or error handling beyond simple shell commands. |
Python Scripter
Overview
Design and run Python scripts with clear requirements, safety checks, and reproducible logging.
Workflow
- Confirm inputs, outputs, constraints, and preferred libraries.
- Identify risky operations and secure explicit approval.
- Scaffold a script with PEP 723 metadata and structured logging.
- Lint with
uvx ruff check --fix .agents/scripts/{script_name}.py. - Run with
uv run --script .agents/scripts/{script_name}.pyand monitor logs. - Report results, risks encountered, and any follow-up steps.
Logging requirements
- Log to
.agents/logs/{script_name}.logand stream to console - Capture start/end timestamps, parameters, file operations, and errors
- Add
RotatingFileHandlerif logs may grow large
Template
Read references/script-template.md for the full script template.
Safety practices
- Provide dry-run or rollback paths
- Validate external inputs and API responses
- Use temporary directories for intermediates
- Never run destructive steps without confirmation