From essentials
Dispatches parallel subagents to audit and fix code quality issues across the entire codebase: deduplication, dead code removal, circular dependencies, weak types, and more. Use for full repo deep clean.
How this skill is triggered — by the user, by Claude, or both
Slash command
/essentials:codebase-sweepThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Dispatch up to 8 subagents to audit and clean the codebase. Each subagent must:
Dispatch up to 8 subagents to audit and clean the codebase. Each subagent must: (1) research its domain, (2) write a critical assessment with findings, (3) implement all high-confidence fixes.
cleanup/<YYYY-MM-DD>.node_modules, dist, vendor, lock files, and any paths listed in .gitignore.Each subagent is spawned using the Agent tool with mode: "auto". Give each subagent a clear prompt including: the task description below, the project root path, detected language(s), and a reminder to commit its own changes with the prefix cleanup(<task>):.
| # | Subagent | Applies to | Description |
|---|---|---|---|
| 1 | Deduplication | All languages | Find duplicated logic across the codebase. Apply DRY only where it reduces complexity; do not abstract three similar lines into a helper. |
| 2 | Type consolidation | JS/TS, Java, C#, Go (typed languages) | Find all type/interface definitions. Merge duplicates into shared locations. Update imports. |
| 3 | Dead code removal | All languages | JS/TS: use knip to find unused exports, files, and dependencies. Other languages: use grep-based analysis to find unreferenced exports and files. Verify each removal with grep across the full repo before deleting. |
| 4 | Circular dependency resolution | All languages | JS/TS: use madge --circular to identify cycles. Other languages: trace import graphs with grep/find. Refactor to break cycles; do not paper over with lazy imports. |
| 5 | Weak type elimination | JS/TS (primary), Python (type hints) | Replace any, unknown (TS) or missing type annotations (Python) with concrete types. Research correct types from call sites and upstream packages. No casts to suppress errors. |
| 6 | Defensive code pruning | All languages | Remove try/catch blocks that hide errors or return silent fallbacks. Keep only those guarding genuinely untrusted input (user input, external APIs, filesystem boundaries). |
| 7 | Deprecated/legacy removal | All languages | Find code marked deprecated, behind always-on feature flags, or labeled legacy. Remove the dead path; keep one canonical implementation. |
| 8 | AI slop removal | All languages | Strip stubs, placeholder code, in-motion-work comments ("now replacing X with Y"), and over-commenting. Replace only where a new contributor genuinely needs the context. |
Skip subagents that don't apply to the detected language. For a Python-only project, skip subagent 4 (madge) unless circular imports are suspected, and scope subagent 2 to dataclass/TypedDict consolidation.
Run in two phases because dead-code removal and circular-dep work produce better results after dedup and type consolidation have landed.
Phase 1 (parallel): 1, 2, 5, 6, 7, 8 Phase 2 (parallel, after Phase 1 commits): 3, 4
cleanup(<task>): <summary>).--no-verify) or force-push.git log --format='%H' --since='3 months ago' -- <path> to prioritize high-churn areas.After all subagents complete, produce a single summary with:
npx claudepluginhub nicknisi/claude-plugins --plugin essentialsStrict whole-codebase maintainability audit checking file sprawl, thin wrappers, leaked logic, and dependency freshness. Pushes structural simplification and code removal.
Audits codebases to remove dead code, AI slop, and DRY/SOLID violations, restructuring toward simplest correct implementation. Detects stack and applies idiomatic patterns.
Detects dead code, unused exports, orphaned files, circular dependencies, unused packages, stale TODOs, and hygiene issues across 11 categories. Use scan, safe, aggressive modes on full codebase or paths.