/python:pythonfrom python
Audits Python code for house-style violations before commit or PR. Delegates mechanical checks to ruff and applies judgment checks for reliability, config, typing, and concurrency decisions.
Ships in python. 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; scripts run unread.
House style for Python, framed as an audit: rather than carrying a rulebook while writing code, sweep the target (a diff, file, package, or repo) for violations and report them. The audit has two tiers: mechanical checks delegated to ruff, and judgment checks no linter can express. Frontier coding agents already write reasonable Python, so the checks below are limited to the residual house preferences worth checking.
Every default below is a preferred starting point. If a default conflicts with project constraints or worsens the outcome, follow the project and state the tradeoff and compensating controls (tests, observability, migration, rollback).
writing-tests; its references/python-testing.md carries the Python specifics.python-notebooks-async.interactive-notebook-demo.code-review; this skill supplies the Python-specific lenses.python.
Skip the notice when the user asked for the skill by name or slash command; spelling and spacing need not match.
A phrase from this skill's own trigger list is not a name — naming the work is not naming the skill.uv for environments and dependencies; run checks with uv run ....#%% .py notebooks over .ipynb unless .ipynb is explicitly required.Last verified: 2026-08-18 — re-verify default-rule coverage and version notes against https://docs.astral.sh/ruff/default-rules/ and the ruff changelog.
Run under the project's own configuration first:
uv run ruff check .
uv run ruff format --check .
try/except/pass, naive datetimes, blocking calls and missing timeouts in async code, dangling asyncio.create_task references, unused async, and logging-call misuse are all machine-checked out of the box.
Never hand-audit what ruff checks; run it and quote findings by rule ID.select, follow local policy; note the gap against the house baseline only when it is material to the change under review.[tool.ruff.lint]
extend-select = [
"ANN2", # missing return types on public functions
"ASYNC", # async hygiene beyond the default subset
"DTZ", # full naive-datetime coverage
"S113", # requests calls without timeout
"T20", # stray print in library/service code
"TRY", # exception design (raise/except hygiene)
]
ignore = ["TRY003"] # long messages in raise — noisy in practice
ruff: ignore[rule-name] suppression comments; prefer those over bare noqa codes in new suppressions.scripts/: uv run pytest <path-to-this-skill>/scripts/test_uv_security_audit.py <path-to-this-skill>/scripts/test_pypi_security_audit.py -v.
Both warn (not fail) on findings; read the warnings.Sweep the target for each finding class below. These are not machine-checkable; report each finding with file:line and a concrete fix. Each item names what to look for, why it is a problem, and the house default that resolves it.
Before proposing a fix for a finding in this class, read references/design-boundaries.md for the reasoning behind these defaults and fuller guidance on fixes.
utils/common dumping grounds.
An abstraction built before the second concrete use is usually the wrong one, and a utils module is code nobody owns.
Build the minimal golden path and prefer composition.Before proposing a fix for a finding in this class, read references/design-boundaries.md for the reasoning behind these defaults and fuller guidance on fixes.
Any.
A public signature is the contract; without types, callers guess and refactors lose their safety net.
Internal helpers do not need the same rigor.Mapping, Sequence, a Protocol) so callers are not forced into one container type; return concrete types so callers know what they hold.model_validate, model_dump) in new code.time.monotonic() + budget) through nested calls instead of recomputing relative timeouts per layer.Retry-After, and keep retry logic in exactly one layer.retryable flag — with distinct terminal states for retryable and permanent outcomes.pydantic-settings), validate them at startup, and keep imports free of configuration side effects.try/finally cleanup.
An unhandled SIGTERM orphans subprocesses and half-written state; an unbounded drain turns a restart into a hung process.
Handle termination signals, stop intake, drain in-flight work within a deadline, and clean up subprocesses, temp files, and handles in try/finally.gather or submit over an unbounded collection.
Thousands of concurrent tasks starve the event loop or exhaust memory and file handles.
Bound concurrency with a semaphore or queue.Python-specific testing practice is in references/python-testing.md.
Mock() where autospec would catch signature drift.
Each of these produces a test that passes while the behavior is wrong.references/design-boundaries.md — Functional Core / Imperative Shell, module ownership, boundary contracts, pydantic placement, contract evolutionreferences/python-testing.md — Python-specific testing practices (also shared into writing-tests)scripts/run_falsegreen.py — runs the falsegreen scanner for tests that cannot fail, through uvx (also shared into writing-tests)references/multi-python-testing.md — version-matrix testing with nox + uvreferences/design-boundaries.md (opens in a new tab)references/multi-python-testing.md (opens in a new tab)references/python-testing.md (opens in a new tab)scripts/run_falsegreen.py (opens in a new tab)scripts/test_pypi_security_audit.py (opens in a new tab)scripts/test_uv_security_audit.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
npx claudepluginhub ahgraber/skills --plugin python4 skills in this plugin
/interactive-notebook-demoUse when authoring or reviewing a hands-on demo, tour, or walkthrough notebook (`#%%` percent-format or Jupyter) that demonstrates a feature, library, or API and doubles as semi-interactive documentation. Triggers: "write a demo notebook", "build a feature demo", "demo this library/API", "a notebook to walk through X", "interactive docs for this feature". Not for production/analysis notebooks or pure asyncio event-loop mechanics (see python-notebooks-async)./python-notebooks-asyncUse when writing or reviewing asyncio code in Jupyter notebooks or '#%%' cell workflows — structuring event-loop ownership, orchestrating async tasks, or choosing compatibility strategies. Also use when hitting RuntimeError: This event loop is already running, asyncio.run() failures in cells, or tasks silently never completing./writing-docstringsUse when writing, rewriting, or auditing Python docstrings that a documentation site is generated from, or when docstrings are long, narrate the code, or leave a reader of the generated reference unable to find their way. Triggers - "audit the docstrings", "docstring slop", "docstrings as documentation", "the API reference reads badly", "rewrite these docstrings".