/python-scripting:python-simple-scriptsfrom python-scripting
Use before any Bash command that invokes Python, including Bash(python3 ...), Bash(python ...), python3 -c, python -c, Python heredocs, and temporary .py helper files. Also use whenever an agent creates a one-off Python script to inspect, transform, validate, or summarize data during a coding session, even when the user did not ask for Python or for a script.
Ships in python-scripting. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Write the smallest trustworthy helper for the immediate task.
Loading this skill does not mean every Python invocation needs new code. If the command only runs an existing script, module, test suite, or configured project tool, preserve that command and do not manufacture a helper. Apply the rules below when composing Python for the task.
For an incidental helper used by the agent during a coding session:
pyproject.toml, a package layout, a lockfile, a virtual
environment, or project configuration.python3 -B helper.py when bytecode
is unnecessary.For a script requested as a repository deliverable, stop treating it as an
incidental helper. Use applicable skills from python-development when
available; otherwise use applicable skills from python-scripting. Follow the
repository's declared Python version and toolchain. If no supported version is
declared, ask and offer Python 3.14 as the default.
For Apple's /usr/bin/python3 or a zero-setup macOS utility, also use
macos-python-scripting and follow its Python 3.9 constraints.
python3 -c only for a short expression whose shell quoting is obvious..py file for multiline logic, structured data,
nontrivial error handling, or anything worth rerunning.For a multiline helper, normally use focused functions, complete function
signatures, a main() entry point, and an explicit exit status. Let inference
handle obvious local values rather than annotating every literal.
.py file once code is multiline or contains nested
quoting. Do not compress substantial logic into python3 -c.<<'PY' so Bash does not expand $, backticks, or backslashes inside the
Python source.subprocess.run(..., check=True); avoid shell=True and add a timeout when a
child can hang.Do not add arbitrary timeouts to bounded local computation or ordinary file processing. When completion depends on external progress, synchronization, or input that may never arrive, the wait is potentially unbounded and MUST have a finite timeout, deadline, attempt limit, or work-item bound.
subprocess.run() calls a meaningful timeout=
and handle subprocess.TimeoutExpired. When using Popen with pipes, use
communicate(timeout=...) rather than wait(). On timeout, terminate the
child, then kill it if necessary, and call communicate() again to drain its
pipes and reap it.asyncio.timeout() on Python 3.11+ or asyncio.wait_for() when the
supported interpreter requires it. After an async subprocess times out,
terminate or kill it and await its cleanup.finally, and return
nonzero. Let asyncio.CancelledError propagate after cleanup; never swallow
it with a broad handler.input() or wait on an interactive stdin in a noninteractive
agent run. If stdin is required, ensure it is intentionally piped or fail
clearly when it is a terminal.flush=True.
Progress output is not a substitute for a timeout or other bound.bool is an int subclass when validating true integers.action="store_true", action="store_false", or
BooleanOptionalAction; do not use type=bool, because nonempty text such as
"False" converts to true.Any, cast(), and ignores when straightforward narrowing suffices.newline="", and reject an empty
input glob when the task expects files.tempfile for temporary data created by Python; never invent a shared
predictable /tmp filename or use tempfile.mktemp().Use python-typing when the helper has nontrivial validated data shapes. Use
python-quality-tools only when the user requests formatting, linting, or type
checking for a standalone file with no governing repository toolchain. For a
retained repository deliverable with configured quality tools, use
python-development:python-project-tooling when it is available.
Run the helper on the real input and inspect the result. Add one focused edge or malformed-input probe when a silent wrong answer is plausible. Do not create a separate test suite or bootstrap quality tools for an incidental helper.
Do not use assert as the sole runtime validation or verification mechanism;
optimized Python can disable assertions. Confirm subprocess exit codes and the
helper's own nonzero failure path. When the helper contains a potentially
unbounded operation, exercise its timeout or limit with a short deterministic
probe.
Before finishing, confirm that the helper did not modify its inputs, create project metadata, install dependencies, or leave caches in the working tree.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub cjthompson/claude-code-config --plugin python-scripting4 skills in this plugin
/macos-python-scriptingUse when writing zero-setup macOS utilities for Apple's /usr/bin/python3, Command Line Tools Python 3.9, standard-library-only execution, or integration with stable macOS command-line programs./python-quality-toolsUse when formatting, linting, or type-checking standalone Python files that are not governed by a repository toolchain. Do not use for pyproject.toml or repository-level tooling work./python-typingUse when writing or editing typed Python scripts, parsing untyped input, choosing lightweight data shapes, or resolving common checker errors without project-scale type-system research.Other plugins' skills for the same job