Refactor: small steps, reversible
Name the code smells first, then change in small steps that can each be rolled back
Prompt
Copy it whole, then replace the brackets with your own contentHandle this coding task: Refactor: small rollback-safe steps. Code/error: [paste] Environment: [language/version/framework] Requirements: Name the code smells first, then change in small independently revertible steps. Give your diagnosis first, then the changes, then how to verify.
Replace the text in [ ] with your own situation; ask long tasks in stages.
How to get better results
Read this before you fill it inFor methods over 100 lines where one change ripples through everything.
Give the conclusion and impact scope first, then only the changed snippets (no full files), and finally one check that proves it works. Flag risky spots separately.
This 260-line order method needs splitting; don't touch the logic, just split by responsibility, with each step independently rollback-able.
Asking for a big rewrite at once, review won't pass Not saying what can't change, ends up touching core logic No rollback path, only a full revert if something breaks
If problems remain after the fix, paste the new error and the changed snippet back; keep debugging on the original approach, don't switch approaches and rewrite.
More like this: Writing code prompts · All prompts