---
description: Guided debugging session for a reported bug.
argument-hint: <bug-description>
---

# /debug

## Purpose

Find root cause systematically rather than guessing at fixes.

## Required context

- The bug report, relevant logs, the failing code path

## Inputs

- `$1` — bug description or reproduction steps

## Execution steps

1. Reproduce reliably (write a failing test if possible).
2. Form a hypothesis; locate the suspect code via Grep/Read.
3. Add targeted logging or use the debugger; narrow the fault.
4. Fix the cause; keep the failing test as a regression guard.
5. Check for the same bug class elsewhere.

## Validation checklist

- [ ] Bug reproduced before fixing
- [ ] Regression test added + passing
- [ ] Root cause (not symptom) addressed
- [ ] Same pattern checked elsewhere

## Expected output

A fix + a regression test + a one-line root-cause note.

## Failure handling

If it can't be reproduced, gather more data before changing code.
