# Refactor Clean

> Safely identify and remove dead code with test verification. Invokes refactor-cleaner agent. Use when cleaning unused code, removing duplicates, or reducing bundle size.

- Skill: `ihj04982/refactor-clean` (Agent Skill)
- Install (CLI): `npx skillmds@latest add ihj04982/refactor-clean`
- Raw SKILL.md: https://api.skillmd.com/api/skills/ihj04982/refactor-clean/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: ihj04982 (https://skillmd.com/u/ihj04982)
- Updated: 2026-09-10
- Page: https://skillmd.com/skills/ihj04982/refactor-clean

---


# Refactor Clean Command

This command invokes the **refactor-cleaner** agent to identify and safely remove dead code, duplicates, and unused exports.

## What This Command Does

1. **Analyze** - Run knip, depcheck, ts-prune to find unused code
2. **Categorize** - SAFE (utilities), CAUTION (components), DANGER (entry points)
3. **Propose safe deletions only** - No risky removals
4. **Test before/after** - Full test suite run before each deletion
5. **Track** - Document deletions in DELETION_LOG.md

## When to Use

Use `/refactor-clean` when:
- Cleaning up unused code
- Removing duplicates
- Consolidating codebase
- Reducing bundle size
- After major refactoring to prune orphaned code

## How It Works

The refactor-cleaner agent runs dead code detection tools, generates a report, and applies deletions only when tests pass. It never deletes without running tests first.

## Related

- Agent: `agents/refactor-cleaner.md`
- Tools: knip, depcheck, ts-prune

