python-refactor-auditlisted
Install: claude install-skill TheodoreAD/agent-skills
# Auditing and restructuring a Python module that grew
A procedure for the pass nothing else does: a module built incrementally, never reviewed as a whole,
where the problem is not any single line but a shape repeated across the file. Every diff-scoped
reviewer — a code-review command, a simplifier agent, a PR bot — is scoped to recent changes by
design, and whole-module state threading is precisely what no diff contains.
This skill is about **how the pass is run**, which matters more than the target shape. What the
resulting code should look like is `python-conventions`; what a test should cover is
`python-testing-conventions`. The loop, the oracle rules and the stopping rule below are
language-neutral; the examples are Python.
The worked example every rule here comes from is in [`references/pilot.md`](references/pilot.md) — a
3,476-line single-file script restructured in nine commits on 2026-09-01, with its before/after
counts, the two counts that did not reproduce, and the things that went wrong.
[`references/prior-art.md`](references/prior-art.md) is what was surveyed and what was deliberately
not taken.
## What this skill reads, runs and writes
- **Reads**: the module you point `scripts/count_shapes.py` and `scripts/find_mutations.py` at.
- **Runs**: nothing.
- **Writes**: nothing. The commits the loop below produces are yours, in your repo, one at a time.
- **Network**: none.
## First decide whether to restructure at all
**Four stopping conditions. Any one of the