Unified dead code detection, AST-based duplicate detection, and cleanup tool combining Legacy Tech Remover + Comprehensive Auditor + Architectural Cleanup with Knip, depcheck, TypeScript, Vue-specific analysis, file size/token limit detection, and AST-powered refactoring suggestions. Use for dead code, duplicates, oversized files, and architectural issues.
Comprehensive dead code detection and safe cleanup for Vue 3 + TypeScript projects.
A unified skill that merges the best of Legacy Tech Remover and Comprehensive Auditor while adding modern tooling:
# Full audit (dry-run by default)
node .claude/skills/codebase-health-auditor/scripts/orchestrator.js audit
# Execute safe removals only
node .claude/skills/codebase-health-auditor/scripts/orchestrator.js execute --safe-only
# Single detector
node .claude/skills/codebase-health-auditor/scripts/orchestrator.js detect --detector vue
# CI mode
node .claude/skills/codebase-health-auditor/scripts/orchestrator.js audit --ci
noUnusedLocals/noUnusedParameters were enabledDetects files that exceed token limits for AI editing tools like Claude Code.
Why this matters: Files over ~25,000 tokens become difficult or impossible for AI tools to edit effectively, causing truncation, context loss, and failed edits.
| Level | Tokens | ~Size | Meaning |
|---|---|---|---|
| WARNING | 15,000 | ~60KB | Getting large, monitor |
| CAUTION | 25,000 | ~100KB | Needs attention |
| CRITICAL | 35,000 | ~140KB | Urgent refactoring needed |
| BLOCKED | 50,000 | ~200KB | Blocks AI editing entirely |
# Detect oversized files
node .claude/skills/codebase-health-auditor/scripts/orchestrator.js detect --detector file-size
# Custom threshold (e.g., only 20K+ tokens)
node .claude/skills/codebase-health-auditor/scripts/orchestrator.js detect --detector file-size --min-tokens 20000
# Save report to file
node .claude/skills/codebase-health-auditor/scripts/orchestrator.js detect --detector file-size --output ./audit-reports/file-size.json
š File Size Detection Results
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
Files scanned: 156
Files over threshold: 3
By Risk Level:
š“ CRITICAL: 1 files
š” CAUTION: 2 files
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
Detailed Findings:
š“ src/views/CanvasView.vue
Tokens: 38,500 | Lines: 2,847 | Size: 154.2KB
Suggestions:
⢠š“ CRITICAL - High priority refactoring needed
⢠Extract script logic into composables (src/composables/)
⢠Split into smaller child components
⢠URGENT: Major component decomposition needed
⢠Consider: extract state to Pinia store
š” src/stores/canvas.ts
Tokens: 28,200 | Lines: 1,245 | Size: 112.8KB
Suggestions:
⢠Split store into feature-specific modules
⢠Extract actions/getters into separate files
The detector provides context-aware suggestions based on file type:
Vue Components (.vue):
TypeScript/JavaScript (.ts/.js):
Each finding is categorized by risk level:
| Category | Score | Meaning | Action |
|---|---|---|---|
| SAFE | < 20 | Zero usage, high confidence | Auto-remove OK |
| CAUTION | 20-60 | Low/uncertain usage | Manual review |
| RISKY | > 60 | Possible indirect use | Migration needed |
| Factor | Weight | Description |
|---|---|---|
| Usage Count | 30% | How many imports reference this |
| Last Modified | 15% | Git history recency |
| Test Coverage | 20% | Is the code tested? |
| Import Depth | 15% | Transitive dependency depth |
| File Type | 10% | Config files riskier than components |
| Tool Agreement | 10% | Multiple tools agree = higher confidence |
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā PHASE 1: DETECTION ā
ā - Run all detectors in parallel ā
ā - Deduplicate findings ā
ā - Tag source (knip/depcheck/vue/etc) ā
āāāāāāāāāāāāāāāāāāāāā¬āāāāāāāāāāāāāāāāāāāāāā
ā¼
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā PHASE 2: ASSESSMENT ā
ā - Calculate risk scores ā
ā - Build dependency graph ā
ā - Categorize: SAFE / CAUTION / RISKY ā
āāāāāāāāāāāāāāāāāāāāā¬āāāāāāāāāāāāāāāāāāāāāā
ā¼
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā PHASE 3: ACTION (if --execute) ā
ā - Create backup branch ā
ā - Remove SAFE items in batches ā
ā - Validate build after each batch ā
ā - Prompt for CAUTION items ā
āāāāāāāāāāāāāāāāāāāāā¬āāāāāāāāāāāāāāāāāāāāāā
ā¼
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā PHASE 4: REPORTING ā
ā - Generate JSON report ā
ā - Generate Markdown summary ā
ā - CI exit codes ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
Create .claude/codebase-health-config.yml: