# Refactor Clean

> Find and safely remove dead code, unused imports, and duplicate logic. Use when this capability is needed.

- Skill: `tomevault-io/refactor-clean` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/refactor-clean`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/refactor-clean/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: tomevault-io (https://skillmd.com/u/tomevault-io)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tomevault-io/refactor-clean

---


# /refactor-clean

Spawns the `refactor-cleaner` agent to identify unused code and safely remove it with test verification.

## Steps

1. **Gather context** — determine the scope of cleanup:
   - If arguments are provided (file paths or module names), scope to those
   - Otherwise, scan the full `src/` or project source directory
   - Check for a working test suite (cleanup requires test verification)

2. **Spawn the agent** — use the Task tool:
   ```
   Task tool with subagent_type="refactor-cleaner"
   ```
   Pass in the prompt:
   - The scope (specific files or full project)
   - The test command from `.claude-toolkit.json` or auto-detected
   - Any known entry points or public API files to protect

3. **Present findings** — relay the agent's cleanup report:
   - List items removed (unused imports, dead functions, unreferenced files)
   - List items flagged but not removed (uncertain usage)
   - Suggested consolidations (duplicate logic that could be merged)
   - Test results after cleanup

4. **Offer follow-up actions**:
   - "Review flagged items?" — investigate uncertain items
   - "Consolidate duplicates?" — merge suggested duplicate logic
   - "Run full test suite?" — verify nothing was missed

---
> Converted and distributed by [TomeVault](https://tomevault.io/claim/bis-code) — claim your Tome and manage your conversions.
<!-- tomevault:4.0:skill_md:2026-04-13 -->

