Skip to main content

Generate test cases for a validator (Recipe 56)

Fix issues quickly and ship safer code changes.

4 steps50 min
Save
00
codingworkflowrepeatable

Tools You'll Need

Steps

1

Reproduce & isolate

Prompts:

Reproduce & isolate

Given a Next.js API route that returns 500 intermittently, propose a minimal reproduction strategy and the exact logs/metrics to add.
2

Hypothesis list

Prompts:

Hypothesis list

List 8 likely root causes for intermittent 500s in a Prisma-backed endpoint (timeouts, schema drift, null fields, etc.) and how to confirm each quickly.
3

Patch proposal

Prompts:

Patch proposal

Draft a small patch that adds input validation, wraps DB calls with try/catch, and returns a structured error response; include an example JSON error payload.
4

Regression tests

Prompts:

Regression tests

Write 6 test cases (names + intent) that would prevent this bug from reappearing, including one load-ish test idea.