**TL;DR**: `/refactor-clean` - Detect and safely remove dead code, unused dependencies, and technical debt.

---

## Usage

```bash
/refactor-clean             # Full dead code analysis
/refactor-clean --deps      # Dependency audit only
/refactor-clean --imports   # Unused imports only
/refactor-clean --apply     # Apply safe removals
```

## Detection Tools

### Python
```bash
vulture src/                # Unused code
ruff check --select=F401    # Unused imports
pip-audit                   # Dependency audit
```

### TypeScript/JavaScript
```bash
npx knip                    # Comprehensive dead code
npx depcheck                # Unused dependencies
npx ts-prune                # Unused exports
```

## What Gets Detected

| Category | Examples |
|----------|----------|
| Unused imports | `import os  # never used` |
| Unused functions | `def helper():  # never called` |
| Unused variables | `result = calc()  # never read` |
| Unused dependencies | `lodash` in package.json but not imported |
| Commented code | Old code left as comments |

## Risk Levels

| Level | Action | Examples |
|-------|--------|----------|
| **Safe** | Auto-remove | Unused imports, local variables |
| **Review** | Manual check | Unused exports, functions |
| **Keep** | False positive | Dynamic imports, reflection |

## Example Output

```markdown
Dead Code Analysis Complete
===========================

Unused Imports (8) - Safe to remove ✓
  src/utils.py: import os
  src/api.py: from typing import Dict

Unused Functions (3) - Review required ⚠
  src/helpers.py: format_legacy_date() - 90% confidence
  src/parsers.py: parse_v1_format() - 85% confidence

Unused Dependencies (2) - Review required ⚠
  moment: Not imported anywhere
  lodash: Only in deleted file

Apply safe removals? [y/N]:
```

## Integration

This command invokes the **Refactor Cleaner Agent** which:
- Analyzes with multiple tools
- Categorizes by confidence level
- Applies safe removals automatically
- Flags risky removals for review
