Failing Test Root Cause Investigator
Walks an agent from a failing test through hypotheses to a minimal, verified fix without thrashing.
Prompt
You are a Debugging Specialist driving an autonomous agent through a systematic root-cause investigation. You favor evidence over guessing. Context: Test [TEST_NAME] in [TEST_FILE] fails with: [ERROR_OUTPUT] Relevant source: [SOURCE_SNIPPET]. Recent changes: [RECENT_DIFF_OR_NONE]. Think step by step and show your reasoning: 1. Restate the expected vs. actual behavior precisely. 2. Form 2-4 ranked hypotheses for the cause. 3. For each hypothesis, state the cheapest experiment (log, breakpoint, isolated run) that confirms or refutes it. 4. Pick the most likely confirmed cause and explain the mechanism. 5. Propose the minimal fix and the exact command to re-verify. Output format: ### Expected vs Actual ### Ranked Hypotheses (table: hypothesis | confidence | experiment) ### Confirmed Cause ### Minimal Fix (diff or pseudocode) ### Verification Command Constraints: Do not propose a fix before naming the confirmed cause. Change as little as possible. If evidence is insufficient, output the single next experiment to run instead of a fix.
How to use this prompt
- 1
Copy the prompt above and paste it into ChatGPT, Claude, or Gemini — or open it in the visual Studio to edit each part on a canvas and run it with your own key.
- 2
Replace any bracketed placeholders with your specifics. The more concrete your context and constraints, the sharper the result — see the 5-part prompt structure.
- 3
Run it, then refine. Ask the model to critique and improve its own answer with self-critique prompting.
Techniques in this prompt
Asks the model to reason step by step before answering — ideal for multi-step, logical, or analytical tasks.
Learn this techniqueForces explicit intermediate reasoning instead of jumping to a conclusion, which improves accuracy on hard tasks.
Learn this techniqueRecommended models
Build on this prompt
Open it in the visual Studio to wire it into a full workflow with your own API key — or learn the craft behind prompts like this.
More in Agentic Coding & AI Dev Tools
Autonomous Coding Agent Task Scoping Brief
Turns a vague feature request into a bounded, verifiable task brief an autonomous coding agent can execute safely.
ReAct Loop Debugging Trace Analyzer
Diagnoses why an agent's ReAct (reason-act-observe) loop stalls, repeats, or hallucinates tool calls.
MCP Server Tool Specification Designer
Designs a clean, well-documented Model Context Protocol tool set with names, schemas, and guardrails.
Pull Request Review Agent Persona
Configures an AI reviewer that comments on diffs with severity-tagged, actionable, non-nitpicky feedback.