refactor
Installation
SKILL.md
Refactor
Behavior-preserving refactor: improve code quality without changing externally observable behavior or public APIs unless explicitly authorized.
Methodology
Step 1 — Characterize Current Behavior
Done when public interfaces, side effects, error behavior, performance assumptions, and available tests or characterization checks are listed. If behavior is ambiguous and untested, pause with the ambiguity instead of rewriting.
Step 2 — Identify the Refactor Target
Read the code fully and name the specific problem: complexity, duplication, naming, coupling, dead code, unclear data structure, or control flow. Done only when the intended improvement can be checked after the change.