Apply Martin Fowler's Refactoring methodology (Refactoring: Improving the Design of Existing Code) to detect code smells, plan safe restructuring, and execute mechanical refactoring steps without changing observable behavior — calibrated to task size and risk, with real code examples.