Use Cascade to refactor this code safely. First identify duplicated logic, unclear responsibilities, risky dependencies, and files that should not be changed. Then refactor in small steps while preserving behavior. Explain what changed and how to test it.
Paste into Cascade Chat before starting a task to guide the AI through a multi-step skill.