a5c-ai/babysitter / library/specializations/code-migration-modernization/skills/dead-code-eliminator
dead-code-eliminator
VerifiedIdentify and safely remove dead, unused, and unreachable code from codebases
README.md
View on GitHub# Dead Code Eliminator Skill
## Overview
The Dead Code Eliminator skill identifies and safely removes unused code. It helps reduce codebase complexity, improve maintainability, and prepare for migrations by eliminating dead weight.
## Quick Start
### Prerequisites
- Language-specific dead code detection tool
- Test suite for validation
- Version control
### Basic Usage
1. **Detect dead code**
```bash
# TypeScript
npx ts-prune
# JavaScript
npx unimported
# Python
deadcode .
```
2. **Review findings**
- Verify unused status
- Check for dynamic usage
- Assess removal risk
3. **Remove safely**
- Remove in small batches
- Run tests after each removal
- Commit incrementally
## Features
### Detection Types
| Type | Description | Risk |
|------|-------------|------|
| Unused exports | Exported but never imported | Low |
| Dead functions | Defined but never called | Medium |
| Unreachable code | Code after return/throw | Low |
| Orphan files | Files never imported | Medium |
### Safety Checks
- Dynamic import analysis
- Reflection usage detection
- Entry point validation
- Test coverage consideration
## Configuration
```json
{
"exclude": ["**/*.test.ts", "**/__mocks__/**"],
"checkDynamicImports": true,
"confidence": "high",
"outputFormat": "json"
}
```
## Related Documentation
- [SKILL.md](./SKILL.md) - Full skill specification
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirements | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |