Refactor with AI Safely refactor code with AI assistance while preserving behavior. When to Use - Cleaning up messy or complex code - Extracting reusable functions/components - Modernizing legacy patterns - Reducing cyclomatic complexity - Applying design patterns - Preparing code for new features The Safe Refactoring Process Step 1: Characterize with Tests Before ANY refactoring, ensure behavior is captured. Step 2: Identify Code Smells Common Smells to Look For | Smell | Sign | Refactoring | |-------|------|-------------| | Long Method | 20 lines | Extract Method | | Long Parameter List | 3…