advanced Refactoring

Legacy Code Untangler

Analyze legacy code and propose a safe 3-phase refactoring plan

legacyrefactoringarchitecture

The Prompt

Analyze this file. Identify the core business logic vs boilerplate. Propose a refactoring plan in 3 phases: Phase 1 (safe, no behavior change), Phase 2 (restructure), Phase 3 (optimize). Show the Phase 1 changes.

This prompt works especially well on files over 300 lines with mixed concerns. The 3-phase approach ensures you never break working code in a single step.