skills/clean-rx/SKILL.md
Codebase garbage collector — finds dead code, unused deps, orphan files, stale configs, and tech debt across Python, Next.js, and Supabase projects. Produces a prioritized cleanup plan with safe removal steps. Use when the user says "cleanup", "run clean-rx", "find dead code", "remove unused", "tech debt audit", "garbage collect", "what can I delete", "lixo", or "clean project". Leverages LSP, madge, depcheck, and knip for deep dead code detection.
npx skillsauth add acardozzo/rx-suite clean-rxInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Recommended: knip, depcheck, madge, vulture, ruff
Check all dependencies: bash scripts/rx-deps.sh or bash scripts/rx-deps.sh --install
Evaluate codebase waste using 10 weighted dimensions and 40 sub-metrics with exact, reproducible thresholds. Every finding traces to a file, line, or config entry.
Announce at start: "I'm using the clean-rx skill to scan [target] across 10 dimensions and 40 sub-metrics."
Accepts one argument: a project path, a directory, or all.
/clean-rx .
/clean-rx src/
/clean-rx all
When all: scan the entire project root, detecting all stacks present.
| # | Dimension | Weight | What It Measures |
|---|-----------|--------|------------------|
| D1 | Dead Code & Unreachable | 15% | Unused exports, dead functions, unreachable code, commented-out code |
| D2 | Unused Dependencies | 12% | Phantom deps, dev/prod misplacement, duplicates, deprecated pkgs |
| D3 | Orphan Files & Assets | 10% | Unreferenced source files, orphan tests, unused assets, stale artifacts |
| D4 | Stale Configuration | 10% | Unused env vars, stale configs, dead scripts, dead CI steps |
| D5 | Type & Lint Debt | 10% | any types, disabled lint rules, missing annotations, TODO/FIXME |
| D6 | Import Hygiene | 10% | Circular imports, unused imports, wildcard imports, deep relative paths |
| D7 | Supabase Waste | 8% | Unused tables, orphan migrations, dead RLS, unused storage buckets |
| D8 | Next.js / Frontend Waste | 8% | Unused pages/routes, dead components, dead CSS, unused API routes |
| D9 | Python Waste | 8% | Unused Python imports, dead functions, unused vars, empty init.py |
| D10 | Git & Repository Hygiene | 9% | Large files, secrets in history, .gitignore gaps, stale branches |
Stack-conditional dimensions: D7 (Supabase), D8 (Next.js), D9 (Python) score as N/A (100) if the respective stack is not detected. Their weight redistributes proportionally.
Full metric tables and thresholds: read references/grading-framework.md. Cleanup output format: read references/output-templates.md. Stack-specific guides: read references/stack-guides.md.
# Run the discovery orchestrator
bash scripts/discover.sh /path/to/project
The orchestrator auto-detects:
Run all 10 dimension scripts. Each produces structured findings with file paths and line numbers.
// function, // const, # def, # class patternsany type count — as any, : any, @ts-ignore, @ts-expect-errorimport * patterns../ depth > 3After collecting raw findings, dispatch 5 parallel agents to score the 10 dimensions:
Agent 1 — D1 + D2 (Dead Code + Unused Deps): Receives finding counts for unused exports, dead functions, unreachable code, phantom deps, duplicates. Reads grading framework. Returns scored sub-metrics.
Agent 2 — D3 + D4 (Orphan Files + Stale Config): Receives orphan file list, unused env vars, stale configs, dead CI steps. Reads grading framework. Returns scored sub-metrics.
Agent 3 — D5 + D6 (Type Debt + Import Hygiene):
Receives any counts, disabled rules, circular imports, unused imports. Reads grading framework. Returns scored sub-metrics.
Agent 4 — D7 + D8 + D9 (Stack-Specific Waste): Receives Supabase/Next.js/Python waste findings. Marks N/A for absent stacks. Reads grading framework. Returns scored sub-metrics.
Agent 5 — D10 (Git Hygiene): Receives large file list, secret patterns, gitignore gaps, stale branches. Reads grading framework. Returns scored sub-metrics.
Overall = (D1 * 0.15) + (D2 * 0.12) + (D3 * 0.10) + (D4 * 0.10)
+ (D5 * 0.10) + (D6 * 0.10) + (D7 * 0.08) + (D8 * 0.08)
+ (D9 * 0.08) + (D10 * 0.09)
When a stack-specific dimension is N/A, redistribute its weight proportionally among active dimensions.
Map to letter grade:
| Grade | Score Range | |-------|------------| | A+ | 97-100 | | A | 93-96 | | A- | 90-92 | | B+ | 87-89 | | B | 83-86 | | B- | 80-82 | | C+ | 77-79 | | C | 73-76 | | C- | 70-72 | | D+ | 67-69 | | D | 63-66 | | D- | 60-62 | | F | 0-59 |
The primary output is a tiered safe deletion list — see references/output-templates.md for format.
Save report to: docs/audits/YYYY-MM-DD-clean-rx.md
The discovery scripts auto-detect and use these tools when available:
| Tool | What it finds | Stack | Install |
|---|---|---|---|
| knip | Unused exports, files, deps, types | Next.js/TS | npm i -g knip |
| depcheck | Unused npm dependencies | Next.js/TS | npm i -g depcheck |
| madge | Circular imports, orphan files | Next.js/TS | npm i -g madge |
| vulture | Dead Python code | Python | pip install vulture |
| pip-autoremove | Unused Python packages | Python | pip install pip-autoremove |
| ruff | Unused imports, lint issues | Python | pip install ruff |
| LSP (pyright/vtsls) | Type errors, unused symbols | Both | Already installed |
After generating the report and saving to docs/audits/:
docs/rx-plans/clean-rx/{date}-report.mdrx-plan skill to create or update the improvement plan at docs/rx-plans/clean-rx/{dimension}/v{N}-{date}-plan.mddocs/rx-plans/clean-rx/summary.md with current scoresdocs/rx-plans/dashboard.md with overall progressThis happens automatically — the user does not need to run /rx-plan separately.
development
Prescriptive UX/UI evaluation producing scored opportunity maps for Next.js + shadcn/ui projects. Evaluates user experience against Nielsen Heuristics, WCAG 2.2, Core Web Vitals, Laws of UX, and Atomic Design. Use when: auditing UX quality, evaluating accessibility, reviewing component usage, identifying missing shadcn components, improving form UX, or when the user says "ux audit", "run ux-rx", "evaluate UX", "accessibility check", "improve user experience", "shadcn review", "how to reach A+ UX", or "UX opportunities". Measures 11 dimensions (44 sub-metrics). Fixed stack: Next.js App Router + shadcn/ui + Tailwind CSS. Leverages shadcn registry to recommend ready-to-use components. Outputs per-page scorecards with before/after Mermaid diagrams.
development
Evaluates testing strategy and completeness across 8 dimensions (32 sub-metrics): test pyramid balance, test effectiveness, contract/API testing, UI/visual testing, performance/load testing, test data management, CI integration, and test organization. Produces a scored diagnostic with actionable improvement plans.
development
Code-level security posture evaluation. Scans for OWASP Top 10 vulnerabilities, authentication flaws, injection vectors, authorization gaps, and data protection issues. Complements arch-rx D9 (architectural security) by inspecting actual source code patterns, dependencies, and security configurations. Produces a scored report across 8 dimensions with 32 sub-metrics mapped to OWASP ASVS and CWE references.
testing
Generates versioned improvement plans from rx report results. Creates one plan per dimension that scores below A+ (97). Plans are saved to docs/rx-plans/{domain}/{dimension}/v{N}-{date}-plan.md. Use after running any rx skill, or when the user says "create plan from report", "rx plan", "plan improvements", "generate improvement plan", "what should I fix first", "create roadmap", "improvement plan", "plan from audit", or "next steps from rx".