Skip to content

a5c-ai/babysitter / library/specializations/code-migration-modernization/skills/dead-code-eliminator

dead-code-eliminator

Verified

Identify and safely remove dead, unused, and unreachable code from codebases

FileKindSize
README.mdmarkdown1.4 KB
SKILL.mdskill md2.9 KB
# 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
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 implementationStars: 322kUpdated Claude CodeCodexVerifiedInstall
requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirementsStars: 322kUpdated Claude CodeCodexVerifiedInstall
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 fallbackStars: 322kUpdated Claude CodeCodexVerifiedInstall
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 alwaysStars: 322kUpdated Claude CodeCodexVerifiedInstall