Use a Short Prompt for a Narrow Refactor
@prranitarora▲ 9 net votes
For a refactor, state what should remain behaviorally identical before describing the cleanup. This anchors the change around preserving the working experience rather than only making code look different.
1 COMMENT
Capture outputs or run the existing test suite before and after the refactor, so the claim that behavior is unchanged is checked rather than assumed. Snapshot tests are useful when the code has no tests. Other platform gotchas welcome in the comments.