From workflow
Sweep a codebase for AI-accumulated cruft (dead code, stale comments, compatibility shims, defensive bloat, over-abstraction), triage findings by confidence tier, then orchestrate parallel cleanup agents with worktree isolation. Use when user says "clean cruft", "dead code", "unused code", "stale comments", or "AI leftovers".
How this skill is triggered — by the user, by Claude, or both
Slash command
/workflow:cruft-cleaneropusThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
You systematically find and remove AI-accumulated cruft from codebases. AI agents leave a
You systematically find and remove AI-accumulated cruft from codebases. AI agents leave a distinct debris trail: unused compatibility shims, comments describing deleted code, defensive error handling for impossible cases, single-use abstractions nobody asked for. You find it all, confirm with the user, then orchestrate cleanup at scale.
src/api/): scope the sweep to that directoryDiscover what's in this codebase, then hunt for cruft across five categories.
Identify the project's language(s), framework, build tools, and test runner by examining:
package.json, tsconfig.json, Cargo.toml, go.mod, pyproject.toml, Makefile, etc.This determines which language-aware tools are available. Store findings for Phase 3.
Load references/detection-patterns.md and run every applicable tool for the detected ecosystem. These produce high-confidence findings:
tsc --noUnusedLocals --noUnusedParameters --noEmit, eslint unused rulesruff check --select F811,F841,F401, vulturego vet, deadcode#[warn(dead_code)])Capture output, parse into a structured findings list.
Use Grep and Read to find pattern-based cruft. Load references/cruft-taxonomy.md for concrete examples of what to look for. These produce medium and low-confidence findings:
Medium confidence:
_ that were clearly renamed to suppress warningsLow confidence:
Assign each finding a confidence tier:
Deduplicate findings that appear in multiple detection passes.
Present findings to the user grouped by tier with counts per category.
AskUserQuestion checkpoint:
Show a summary like:
High confidence (auto-approved): 23 findings
- 12 unused imports
- 6 unused functions
- 5 unused exports
Medium confidence (review recommended): 15 findings
- 8 stale comments
- 4 compatibility shims
- 3 passthrough wrappers
Low confidence (opt-in): 7 findings
- 3 defensive try/catch
- 2 single-use helpers
- 2 unnecessary validation
Ask which tiers to include:
If the user picks "individually", present each medium/low finding for yes/no.
Based on approved findings count and distribution, decide the execution strategy. Load references/agent-orchestration.md.
| Approved findings | Files affected | Strategy |
|---|---|---|
| < 10 | < 5 | Single inline pass (no agents, just edit directly) |
| 10-30 | 5-15 | 1-2 agents, no worktrees |
| 30-80 | 15-40 | 2-4 agents, worktrees recommended |
| 80+ | 40+ | 4-6 agents, worktrees required |
When using multiple agents, partition by directory (not by cruft category), so each agent owns a clean set of files with minimal merge conflicts. Each agent gets:
AskUserQuestion checkpoint:
Present the execution plan:
Options: Execute / Adjust / Cancel
If the plan calls for inline editing, just do it directly:
Spawn cleanup agents using the Agent tool:
For each partition:
Agent(
description: "Clean cruft in {partition_name}",
prompt: <partition findings + cleanup instructions>,
isolation: "worktree" // if plan calls for worktrees
)
Each agent's prompt includes:
Launch agents in parallel where possible. Track each with TaskCreate/TaskUpdate.
After all agents complete (or inline editing is done):
npm test, pytest, go test ./..., cargo test)tsc --noEmit, mypy, pyright)AskUserQuestion checkpoint:
If tests pass: "Cleanup complete. N files changed, M lines removed. Keep all changes?"
If tests fail: "Tests failed after cleanup. What do you want to do?"
npx claudepluginhub nklisch/skills --plugin workflowRemoves AI-generated code artifacts like debug logs, placeholders, TODOs, and dead code via three-phase certainty-graded cleanup. Use after AI sessions or before PRs on JS/TS, Python, Rust files.
Detects and auto-fixes AI slop in code (debug leftovers, placeholders, hardcoded credentials) using a three-phase certainty scan, safely applying only deterministic HIGH fixes and verifying with tests.
Detects dead code, fallbacks, deprecated patterns in repos using scanner, git historian, and verifier agents. Verifies safe removal for cleanup, tech debt visualization, pre-release audits.