|
| 1 | +--- |
| 2 | +name: cleanup-audit |
| 3 | +description: Whole-repo audit for over-engineering and accidental complexity. Scans the entire codebase (not just a diff) and returns a ranked, read-only list of what to delete, simplify, or replace with standard-library or platform equivalents. Use when the user asks to "audit the codebase", "find bloat", "what can I delete", or wants a repo-wide simplification pass. For a diff-scoped pass use `pythinker review diff --mode deslopify` instead. One-shot report; applies no fixes. |
| 4 | +--- |
| 5 | + |
| 6 | +# Cleanup Audit |
| 7 | + |
| 8 | +A read-only, whole-repo pass that hunts accidental complexity and over-engineering. The diff-scoped |
| 9 | +version of this job already ships as `pythinker review diff --mode deslopify`; this skill is its |
| 10 | +repo-wide complement — scan the whole tree, rank the biggest cut first. |
| 11 | + |
| 12 | +Scope is complexity only. Correctness bugs, security holes, and performance belong to a normal |
| 13 | +review or security pass — note them in one line if you trip over them, but do not chase them here. |
| 14 | + |
| 15 | +## What to hunt |
| 16 | + |
| 17 | +- Dead code, unused flexibility, and speculative features no caller needs. |
| 18 | +- Hand-rolled logic the standard library already ships — name the function that replaces it. |
| 19 | +- A dependency (or hand-written code) doing what the language, runtime, or framework already does. |
| 20 | +- Single-implementation interfaces, one-product factories, wrappers that only delegate, a module |
| 21 | + that exports one trivial thing, dead flags and config nobody sets. |
| 22 | +- The same logic spelled out long-hand where a shorter, equally clear form exists. |
| 23 | + |
| 24 | +## How to work |
| 25 | + |
| 26 | +1. Map before judging: read the tree, the manifest/lockfile, and entry points; use `Grep`/`Glob` |
| 27 | + (or `LSP` for references and call hierarchy) to confirm a thing is actually unused before |
| 28 | + proposing its deletion. A deletion proposed without checking callers is a guess. |
| 29 | +2. Rank findings biggest cut first. |
| 30 | +3. Apply nothing. This is a report. |
| 31 | + |
| 32 | +## Output |
| 33 | + |
| 34 | +One line per finding, ranked, each tagged and citing a path: |
| 35 | + |
| 36 | +- `delete:` — dead code / speculative feature. Replacement: nothing. |
| 37 | +- `stdlib:` — hand-rolled thing the standard library ships. Name the function. |
| 38 | +- `native:` — dependency or code doing what the platform/framework already does. Name the feature. |
| 39 | +- `yagni:` — abstraction with one implementation, config nobody sets, layer with one caller. |
| 40 | +- `shrink:` — same logic, fewer lines. Show the shorter form. |
| 41 | + |
| 42 | +Format: `<tag> <what to cut>. <replacement>. [path:line]` |
| 43 | +End with an estimate: `net: ~-<N> lines, -<M> deps possible.` Nothing to cut: `Lean already.` |
| 44 | + |
| 45 | +## Guardrails |
| 46 | + |
| 47 | +Never propose cutting trust-boundary validation, error handling that prevents data loss, security |
| 48 | +measures, or accessibility — minimal is not the same as unsafe. When a "simplification" would touch |
| 49 | +one of those, leave it and say why. Verify each deletion candidate is truly unreferenced before |
| 50 | +listing it; an audit that proposes deleting live code is worse than no audit. |
0 commit comments