Example result: List the edge cases your code might miss
AI-generated example · Edge Cases
Updated

List the edge cases your code might miss

This prompt acts like a QA engineer trying to break your code. It lists edge cases, says what your code would do now and what it should do, and marks the ones most likely to cause a real bug.

text-code-edge-case-finder — claude — 83 words

Act as a QA engineer who is very good at breaking things.

Function or feature:
[PASTE THE CODE OR DESCRIBE IT]

List every edge case you can think of: empty and missing values, very large inputs, special characters and emoji, dates across timezones and leap years, duplicates, concurrency, slow or failed network calls, and permission problems. For each, say what the code would do now (from reading it) and what it should do. Mark the ones most likely to cause a real bug.

Turn the top three into tests straight away. An edge case on a list does not protect anything.

Get a better result

What you will get

A long list of edge cases for your code, from empty values and huge inputs to emoji, time zones, duplicates, concurrency and failed network calls, each with what the code does now, what it should do, and the likely real bugs marked.

Why it works

The prompt gives the model a role whose job is breaking things, then hands it a checklist of the places bugs hide. Asking what the code does now, from reading it, keeps answers tied to your code rather than general advice. Marking the likely bugs at the end is what turns a long list into the three tests worth writing today.

Common mistake

The list is generic and not about your code.

Fix: Paste the code itself, not a description, so it can say what each line does with each odd input.

Also watch for
  • It guesses what the code does with a strange input. Ask it to mark which answers come from reading the code and which are guesses, then test the guesses.
  • The list is too long to act on. Ask it to group them by the fix they need, since one input check often covers five edge cases.
Try a variation: find abuse cases

Ask for inputs a hostile user would send on purpose, like very long strings, negative amounts or someone else’s ID.

Still not right? Reply with this

Turn your top three edge cases into tests in [TEST FRAMEWORK], with a short comment on what each one protects.

More chat & writing prompts

See all 465 →