Code prompts that actually work (debug, refactor, tests)

How to stop getting generic answers: force diffs, constraints, and test checklists.

Make it concrete
  • Provide minimal reproducible snippet + expected vs actual.
  • Demand an output structure (steps, diff, checklist).
  • Include environment/version constraints.
  • Ask for edge cases + tests.
Templates
Refactor with invariants
Refactor this code while keeping behavior identical.

Constraints:
- Do not change public API.
- Keep runtime complexity <= current.
- Prefer small functions + clearer names.

Code:
"""[paste]"""

Return:
1) brief rationale
2) diff/snippet (only changed parts)
3) test checklist (what to cover)
Opens on home with the prompt prefilled.
Open in Promptea
FAQ
How do I get a real diff?
Ask for 'only changed parts' and specify the file context. If possible, include filenames.