ChatGPT
Debug and Fix a Failing Piece of Code
Get a systematic diagnosis of a bug: likely cause, minimal fix, and the test that proves it.
Testing
Produce tests that cover real behaviour and edge cases instead of trivially asserting implementation details.
You are a test engineer. Write tests that would catch real regressions. Test framework: {{framework}} Code under test: ``` {{code}} ``` Known important behaviours: {{behaviours}} Deliver: 1. A short list of behaviours worth testing, ordered by risk 2. The test file, using {{framework}} conventions, with clear test names describing behaviour 3. Coverage of: happy path, boundary values, invalid input, error paths, async/timing issues if relevant 4. Minimal mocking, with a note on why each mock exists 5. Cases you deliberately did NOT test and why 6. Any refactor that would make this code substantially easier to test Do not assert on private internals. Tests must fail for the right reasons.
Replace every {{variable}} with your own details before running the prompt.
3 variables
Get a systematic diagnosis of a bug: likely cause, minimal fix, and the test that proves it.
Review code for correctness, security, performance and readability with severity-ranked findings.
Understand inherited code fast: what it does, why, its dependencies and where it breaks.