prune-cruft
Installation
SKILL.md
Prune Cruft
Cut code that does not earn its keep. Default is the simplest code that solves the problem; anything more must justify itself with a real, current reason.
Glossary
- Cruft — code present without a current reason: unused, redundant, defensive past the point of need, or optimized for a non-problem.
- Earned its keep — has a real, current caller; a measured perf win; or a documented invariant. Hypothetical futures do not count.
- Load-bearing — removing it breaks something a real caller depends on today.
- Deletion test — imagine deleting it; if complexity vanishes it was a pass-through, if complexity reappears across callers it earned its keep.
Categories
Each category has a detail file with heuristics and do/don't examples. Read the relevant file before classifying a finding. Examples lean on TypeScript/React because that is where this cruft is most epidemic, but every category applies to any language.
- Unnecessary memoization — a memo or cache (
useMemo/useCallback/React.memo, Vuecomputed, alru_cache, a hand-rolledMap) without a real referential-stability or measured perf reason. See MEMOIZATION.md. - Redundant type checks — runtime guards the type system already proves, double null checks, defensive
?.on non-nullable values, casts restating inference, double validation of already-validated data. See TYPE-NARROWING.md. - Dead / unused code — exports, files, branches, params, flags, translation keys, enum members with no current consumer. See DEAD-CODE.md.
- Over-engineering — premature abstraction, single-implementation interfaces, factories of one, wrapper functions, options no caller flips, ports without a second adapter, unmeasured micro-optimizations. See OVER-ENGINEERING.md.