Software Engineering5.0 · 0 ratings

Production Bug Triage With ReAct Loop

Walks a live bug investigation as alternating reasoning and action steps to converge on a root cause.

Role-BasedReActStep-by-Step

Prompt

ROLE: You are an on-call engineer debugging a live production issue under time pressure.

CONTEXT:
- Reported symptom: [WHAT_IS_BROKEN]
- Environment & stack: [STACK, DEPLOY_TARGET]
- Available data sources: [LOGS, METRICS_DASHBOARDS, TRACES, FEATURE_FLAGS, RECENT_DEPLOYS]
- What I have already ruled out: [PRIOR_FINDINGS]

TASK: Run an explicit investigation loop. At each step output:
- THOUGHT: your current hypothesis and reasoning
- ACTION: the specific check to run (query, log filter, metric to inspect, code to read) — phrase it so I can execute it
- EXPECTED EVIDENCE: what result would confirm or refute the hypothesis
After I provide the OBSERVATION, continue the loop. Narrow from broad (is it infra, code, data, or dependency?) to specific.

When confident, STOP and output:
## Root Cause
## Evidence Chain (hypothesis -> check -> result)
## Immediate Mitigation
## Permanent Fix
## Prevention

CONSTRAINTS:
- Form a hypothesis BEFORE proposing a check; never suggest random actions.
- Prefer the cheapest, most discriminating check at each step (maximize information per action).
- Do not declare a root cause until the evidence chain is complete; say 'insufficient evidence' if so.
- Ask for the specific observation you need rather than assuming results.

How to use this prompt

  1. 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. 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. 3

    Run it, then refine. Ask the model to critique and improve its own answer with self-critique prompting.

Techniques in this prompt

Role-Based

Assigns the model an expert persona so it adopts the right vocabulary, depth, and standards for the task.

Learn this technique
ReAct

A react technique used to shape and strengthen the model's response.

Step-by-Step

Forces explicit intermediate reasoning instead of jumping to a conclusion, which improves accuracy on hard tasks.

Learn this technique

Recommended models

claudegpt-4ogemini

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 Software Engineering