Detect and clean up dead code (unused imports, exports, files, dependencies)
Detect and clean up dead code in your project including unused imports, exports, files, and dependencies. Use detect mode to find issues safely, or cleanup mode to remove them after verification.
/plugin marketplace add jeffrigby/somepulp-agents/plugin install codebase-health@somepulp-agentsAnalyze the project for dead code using automated tools with agent verification.
$ARGUMENTS
npx knip)pip install deadcode)Project type is auto-detected from package.json, tsconfig.json, requirements.txt, or pyproject.toml.
Dead code tools return many false positives. The agent MUST verify each finding before reporting:
For each flagged item:
import(variable), require(variable), reflectionimport(modulePath), require(variableName)${CLAUDE_PLUGIN_ROOT}/scripts/dead-code-detect.shPresent findings as:
## Dead Code Analysis Report
### Summary
- Unused exports: X (verified)
- Unused imports: Y (verified)
- Unused dependencies: Z (verified)
### Unused Exports
| File | Export | Line |
|------|--------|------|
| src/utils.ts | formatDate | 42 |
### Filtered (False Positives)
- ComponentName - React component (JSX usage)
- dynamicLoader - dynamic import pattern
If mode=cleanup, after showing report:
npx knip --fix or deadcode --fix for approved itemsUse the dead-code-cleanup agent for the cleanup workflow.