What problem does it solve? Restructuring code by hand risks silently changing behavior, breaking callers, or duplicating existing utilities. This Skill runs a gated, multi-phase refactoring workflow that characterizes current behavior with tests before any edit, verifies each change, and blocks completion until safety gates pass. ## Core Features & Use Cases - Phased refactoring pipeline: Discovery, planning, test characterization, transformation, adversarial review, remediation, and completion phases with a resumable JSON contract per target file. - Behavior-preservation gates: Characterization tests must run green on pre-refactor code before any move, mutation probes verify the tests actually detect changes, and an independent CQ auditor plus adversarial review validate the final diff. - Refactor type routing: Classifies work as RENAME, EXTRACT, SPLIT, INLINE, or RESTRUCTURE, with dedicated protocols for GOD_CLASS decomposition, dead-code deletion, and pure structural moves. - Use Case: Splitting a 900-line service file into focused modules — the Skill maps all importers, writes pin-down tests for uncovered units, extracts responsibilities one at a time, and proves the public API is unchanged before committing. ## Quick Start Ask the assistant to refactor a specific file, for example: refactor src/services/order.service.ts to extract its pricing logic into a separate module.