| name | cleanup-code |
| description | Comprehensive codebase cleanup across 11 quality dimensions: dead code, duplication,
weak types, circular deps, defensive cruft, legacy code, AI slop, type consolidation,
security, performance, and async patterns. Analyzes code with confidence scoring and
verifies changes with build/test gates. Use when codebase has accumulated tech debt,
after major feature work, before releases, or when code quality metrics are declining.
Trigger with "/cleanup-code-code", "clean up the codebase", "remove dead code", "fix code quality".
|
| allowed-tools | Read, Write, Edit, Glob, Grep, Bash(git:*), Bash(npm:*), Bash(npx:*), Bash(pnpm:*), Bash(python3:*), Bash(tsc:*), Bash(wc:*), Bash(ls:*), AskUserQuestion |
| version | 1.7.0 |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| license | MIT |
| tags | ["code-quality","cleanup","refactoring","dead-code","deduplication","type-safety","security"] |
| argument-hint | [scope] [--dimensions d1,d2,...] [--changed] |
| compatibility | Designed for Claude Code, also compatible with Codex and OpenClaw |
Codebase Cleanup
Systematic code cleanup across 11 quality dimensions, ordered by risk. Each finding includes
confidence scoring (HIGH/MEDIUM/LOW) and all changes are verified through build/test gates.
Environment Detection
!git rev-parse --show-toplevel 2>/dev/null && echo "---" && git diff --stat HEAD~5 2>/dev/null | tail -5
!ls package.json pyproject.toml Cargo.toml go.mod Makefile 2>/dev/null | head -5
!cat package.json 2>/dev/null | head -3; echo "---"; ls tsconfig.json .eslintrc* 2>/dev/null
Prerequisites
- Git repository with clean working tree (no uncommitted changes)
- Language toolchain installed (Node.js/Python/Go/Rust as applicable)
- Optional:
knip, madge, jscpd, ruff, bandit for tool-verified scanning
Overview
This skill orchestrates cleanup across 11 dimensions, each with a dedicated agent.
Dimensions are ordered LOW → HIGH risk. See dimensions reference
for full detection criteria, verification steps, and risk profiles.
The 11 Dimensions (by risk level):
| # | Dimension | Key | Risk | Auto-apply? |
|---|
| 1 | Dead code removal | dead | LOW | Yes (after build) |
| 2 | AI slop removal | slop | LOW | Comments only |
| 3 | Weak type elimination | types | MED | Yes (after typecheck) |
| 4 | Security cleanup | security | MED | Flag only |
| 5 | Legacy code removal | legacy | MED | With confirmation |
| 6 | Type consolidation | typecons | MED | Yes (after typecheck) |
| 7 | Defensive code cleanup | defensive | MED | Flag only |