DEV Community

The AI Leverage Weekly
The AI Leverage Weekly

Posted on

How to Use AI to Triage and Reproduce a Bug Report

Bug reports arrive incomplete, ambiguous, or buried in noise. Before you can fix anything, you need to triage — figure out severity and ownership — and then reproduce, which is often the hardest part. AI won't magically reproduce a bug for you, but it will dramatically compress the time between "a user filed a ticket" and "I have a failing test case in front of me." Here's the exact workflow I use.

Step 1: Feed the Raw Bug Report to the AI and Ask for a Triage Summary

Paste the entire bug report — stack trace, user description, logs, whatever you have — and prompt:

Here is a raw bug report. Summarize it with:
1. One-sentence description of what is failing
2. Likely severity (P1/P2/P3) with your reasoning
3. The component or service most likely responsible
4. What information is missing that would help reproduce this

---
[PASTE RAW BUG REPORT HERE]
Enter fullscreen mode Exit fullscreen mode

This gives you a structured starting point in seconds, and the "missing information" output is gold — it's your follow-up checklist for the reporter.

Step 2: Ask AI to Generate a Minimal Reproduction Scenario

Once you have the triage summary, ask the AI to sketch a reproduction path. Provide any relevant code, schema, or config snippets alongside the report:

Given this bug report and the following code snippet, write a step-by-step
reproduction scenario. Format it as numbered steps a developer can follow
from a clean environment. Flag any assumptions you're making.

Bug summary: [paste Step 1 output]
Code snippet:
[paste relevant code]
Enter fullscreen mode Exit fullscreen mode

The "flag your assumptions" instruction is critical — it surfaces gaps you'd otherwise only discover after wasting 30 minutes on the wrong path.

Step 3: Convert the Reproduction Steps into a Failing Test

This is where the real leverage is. Take the reproduction scenario and prompt:

Convert these reproduction steps into a failing unit or integration test
in [language/framework]. The test should:
- Set up the exact preconditions described
- Call the code path that triggers the bug
- Assert the incorrect behavior so the test fails until the bug is fixed

Reproduction steps:
[paste Step 2 output]
Enter fullscreen mode Exit fullscreen mode

You now have a regression test before you've written a single fix. That's the correct order.

Step 4: Use AI to Hypothesize Root Causes

With a reproducible case in hand, prompt for root cause candidates:

Here is a bug description and a failing test. List the 3 most likely root
causes, ranked by probability. For each, describe what code change would
confirm or rule it out.

Bug: [summary]
Failing test: [paste test]
Enter fullscreen mode Exit fullscreen mode

This turns a blank-stare debugging session into a structured investigation with a clear order of operations.

Putting It Together

The four prompts form a repeatable pipeline: raw report → triage summary → reproduction steps → failing test → root cause hypotheses. Each step's output feeds the next, so the AI has the context it needs at every stage. On a recent project I ran a gnarly async race condition through this pipeline and had a failing test in under 20 minutes — a task that usually burns an hour or more.

The key discipline: don't skip Step 1. A structured triage summary forces you to confirm you understand the bug before you start poking at code.


I break down one workflow like this every week in The AI Leverage Weekly — practical, no fluff, free. Subscribe: https://theaileverageweekly.beehiiv.com/subscribe?utm_source=devto&utm_medium=article&utm_campaign=medium_w18

Top comments (0)