Test-Driven Bug Hunting With Reproduction Agents

This prompt guides users through a structured process of identifying, reproducing, and fixing bugs in software. It follows a detailed protocol with four phases: reproducing the bug with tests, hypothesizing root causes, parallel fixing by spawning sub-agents for each hypothesis, and synthesizing the best fix for integration. Ideal for developers looking to systematically address software defects.

Prompts Chat Republished on Sep 15 0 Bookmarks 0 Copies
Bookmark 0

Prompt template

Format
Text Parameterized
Outputs
result (text)
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.

Replace the ${…} placeholders with your values before using this prompt. See parameters and defaults below

Parameters

Replace each placeholder with your own value, or use its default when one is provided

${bug} bug Required

What you'll create

A phased debugging workflow establishes the failure before comparing evidence-backed hypotheses and validating competing repairs.

Frequently asked questions

Can production code change before reproduction?

No, the source requires failing tests first.

Comments

Tried this prompt? Share what you made, compare results, or ask a question

Up to 4 results. Images up to 2 MB; MP4, WebM, or MOV videos up to 4 MB each