{"slug":"cursor-regression-tests","title":"Write the regression test for a bug you can reproduce","summary":"Cursor Agent adds a failing test for a known bug, then the fix, and stops if the test never failed.","agent":"Cursor","agentSlug":"cursor","category":"Coding","categorySlug":"coding","roles":["Software engineer"],"roleSlugs":["software-engineer"],"industries":["Software"],"industrySlugs":["software"],"jobs":["code-review","shipping-code"],"topic":"Dev & Coding","topicSlug":"dev-and-coding","score":16,"difficulty":"easy","estCost":"Cursor Agent on a normal paid plan.","costTier":"low","timeSaved":"The boilerplate of a regression test, often under an hour when the repro is already known.","prompt":"Here is a bug, the steps that reproduce it, and the file I think is involved.\n\nFirst add a regression test that fails for the right reason. Show me the failure output. If you cannot make it fail, stop and explain. Do not \"fix\" the production code first.\n\nAfter the failure is real, apply the smallest fix that turns that test green. Do not delete the test or weaken the assertion.\n\nBUG:\nREPRO STEPS:\nSUSPECT FILE:","steps":[{"title":"Write the repro in human language first","detail":"Include inputs and the wrong output. The agent should not have to rediscover the bug."},{"title":"Start Agent with the prompt","detail":"The agent overview lists terminal commands among the tools. The failure output is required."},{"title":"Read the assertion","detail":"A test that only checks 'does not throw' is not a regression test for a logic bug."},{"title":"Commit test and fix together","detail":"The history should show the test was meaningful. You still review the production change."}],"sourceUrl":"https://cursor.com/docs/agent/overview","sourceNote":"Official documentation URL, checked when this seed was written. The prompt and steps are an original AI Playbook Gems playbook, not a quotation of a customer story, and have not been re-run.","date":"2026-10-09","verified":false,"status":"unverified","sponsorUrl":"","metrics":[{"label":"Hands-on time","value":"20–40 minutes when the repro is solid"},{"label":"You still approve","value":"Whether the assertion matches the bug"},{"label":"Cost bucket","value":"Low"}],"faq":[{"question":"Has this Cursor playbook been re-run for the catalog?","answer":"No. Status is unverified. Paste the prompt, keep the version that worked, and do not treat the time or cost lines as measurements."},{"question":"What if the bug is flaky?","answer":"The prompt says to stop when a failing test cannot be made. A flake needs a tighter repro, not a guessed fix."}],"url":"https://aiplaybookgems.com/usecases/cursor-regression-tests","jsonUrl":"https://aiplaybookgems.com/api/usecases/cursor-regression-tests"}