Template
Rank root-cause hypotheses with confidence and evidence needed to confirm each one.
Guide #3 · Engineering
AI-assisted debugging works only when evidence quality is high. Without reproducible steps and targeted logs, model suggestions become guesswork.
A reliable workflow has four stages: triage, reproduction, hypothesis ranking, and safe patch verification.
This guide covers triage matrix design, logging strategy, and minimal-risk patch patterns.
Classify incidents by impact, frequency, blast radius, and reversibility. This determines whether you need hotfix, rollback, or normal patch flow.
Include environment scope because some issues are browser-specific, region-specific, or feature-flag dependent.
Do not ask for fixes before reproduction is stable. Provide exact steps, runtime versions, expected behavior, and observed behavior.
Instrument decision points instead of adding noisy logs everywhere. Target validation boundaries, branch choices, and dependency calls.
Request the smallest safe fix first: guard clause, boundary check, timeout fallback, or retry policy adjustment.
Every patch should include regression tests for the failing path plus one adjacent edge case to avoid repeat incidents.
Rank root-cause hypotheses with confidence and evidence needed to confirm each one.
Propose minimal safe patch with risk notes and rollback condition.
Generate regression tests for failing path and one adjacent edge case.
Suggest additional instrumentation that disambiguates top hypotheses.
Write concise post-incident summary with timeline and prevention actions.
React crash: Cannot read properties of undefined (reading map). Happens after login on slow network when payload contains null array.
Rank hypotheses, propose minimal fix, and generate regression tests.
Top cause: component assumes array before hydration. Fix: normalize to safe empty array and render fallback state. Regression tests cover null payload, valid payload, and slow-network first render.
Backend worker times out on external pricing API; retries fire without jitter and create burst load.
Design mitigation patch with logging updates and regression checks.
Adjust timeout to observed percentile, apply jittered backoff, log correlation IDs and latency fields, and verify terminal failure path after max retries.
Debugging prompts should be integrated with incident response runbooks, not treated as standalone chat snippets. The fastest gains appear when prompts reference the same severity matrix and rollback triggers used by on-call engineers.
Require a \"reproduction evidence\" block before any fix proposal is accepted. This block should include environment versions, feature flags, trace IDs, and exact failing checkpoints. AI quality drops sharply when these elements are omitted.
After each incident, archive one postmortem prompt that produced a high-quality summary and one prompt that failed. This contrast improves future incident communication and reduces repeated diagnostic mistakes.
For services with strict availability targets, add a pre-deploy gate requiring explicit verification of error-budget impact. Prompt outputs should include expected blast radius, rollback latency estimate, and monitoring signals that confirm recovery. This turns AI assistance into a controlled engineering input rather than an unbounded suggestion stream during high-pressure incidents.
Enough to test hypotheses: repro steps, versions, logs, and expected behavior.
It can draft candidates, but human testing and review remain required.
Ask for ranked hypotheses and required evidence before code changes.
Add one adjacent edge-case test, not only exact observed input.
Do not include sensitive personal data, credentials, or confidential client information in prompts.
For legal, medical, and financial decisions, validate AI output with qualified professionals and authoritative sources.