What problem does it solve? Refactoring often drifts into hidden behavior changes, bundled bug fixes, or broad rewrites that are impossible to review safely. This Skill enforces a disciplined workflow where every refactor explicitly states that intended behavioral change is none, establishes behavioral coverage before editing, and keeps structural improvements separate from functional changes. ## Core Features & Use Cases - Refactor Contract and PR Template: Requires an explicit statement of the maintenance problem, structural change, preserved behavior, parity evidence, and non-goals before implementation. - Behavioral Parity Verification: Guides characterization tests, before/after comparisons of values, dimensions, names, errors, and side effects, with special caution for numerical code and S4-style dispatch. - Refactor Categories and Smell Detection: Covers extracting shared logic, removing wrappers, splitting overloaded helpers, consolidating validation, and flags "while here" scope creep as separate work. - Use Case: You notice three methods duplicating the same sample-alignment rule. Use this Skill to extract one internal helper, keep all public tests unchanged, and produce a reviewable PR proving zero behavioral change. ## Quick Start Ask the AI to refactor the duplicated logic in your module into a single helper while preserving all observable behavior and producing parity evidence.