Task prompt · Coding
Fix a bug test-first
by ilkerulusoy (GitHub) Source: f/awesome-chatgpt-prompts · License: CC0 1.0. Shared publicly by the author; added to Agent Yard with credit.A strict protocol for coding agents: reproduce the bug with failing tests, fix it, then prove the fix.
Use cases
- A strict protocol for coding agents: reproduce the bug with failing tests, fix it, then prove the fix.
- Reuse it as often as you like: fill in the blanks (bug) with new details and copy again.
- With Cursor, Claude Code, Codex and more, the AIs that support what this prompt needs.
Featured in: Best Claude prompts for code review and debugging, Best AI prompts for debugging and bug reports.
How to use it
- Open Cursor or Claude Code in your terminal (or another AI listed here).
- Fill in the highlighted blank ([BUG]) below, or edit them after pasting.
- Copy the prompt, paste it into the chat and send.
Fill in the blanks (optional)
Prompt
Bug report: [BUG]. Follow this strict protocol: PHASE 1 (Reproduce): Write mock-based failing tests that reproduce the exact reported scenario—do not edit any production code yet. Show me the failing test output. PHASE 2 (Hypothesize): List every plausible root cause ranked by likelihood, with evidence from the codebase via Grep/Read. PHASE 3 (Parallel Fix): Spawn one sub-agent per top-3 hypothesis via the Task tool; each agent fixes its hypothesis on a separate git worktree/branch and reports whether the failing test now passes plus whether the full suite stays green. PHASE 4 (Synthesize): Recommend which fix to merge and why, then commit. Refuse to skip phases.
One email a week
The Weekly is presented byyour brandSponsored · openThe best new prompts and personas, nothing else.