refactor-clean
Safely identify and remove dead code with verification after each change.
- Kind
- Prompt
- Works with
- Claude Code, Codex
- Source
- affaan-m/ECC @ d3b8a3e90890
- Path
- commands/refactor-clean.md
- Jobs
- Implementation, Guardrails
- Topics
- Refactoring
Credit
- Made by
- affaan-m
- Original
- github.com/affaan-m/ECC/blob/d3b8a3e908904e242ed2dbe66af62cca…
- License
- MIT
Listed by Skill Manifest; not made by us.
InstallCopy it from the source repository, or sign in and let the assistant adapt it for your project.
Install factsScanned 3 Nov 2026
- Adds
- .claude/commands/refactor-clean.md (run as /refactor-clean)
- Runs scripts
- None found
- Uses the network
- None found
- Needs secrets
- None found
- Source revision
- d3b8a3e90890
- Licence
- MIT
- Last activity
- 23 Nov 2026
- Source changed after the scan
- Yes
- Last push 23 Nov 2026, scanned 3 Nov 2026; read it again before you rely on this scan
- Review
- Reviewed
Found by a static scan of the stored text; nothing is run. “None found” is not a guarantee, so read what you install before you run it.
# Refactor Clean Safely identify and remove dead code with test verification at every step. ## Step 1: Detect Dead Code Run analysis tools based on project type: | Tool | What It Finds | Command | |------|--------------|---------| | knip | Unused exports, files, dependencies | `npx knip` | | depcheck | Unused npm dependencies | `npx depcheck` | | ts-prune | Unused TypeScript exports | `npx ts-prune` | | vulture | Unused Python code | `vulture src/` | | deadcode | Unused Go code | `deadcode ./...` | | cargo-udeps | Unused Rust dependencies | `cargo +nightly udeps` | If no tool is available, use Grep to find exports with zero imports: ``` # Find exports, then check if they're imported anywhere ``` ## Step 2: Categorize Findings Sort findings into safety tiers: | Tier | Examples | Action | |------|----------|--------| | **SAFE** | Unused utilities, test helpers, internal functions | Delete with confidence | | **CAUTION** | Components, API routes, middleware | Verify no dynamic imports or external consumers | | **DANGER** | Config files, entry points, type definitions | Investigate before touching | ## Step 3: Safe Deletion Loop For each SAFE item: …