From ai-everything
Remove dead code, deprecated branches, unused functions, and redundant logic within a scoped codebase area. Evidence-first cleanup with user confirmation before deletion. Use when user wants to clean code, remove deprecated paths, delete unused exports, deduplicate logic, prune feature flags, simplify conditionals, or invoke clean-helper. Triggers: 'clean', 'clean-helper', 'dead code', 'remove deprecated', 'unused function', 'redundant logic', 'prune', 'remove legacy', 'delete unused', 'cleanup', '清理代码', '删除废弃', '移除冗余', '无用代码', '废弃分支', '精简逻辑', 'dead branch', 'unreachable code'.
How this skill is triggered — by the user, by Claude, or both
Slash command
/ai-everything:clean-helperThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
IRON LAW: **Remove only code you can prove is dead, superseded, or explicitly approved by the user** — within the resolved scope. Never delete based on a comment alone; never mix behavior changes or unrelated refactors into a cleanup pass.
IRON LAW: Remove only code you can prove is dead, superseded, or explicitly approved by the user — within the resolved scope. Never delete based on a comment alone; never mix behavior changes or unrelated refactors into a cleanup pass.
Copy this checklist and track progress:
Clean Helper Progress:
- [ ] Step 0: Scope ⛔ BLOCKING
- [ ] Load references/scope-and-targets.md
- [ ] Resolve files/modules from user input + optional staging/diff
- [ ] Step 1: Inventory ⚠️ REQUIRED
- [ ] Load references/dead-code-discovery.md
- [ ] List candidates with evidence (call graph, references, flags)
- [ ] Step 2: Redundancy pass
- [ ] Load references/redundancy-patterns.md
- [ ] Mark merge/simplify opportunities separate from deletions
- [ ] Step 3: Confirm ⚠️ REQUIRED
- [ ] Present removal/simplify plan; wait for user approval
- [ ] Step 4: Apply cleanup
- [ ] Delete/simplify only approved items
- [ ] Step 5: Verify ⚠️ REQUIRED
- [ ] Load references/verification.md
- [ ] Run scoped check/test; fix breakages from removals
- [ ] Step 6: Self-check ⚠️ REQUIRED
Control flow
Load references/scope-and-targets.md.
| User input | Cleanup scope |
|---|---|
| Directory path | That tree only (imports may be traced outward read-only) |
| File path | That file + direct dependents in scope |
{{input}} empty | Staged + unstaged diff files, or ask for path |
all / whole repo | Ask to confirm — prefer module-by-module |
Ask one clarifying question if scope is ambiguous and would touch >30 files.
Load references/dead-code-discovery.md.
For each candidate, record in a short table:
| Item | Kind | Evidence | Risk |
|---|
Kinds: unused-export, unreferenced-fn, dead-branch, deprecated-api, stale-flag, duplicate-block.
Questions to answer before marking dead:
Skip items with weak evidence — list under “needs user input” instead of Step 4.
Save the inventory table to .review/clean-{timestamp}.md (timestamp filename).
Load references/redundancy-patterns.md.
Separate deletions from simplifications (merge helpers, collapse duplicate conditionals). Simplifications still need Step 3 approval if they change control flow.
Present to the user (Chinese summary OK):
Ask:
If user said “remove all deprecated” upfront, still list P0-risk items (public exports, shared libs) for explicit ack.
Update the .review/clean-{timestamp}.md copy with the final approved plan before Step 4.
Rules:
if (false) stubs.index.ts) in same pass.Load references/verification.md.
Run the narrowest command that exercises touched code. If verification fails, fix import/typing fallout from removals — do not restore dead code without user approval.
Run the pre-delivery checklist below. Confirm .review/clean-{timestamp}.md reflects what was removed or deferred.
.review/clean-{timestamp}.mdnpx claudepluginhub j-show/ai-everything --plugin ai-everythingGuides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.