codebase-rehab
Antislop Codebase
Use this skill to move a repo from "works but hurts" to a product-shaped cluster of small, typed, tested, maintainable modules while keeping the current product essentially as-is. Treat this as the first maintainability/productization pass, not the broader production-readiness program.
Boundary
This skill is for structural maintainability: code organization, typed boundaries, tests, feature folders, API consolidation, file-size reduction, styling cleanup, and audit evidence.
Do not expand the scope into a full production-readiness initiative. Observability/logging programs, security reviews, compliance, incident response, SLOs, runbooks, secrets posture, penetration testing, and deep reliability engineering belong in separate follow-on skills unless the user explicitly asks to include a small enabling change.
Operating Principles
- Preserve behavior first. Improve architecture in thin, reversible slices.
- Ground every decision in repo facts: file sizes, dependency graph, tests, runtime shape, API surfaces, user workflows, deployment limits, and current dirty worktree.
- Keep files AI-editable: prefer focused modules under roughly 300-500 lines, explicit feature folders, stable compatibility barrels, and narrow tests.
- Never rewrite active user-owned areas without permission. If other agents/users are editing a surface, audit or work around it.
- Use concurrent subagents for independent analysis or isolated edit slices when available, but merge with one owner who validates the whole tree.
- Commit at green checkpoints. Do not let a migration become a giant unreviewable diff.
- End with evidence: a migration audit microsite served locally, with visuals, metrics, risks, and before/after interpretation.