Agent skill
dead-code-eliminator
Identify and safely remove dead, unused, and unreachable code from codebases
Install this agent skill to your Project
npx add-skill https://github.com/a5c-ai/babysitter/tree/main/library/specializations/code-migration-modernization/skills/dead-code-eliminator
SKILL.md
Dead Code Eliminator Skill
Identifies and safely removes dead code, unused functions, unreachable code paths, and orphaned files from codebases to reduce complexity and maintenance burden.
Purpose
Enable safe dead code removal for:
- Codebase simplification
- Migration preparation
- Technical debt reduction
- Build size optimization
- Maintenance cost reduction
Capabilities
1. Unused Function Detection
- Find uncalled functions
- Identify unused exports
- Detect unreferenced methods
- Map call graphs
2. Unreachable Code Identification
- Analyze control flow
- Find code after returns
- Detect impossible conditions
- Identify dead branches
3. Unused Variable Detection
- Find unread variables
- Identify write-only variables
- Detect unused parameters
- Flag shadowed variables
4. Orphan File Detection
- Find unimported modules
- Identify orphaned assets
- Detect unused configuration
- Map file dependencies
5. Safe Removal Verification
- Verify no runtime references
- Check dynamic imports
- Validate reflection usage
- Test after removal
6. Impact Analysis
- Estimate removal scope
- Calculate size reduction
- Assess risk level
- Document dependencies
Tool Integrations
| Tool | Language | Integration Method |
|---|---|---|
| ts-prune | TypeScript | CLI |
| unimported | JavaScript | CLI |
| deadcode | Python | CLI |
| UCDetector | Java | Eclipse Plugin |
| unused | Rust | CLI |
| deadcode | Go | CLI |
| webpack-bundle-analyzer | JavaScript | CLI |
Output Schema
{
"analysisId": "string",
"timestamp": "ISO8601",
"deadCode": {
"functions": [
{
"file": "string",
"name": "string",
"line": "number",
"confidence": "high|medium|low",
"reason": "string"
}
],
"variables": [],
"files": [],
"unreachable": []
},
"impact": {
"filesAffected": "number",
"linesRemovable": "number",
"estimatedSizeReduction": "string"
},
"risks": [],
"recommendations": []
}
Integration with Migration Processes
- code-refactoring: Pre-refactoring cleanup
- legacy-decommissioning: Feature removal
- monolith-to-microservices: Service extraction prep
Related Skills
static-code-analyzer: Combined analysiscode-smell-detector: Related smell detection
Related Agents
legacy-decommissioning-specialist: Uses for cleanupcode-transformation-executor: Executes removal
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
gsd-tools
Central utility skill for GSD operations. Provides config parsing, slug generation, timestamps, path operations, and orchestrates calls to other specialized skills. Acts as the unified entry point that the original gsd-tools.cjs provided via its lib/ modules (commands, config, core, init).
model-profile-resolution
Resolve model profile (quality/balanced/budget) at orchestration start and map agents to specific models. Enables cost/quality tradeoffs by selecting appropriate AI models for each agent role.
verification-suite
Plan structure validation, phase completeness checks, reference integrity verification, and artifact existence confirmation. Provides the structured verification layer ensuring GSD artifacts are well-formed and complete.
state-management
STATE.md reading, writing, and field-level updates. Provides cross-session state persistence via .planning/STATE.md with structured fields for current task, completed phases, blockers, decisions, and quick tasks.
git-integration
Git commit patterns, formats, and conventions for GSD methodology. Provides atomic commits per task, structured commit messages, planning file commits, branch management, and milestone tag operations.
frontmatter-parsing
YAML frontmatter parsing and manipulation for .planning/ documents. Provides read, write, update, query, and validation operations on frontmatter blocks in GSD markdown artifacts.
Didn't find tool you were looking for?