refactoring-sweeplisted
Install: claude install-skill adnanmokhtar/refract
# Skill: refactoring-sweep
## Purpose
Apply Fowler-style refactorings as closure verbs in /optimize and /align-recheck. Each verb is a small, named, behaviour-preserving transformation with a clear fingerprint and verification step. The skill does NOT invent refactorings; it operates from a closed vocabulary of 10 verbs.
## When to use
- **Core apply-engine of `/refactor`** — the 10 verbs below ARE `/refactor`'s closed vocabulary; `/refactor` dispatches this skill with `--target=<paths>` and the `refactorer` agent gates abstractions on top. See [`commands/refactor.md`](../../../../../commands/refactor.md).
- Dispatched by `/optimize` Phase 2 (tactical) when class = refactoring.
- Dispatched by `/align-recheck` when the finding's class = refactoring.
- NOT dispatched by `/align-fast`. That command dispatches align's own per-finding loop (`find-and-align`) over the closed 21-verb align vocabulary, which does not contain these 10 Fowler verbs; a row that wants one is mis-classified and `/align-fast` routes it to `/refactor`, which is where this skill runs.
- NOT for new code or features — refactoring operates on existing code only.
## The 10 closure verbs
### 1. extract-method
**Fingerprint**:
- Function ≥ 30 lines, OR
- Cyclomatic complexity ≥ 10, OR
- A block of 5+ lines doing distinct work that has its own narrative (and could be named).
**Procedure**:
1. Identify the contiguous block to extract.
2. Detect free variables (referenced but not defined locally) → these be