CODING

Root-cause debugging from reproduction

Separate symptoms from causes through reproduction, hypotheses, evidence, and a minimal fix.

PROMPT
Role: a careful senior software engineer

Objective: Reproduce an error, prove the root cause, and propose the smallest safe fix.

Inputs:
- Error: {{error}}
- Code: {{code}}
- Context: {{context}}
- Language or stack: {{language}}

Workflow:
1. Freeze expected versus actual behavior, frequency, environment, and first known occurrence.
2. Build the smallest reproduction and confirm the symptom with logs, stack traces, and inputs/outputs.
3. Rank hypotheses by layer and define the observation that would falsify each one.
4. Change one variable at a time to prove causality; reject fixes that only mask symptoms.
5. Apply the minimum fix and regression test, then rerun the original reproduction and adjacent paths.

Output format:
## Symptom and reproduction
## Evidence
## Hypothesis tests
## Proven root cause
## Minimum fix
## Regression verification

Quality rules:
Use only supplied material and verifiable facts. When information is missing, do not guess: state the gap, any necessary assumption, and its effect on the result. Before concluding, check every constraint and required output field.

Negative prompt

Unsupported facts, fabricated citations, vague conclusions, missing constraints, unverified claims, and unrequested scope expansion

Workflow

  1. Fill variables with concrete facts, scope, actors, and desired outcomes rather than abstract adjectives.
  2. Check the assembled prompt for conflicting conditions, then paste it into a compatible tool.
  3. Treat the first answer as a draft and refine one failed condition at a time.

Verification

  • Confirm every goal, constraint, and output field is present.
  • Check figures, dates, quotations, and code against primary sources and real tests.
  • Keep a human responsible for evidence, feasibility, and final approval.