What problem does it solve?
This Skill provides a systematic approach to improving code structure and maintainability without altering its external behavior, reducing technical debt and making code easier to understand, test, and extend.
Core Features & Use Cases
- Core Patterns: Guides through essential refactoring patterns like Extract Method, Extract Class, Replace Conditional with Polymorphism, and Introduce Parameter Object.
- Safe Workflow: Emphasizes the "Red → Green → Refactor" cycle, ensuring tests always pass during small, incremental changes.
- Code Smells: Identifies common indicators that code needs refactoring (e.g., Long Method, Large Class, Duplicated Code, Magic Numbers).
- Use Case: Use this Skill to refactor a "Long Method" in your
OrderService by extracting smaller, single-responsibility functions like validateOrder and calculatePricing, making the code more readable and testable.
Quick Start
Use the refactoring-patterns skill to extract a new method named 'calculateTotal' from a long 'processOrder' function, ensuring all existing tests still pass.