refactor-to-depthlisted
Install: claude install-skill brenpike/hivemind
# Refactor to Depth (Refactor-Under-Green)
Execute a behavior-preserving "deepening" refactor: take a cluster of **shallow** modules — small behaviour behind a large, leaky interface — and reshape it into one **deep** module: a large amount of behaviour behind a small interface. This is the execution counterpart to architectural analysis: it consumes a chosen deepening candidate and applies it.
The discipline is **refactor-under-green**: behavior is pinned by tests before any structural change, and the tests stay GREEN throughout. You never reshape code while RED. If you cannot establish a green baseline, you cannot safely deepen — stop and report rather than refactor blind.
This skill uses the architecture vocabulary (**module**, **interface**, **implementation**, **depth/deep/shallow**, **seam**, **adapter**, **leverage**, **locality**) and the **deletion test** from `${CLAUDE_PLUGIN_ROOT}/skills/_shared/LANGUAGE.md`. Use those terms exactly — do not drift into "component," "service," "API," or "boundary." The deepening mechanics and dependency categories come from `${CLAUDE_PLUGIN_ROOT}/skills/_shared/DEEPENING.md`.
---
## Step 0: Resolve the candidate and the green-gate
Do these in parallel before touching any code.
### Resolve the deepening candidate
This skill consumes **one chosen deepening candidate**. Accept it path-agnostically:
- **From live context (default).** A candidate described in the conversation or plan — the shallow modules involved, the proposed