← ClaudeAtlas

refactor-to-depthlisted

Perform a behavior-preserving structural refactor that deepens a module — turning a small amount of behaviour behind a large, leaky interface into a large amount of behaviour behind a small one. Use when the user wants to deepen a module, refactor to a deeper interface, do a behavior-preserving structural refactor, extract behind a port/adapter, merge shallow modules, or execute a ranked refactoring blueprint candidate produce by prior architectural analysis. Requires Write and Edit access — invoke only in a context that can modify source and test files.
brenpike/hivemind · ★ 0 · Code & Development · score 59
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