Refactor Overview Improve code structure and readability without changing external behavior. Refactoring is gradual evolution, not revolution. Use this for improving existing code, not rewriting from scratch. When to Use Use this skill when: - Code is hard to understand or maintain - Functions/classes are too large - Code smells need addressing - Adding features is difficult due to code structure - User asks "clean up this code", "refactor this", "improve this" --- Refactoring Principles The Golden Rules 1. Behavior is preserved - Refactoring doesn't change what the code does, only how 2. Sma…