Fix a bug
A step-by-step path to fix a bug, reusing free prompts with a review at each handoff.
Before you start
Reproduction steps, repository and failing evidence.
These are reusable planning steps. Keep source IDs and unresolved questions with each handoff; approve external actions separately.
Reproduce
Turn a bug report into a reproducible test ↗Carry forward: Record environment, steps, expected/actual behavior and minimal evidence before proposing a fix.
Verify this output against its source material before passing it to the next step.
Trace the path
Trace a user request across an unfamiliar codebase ↗Carry forward: Trace one user action through an unfamiliar repository.
Verify this output against its source material before passing it to the next step.
Verify the fix
Create a test plan from a feature’s acceptance criteria ↗Carry forward: Map each behavior to normal, boundary, invalid and recovery cases without mirroring implementation.
Verify this output against its source material before passing it to the next step.
Review the diff
Review an agent change for missing acceptance criteria ↗Carry forward: Review an agent-produced change against each acceptance criterion.
Verify this output against its source material before passing it to the next step.
Worked example
Illustrative worked example — not an executed code change
A checkout quantity field accepts zero through an API although the browser rejects it.
Starting inputs: Issue B7: POST /cart accepts quantity 0. Expected positive integer. Supplied trace: browser validation runs before submit; server handler passes quantity directly to cart storage. No repository, command output or test run supplied.
1. Reproduce
Input: B7 plus expected contract.
Handoff result: Reproduction: send an isolated test request with quantity 0; expected 400 and no cart mutation, reported actual 200. Control: quantity 1 should succeed. Attach request/response, environment and sanitized cart state when the reproduction is run.
Reported behavior remains unverified until a reproducible execution record exists.
Use this step's prompt ↗2. Trace the path
Input: Trace and request boundary.
Handoff result: Inspect API parser → domain validation → storage mutation. Proposed fix belongs at the server boundary or shared domain rule, not only in browser JavaScript. Reject zero, negative, fractional and nonnumeric values before storage. Check how existing callers encode quantity before choosing coercion behavior.
Do not invent filenames, line numbers or a completed patch without repository access.
Use this step's prompt ↗3. Verify the fix
Input: Proposed rule and acceptance cases.
Handoff result: Test plan: 0/−1/1.5/'x'/missing reject without writes; 1 succeeds once. Include numeric string behavior once specified, authorization regression and existing-cart state. Implementation and test commands are pending; the plan itself is not a passing test report.
Demonstrate failure before the patch and success after it in the actual project.
Use this step's prompt ↗4. Review the diff
Input: Future diff, command output and acceptance matrix.
Handoff result: Review gates: validation happens before mutation; error format matches contract; legitimate quantity 1 remains valid; no unrelated checkout behavior changes. Block release until the real diff, regression output and rollback plan are reviewed. Final handoff distinguishes proposed, implemented and executed checks.
Do not report the issue fixed from a plausible patch description alone.
Use this step's prompt ↗Result: A reproducible issue contract and a focused implementation/test/review handoff.
No repository was edited and no test was executed for this illustrative scenario.
Tools for this workflow
Codex ↗Claude Code ↗GitHub Copilot ↗Use the checked output as input to the next prompt. Review and authorize any external action separately.