Small steps
Refactor in small, testable increments. AI is great at proposing them.
Behavior tests
Before refactoring, ask AI Test Case Generator to lock in current behavior.
Rename with confidence
Use AI to propose consistent naming across a module.
Extract patterns
Spot repeated logic and extract with AI-drafted helpers.
Review
Run tests. Read the diff. Ship.