Codebase cleanup
Multi-pass refactor / code-quality cleanup designed to be dispatched as 8 specialist subagents (one per cleanup concern), each running a research → critical-assessment → high-confidence-implementation cycle. Triggers on "clean up the codebase", "tech-debt pass", "refactor for quality", "find dead code", "remove AI slop", or any explicit request for a comprehensive quality sweep. Do NOT trigger for narrow targeted fixes ("remove this one function") or for net-new feature work.From its SKILL.md
npx -y skills add darkmatter/skills --skill codebase-cleanupAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
3.3 KB, as published. Nobody here has run it
Codebase cleanup — 8-pass refactor
Eight independent specialist passes over a codebase, each scoped to one quality concern. Designed to be run as 8 separate subagent sessions (or sequentially in one) so each pass gets a clean context window and can't be tempted to bleed into another's territory.
Every pass follows the same three-phase protocol — see reference/protocol.md. The recommended pass ordering and why is in reference/pass-ordering.md.
When to use
- "Clean up the codebase" / "do a tech-debt pass"
- "Refactor for quality before we ship"
- "Find and remove dead code / AI slop / weak types"
- Onboarding a codebase and wanting to know what's actually load-bearing
- Pre-1.0 / pre-release quality sweep
- Periodic (quarterly) hygiene runs
When NOT to use
- Narrow targeted asks ("remove this one function", "fix this one type")
- Net-new feature work
- Tight deadline / minimum-viable-fix scenarios — this is a deliberate, careful sweep
- Codebases under active heavy refactor by humans (the passes will fight in-flight work)
The 8 passes
Run in this order (rationale in reference/pass-ordering.md). Each links to the full subagent prompt:
- AI slop & stale comments →
reference/passes/01-ai-slop.mdRemove generated noise, in-motion-work comments, larp, unhelpful boilerplate. - Legacy / deprecated / fallback code →
reference/passes/02-legacy-removal.mdRemove dead branches, deprecated APIs, fallback paths that no longer fall back to anything live. - Unused code →
reference/passes/03-unused-code.mdknip-class analysis: exports/files/deps that nothing imports. - Circular dependencies →
reference/passes/04-circular-deps.mdmadge-class analysis: untangle import cycles. - Weak types →
reference/passes/05-weak-types.mdReplaceany/unknown/Object/dynamic/interface{}with real types backed by research. - Type consolidation →
reference/passes/06-type-consolidation.mdFind duplicated / near-duplicated type definitions and unify. - Defensive programming →
reference/passes/07-defensive-programming.mdRemove try/catch and null-guards that don't handle a real input boundary. - DRY / dedup →
reference/passes/08-dry.mdConsolidate duplicated logic only where it reduces complexity (not the other way).
Tools
Each pass spec lists the tooling it expects (knip, ts-unused-exports, madge, jscpd, language-specific linters, etc.). The skill ships no scripts — orchestration happens in the calling agent runtime, which already has bash/edit/grep/etc.
Reference
reference/protocol.md— the 3-phase research/assess/implement protocol every pass followsreference/pass-ordering.md— why this order, and which passes can run in parallelreference/passes/*.md— one self-contained subagent prompt per pass