Code
Fix a failing test
Find why a test fails and fix the cause, not the assertion.
Fill it in
Where the test lives.
Paste the output, or name the test.
Run the whole suite before delivering.
Your prompt
Fix this failing test in [your repository or path]. Failure: [the failure] Reproduce it FIRST. A test you have not seen fail is a test you cannot know you fixed, and the most common wasted change is one that makes a flaky test pass by accident. Then find out which is wrong: the test or the code. Both happen. A test asserting yesterday's behaviour deserves to be rewritten; a test catching a real regression deserves the code to change. Say which one you concluded and why, because that judgement is the actual work and it is the part a reviewer checks. Never make a test pass by weakening its assertion, deleting a case, or adding a retry. If the real fix is out of scope, say so and leave it failing. Run the whole suite before you deliver. A fix that breaks two other tests is not a fix, and finding that out yourself is cheaper than finding it out in review.
Use Fix a failing testOpens with everything above already filled in.
Why this works
The instruction carrying the weight is "reproduce it first". A model handed a failing test and a codebase will confidently explain the failure from reading alone, and it is right often enough to be dangerous: the times it is wrong, the fix targets a cause that was never there and the test goes green for an unrelated reason. The second is the refusal to weaken an assertion. Making a test pass is trivially easy in the wrong direction, and it is the most common way a suite quietly stops protecting anything.
Questions
- What if the test itself is wrong?
- Then it rewrites the test and says so. Both outcomes are legitimate; what is not legitimate is changing one without telling you which it concluded.
- Does it need my whole repository?
- It needs enough to run the test. Point it at a repo it can clone, or a folder in your Drive.