Cursor prompt

Refactor with Zero Regressions

Structured refactoring prompt that ensures existing behavior is preserved while improving code quality.

Refactor the following code. Your goal is to improve {{refactor_goal}} while maintaining identical external behavior.

RULES:
- Do NOT change any public API signatures
- Do NOT change any return values or side effects
- Every existing test must still pass without modification
- If you introduce new helper functions, they must be private/internal

APPROACH:
1. First, list every public contract (function signatures, return types, side effects)
2. Perform the refactoring
3. After refactoring, verify each contract is preserved
4. Note any edge cases that the original code handled (even if poorly)

Code to refactor:
```{{language}}
{{code}}
```

Refactoring goal: {{refactor_goal}}

Fill in: {{refactor_goal}}, {{language}}, {{code}}. In Loopy you fill these in a form and copy the finished prompt in one click.