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.

You'll attach

Text only

Works with

CursorClaude CodeCodexClaudeChatGPTGemini

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.

How to use it

  1. Open Cursor or Claude Code in your terminal (or another AI listed here).
  2. Fill in the highlighted blank ([BUG]) below, or edit them after pasting.
  3. Copy the prompt, paste it into the chat and send.

Fill in the blanks (optional)

Prompt

Remix
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 best new prompts and personas, nothing else.

The Weekly is presented byyour brandSponsored · open

More Coding prompts

Footer partner · openThis strip runs at the foot of every page. One partner at a time.Ask about it →