What this prompt does
This prompt drives a systematic debugging session in Copilot Chat for a [issue_type] problem in your [language]/[framework] application. It uses /explain on the error location and asks what conditions could cause [error_description] at that line, then uses @workspace to trace the data flow from [data_origin] to the crash point and identify where the data could become corrupted or null. The whole approach is built around finding the root cause rather than patching the first visible symptom.
The structure works because it follows a disciplined investigation rather than a single guess. It correlates [log_output] timestamps with the code flow, uses /fix but explicitly requests [fix_count] alternative solutions ranked by safety and minimal change, and generates a reproduction test that triggers the exact conditions causing the bug. It then requests a root-cause analysis document describing what happened, why existing tests did not catch it, and what systematic changes prevent recurrence, and finally asks Copilot to scan [other_files] for similar patterns that might harbor the same latent bug. Asking for a reproduction test and a root-cause write-up is precisely what stops the same bug from quietly returning a month later.
When to use it
- You have a production bug and need to trace it to its real root cause, not a symptom.
- You are chasing an intermittent issue like a race condition that is hard to reproduce.
- You need to follow a null or corrupt value back to where the data actually went wrong.
- You want multiple fix options ranked by safety, not just the first patch that compiles.
- You need a reproduction test so the bug cannot silently come back.
- You suspect the same latent bug exists in similar files elsewhere.
Example output
Expect a guided investigation with artifacts, not a one-shot fix. You get an explanation of the failing code path, a @workspace trace of the data flow from origin to crash, a correlation of log timestamps with the code, [fix_count] ranked fix alternatives, a reproduction test that triggers the bug, a root-cause analysis document, and a scan of [other_files] for similar patterns. The output is a debugging workflow you work through step by step, ending with a fix you can defend and a test that guards it.
Pro tips
- Be precise in
[error_description], since "NullPointerException in the order pipeline" focuses the analysis far better than "it crashes." - Set
[data_origin]to where the suspect data enters, such as the webhook payload, so the@workspacetrace starts at the right place. - Ask for
[fix_count]alternatives and actually compare them, because the safest minimal change is rarely the first one offered. - Always request the reproduction test, since a fix without a failing-then-passing test tends to regress over time.
- Point
[other_files]at the same package or layer so Copilot finds siblings carrying the identical latent bug. - For intermittent
[issue_type]like races, remember Copilot reasons about code rather than live timing, so verify its hypothesis under real conditions.