Overview

Great bug fixes start with a reliable reproduction. Use Blink to capture a repro, propose a minimal patch, and write a regression test. Keep the change small and scoped to the failing behavior.

Before You Start

  • Provide logs, stack traces, and links to failing tests or routes
  • Share exact steps to reproduce (inputs, URLs, env)
  • Note recent changes that may be related

Workflow

  1. Reproduce and isolate the failing path
  2. Propose 1–2 minimal fixes with trade-offs
  3. Implement the smallest safe fix
  4. Add a regression test that fails before the fix and passes after
  5. Open a draft PR and link to the original issue

Prompt Templates

Context:
- API: POST /api/checkout returns 500 for some carts
- Logs show NPE in OrderSummary when lineItems is empty
- Goal: minimal fix + regression test; no API contract changes

Task: Reproduce locally (describe steps), propose 1–2 minimal fixes, implement the smallest change, and add a regression test. Explain potential side effects and how we can monitor in production.
The bug is intermittent.
- Please propose strategies to force a repro (seeded data, time freezing, mocks)
- Identify likely sources (race, null checks, data assumptions)
- Provide a temporary diagnostic patch to confirm the hypothesis

Anti‑Patterns and Recovery

  • Big refactors: ship the fix first, refactor later in a follow-up PR
  • Missing tests: always add a failing test first when possible
  • Unverified assumptions: add diagnostics and verify before patching
  • A concrete repro procedure and environment notes
  • A minimal code patch with a focused regression test
  • A small, reviewable PR with monitoring suggestions

Next Steps

  • If the bug touches multiple areas, split fixes across small PRs
  • Consider adding a health check or alert for the failing path