python-simple-scripts

Writes safe one-off Python helper scripts for ad-hoc data inspection and transformation tasks.

1|Updated Feb 25, 2026
One-click install
npx skills add https://github.com/cjthompson/claude-code-config --skill python-simple-scripts-cjthompson
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-simple-scripts
Source: https://github.com/cjthompson/claude-code-config/tree/main/plugins/python-scripting/skills/python-simple-scripts
Command: npx skills add https://github.com/cjthompson/claude-code-config --skill python-simple-scripts-cjthompson

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Agents often write quick Python helpers during coding sessions that hang indefinitely, mishandle shell quoting, corrupt inputs, or silently produce wrong answers. This Skill enforces rules for writing small, trustworthy one-off Python scripts without turning them into full projects. ## Core Features & Use Cases - Helper vs. deliverable distinction: Keeps incidental helpers minimal (standard library only, no pyproject.toml, no virtualenv) while routing repository deliverables to full Python development standards. - Safe shell boundary crossing: Governs python3 -c usage, quoted heredocs, temporary .py files, and passing dynamic data via arguments or stdin instead of string splicing. - Bounded waits and trustworthy output: Requires timeouts for subprocesses, network calls, and async operations, plus input validation, explicit encodings, and tempfile usage instead of predictable /tmp paths. - Use Case: While debugging, you ask the agent to summarize a large JSON log. It writes a small temporary .py helper with a timeout, validated parsing, and stderr progress, runs it, and cleans up without leaving caches or project files. ## Quick Start Write a small one-off Python helper to parse this CSV export and summarize the totals, following the simple Python scripts rules.

Frequently Asked Questions about python-simple-scripts

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write a safe one-off Python script in a coding session?

Use a small temporary .py file with focused functions, a main() entry point, and an explicit exit status. Stick to the standard library, avoid creating pyproject.toml or virtualenvs, and run it with python3 -B to keep caches out of the working tree.

When should I use python3 -c versus a temporary .py file?

Use python3 -c only for a short expression with obvious shell quoting. Switch to a temporary .py file for multiline logic, structured data, nontrivial error handling, or anything worth rerunning, since compressing logic into -c invites quoting bugs.

Why is argparse type=bool wrong for CLI flags?

argparse applies the converter to text, and every nonempty string is truthy, so bool("False") returns True. Use action="store_true", action="store_false", or argparse.BooleanOptionalAction instead for correct flag behavior.

How do I prevent a Python subprocess call from hanging forever?

Pass a meaningful timeout to subprocess.run() and handle subprocess.TimeoutExpired. With Popen and pipes, use communicate(timeout=...) rather than wait(), and on timeout terminate or kill the child, then call communicate() again to drain pipes and reap it.

Why should scripts avoid assert for input validation?

Python removes assert statements when run with -O or PYTHONOPTIMIZE, so validation based solely on assert silently disappears under optimization. Use explicit conditionals with deliberate exceptions, stderr messages, or nonzero exit codes for behavior-affecting checks.

When does a one-off script become a repository deliverable?

A script becomes a deliverable when the user requests it as a retained repository artifact. Then it should follow the repository's declared Python version and toolchain, and full Python development standards apply instead of the incidental-helper rules.