Python Scripter
Overview
Design and run Python scripts with clear requirements, safety checks, and reproducible logging.
Workflow
{project} is the git repo name (if in a git repo) or the basename of the current working directory.
- 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/sessions/{project}/scripts/{script_name}.py. - Run with
uv run --script ~/.agents/sessions/{project}/scripts/{script_name}.pyand monitor logs. - Report results, risks encountered, and any follow-up steps.
Logging requirements
- Log to
~/.agents/sessions/{project}/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