Claude-skill-registry ln-626-dead-code-auditor
Dead code & legacy audit worker (L3). Checks unreachable code, unused imports/variables/functions, commented-out code, backward compatibility shims, deprecated patterns. Returns findings.
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/ln-626-dead-code-auditor" ~/.claude/skills/majiayu000-claude-skill-registry-ln-626-dead-code-auditor-f83414 && rm -rf "$T"
manifest:
skills/data/ln-626-dead-code-auditor/SKILL.mdsource content
Dead Code Auditor (L3 Worker)
Specialized worker auditing unused and unreachable code.
Purpose & Scope
- Worker in ln-620 coordinator pipeline
- Audit dead code (Category 9: Low Priority)
- Find unused imports, variables, functions, commented-out code
- Calculate compliance score (X/10)
Inputs (from Coordinator)
Receives
contextStore with tech stack, codebase root.
Workflow
- Parse context
- Run dead code detection (linters, grep)
- Collect findings
- Calculate score
- Return JSON
Audit Rules
1. Unreachable Code
Detection:
- Linter rules:
(ESLint)no-unreachable - Check code after
,return
,throwbreak
Severity: MEDIUM
2. Unused Imports/Variables/Functions
Detection:
- ESLint:
no-unused-vars - TypeScript:
,noUnusedLocalsnoUnusedParameters - Python:
withflake8
,F401F841
Severity:
- MEDIUM: Unused functions (dead weight)
- LOW: Unused imports (cleanup needed)
3. Commented-Out Code
Detection:
- Grep for
or//.*{
patterns/*.*function - Large comment blocks (>10 lines) with code syntax
Severity: LOW
Recommendation: Delete (git preserves history)
4. Legacy Code & Backward Compatibility
What: Backward compatibility shims, deprecated patterns, old code that should be removed
Detection:
- Renamed variables/functions with old aliases:
- Pattern:
orconst oldName = newNameexport { newModule as oldModule } - Pattern:
(wrapper for backward compatibility)function oldFunc() { return newFunc(); }
- Pattern:
- Deprecated exports/re-exports:
- Grep for
,// DEPRECATED
JSDoc tags@deprecated - Pattern:
orexport.*as.*old.*export.*legacy.*
- Grep for
- Conditional code for old versions:
- Pattern:
orif.*legacy.*
orif.*old.*version.*isOldVersion ? oldFunc() : newFunc()
- Pattern:
- Migration shims and adapters:
- Pattern:
,migrate.*
,Legacy.*Adapter
,.*Shim.*Compat
- Pattern:
- Comment markers:
- Grep for
,// backward compatibility
,// legacy support// TODO: remove in v - Grep for
,// old implementation
,// deprecated// kept for backward
- Grep for
Severity:
- HIGH: Backward compatibility shims in critical paths (auth, payment, core features)
- MEDIUM: Deprecated exports still in use, migration code from >6 months ago
- LOW: Recent migration code (<3 months), planned deprecation with clear removal timeline
Recommendation:
- Remove backward compatibility shims - breaking changes are acceptable when properly versioned
- Delete old implementations - keep only the correct/new version
- Remove deprecated exports - update consumers to use new API
- Delete migration code after grace period (3-6 months)
- Clean legacy support comments - git history preserves old implementations
Effort:
- S: Remove simple aliases, delete deprecated exports
- M: Refactor code using old APIs to new APIs
- L: Remove complex backward compatibility layer affecting multiple modules
Scoring Algorithm
penalty = (high * 1.0) + (medium * 0.5) + (low * 0.2) score = max(0, 10 - penalty)
Output Format
{ "category": "Dead Code", "score": 6, "total_issues": 12, "high": 2, "medium": 3, "low": 7, "findings": [ { "severity": "MEDIUM", "location": "src/utils/helpers.ts:45", "issue": "Function 'formatDate' is never used", "principle": "Code Maintainability / Clean Code", "recommendation": "Remove unused function or export if needed elsewhere", "effort": "S" }, { "severity": "HIGH", "location": "src/api/v1/auth.ts:12-15", "issue": "Backward compatibility shim for old password validation (6+ months old)", "principle": "No Legacy Code / Clean Architecture", "recommendation": "Remove old password validation, keep only new implementation. Update API version if breaking.", "effort": "M" } ] }
Version: 3.0.0 Last Updated: 2025-12-23