Code Refactoring When to use this skill - Code review : Discovering complex or duplicated code - Before adding new features : Cleaning up existing code - After bug fixes : Removing root causes - Resolving technical debt : Regular refactoring Instructions Step 1: Extract Method Before (long function) : After (method extraction) : Step 2: Remove Duplication Before (duplication) : After (extract common logic) : Step 3: Replace Conditional with Polymorphism Before (long if-else) : After (polymorphism) : Step 4: Introduce Parameter Object Before (many parameters) : After (grouped into object) : St…