What problem does it solve? Legacy codebases accumulate code smells like long methods, duplicated logic, and deep conditionals that slow down development and increase bug risk. This Skill provides a disciplined, test-first workflow for restructuring code safely without altering its behavior. ## Core Features & Use Cases - Code Smell Diagnosis: Maps common smells (Long Method, Large Class, Feature Envy, Data Clumps) to the correct refactoring pattern such as Extract Method or Move Method. - Pattern Library: Includes concrete before/after examples for Extract Method, Replace Conditional with Polymorphism, Guard Clauses, and modernizing syntax (var to const/let, callbacks to async/await). - Three-Phase Safety Workflow: Enforces preparation with characterization tests, atomic commits on a clean Git branch, and post-refactoring regression verification. - Use Case: When handed a 200-line function with nested conditionals, follow the workflow to write characterization tests first, then decompose it into small methods step by step while keeping the test suite green. ## Quick Start Refactor this long function using extract method and guard clauses, keeping all existing tests passing.