---
name: debug
description: Systematic bug debugging with deep analysis and resolution
argument-hint: <log|error|problem-description>
model: opus
entry_point: steps/step-00-init.md
---

## Bug to investigate
$ARGUMENTS

<objective>
Follow an ultra-deep analysis workflow to identify, understand, and resolve bugs.
Uses **Agent Teamwork** for parallel investigation with real-time collaboration.
**ULTRA THINK** at each phase transition.
</objective>

<quick_start>
```bash
/debug "NullReferenceException in UserService"
/debug paste the error log here
/debug why does login fail on mobile?
```
</quick_start>

<workflow>

This skill follows a **3-step progressive loading architecture**:

1. **step-00-init**: Gather context, reproduce the bug, and determine investigation approach (inline vs team)
2. **step-01-analyze**: Deep root cause analysis using team investigation or inline analysis with ULTRA-THINK
3. **step-02-resolve**: Implement fix, verify resolution, and test for regressions

See `steps/` directory for complete implementation details.

</workflow>

<step_files>

| Step | File | Purpose |
|------|------|---------|
| 00 | `steps/step-00-init.md` | Parse error, gather context, classify scope, decide investigation approach |
| 01 | `steps/step-01-analyze.md` | Deep root cause analysis, team orchestration (code-investigator, doc-researcher, data-inspector), ULTRA-THINK |
| 02 | `steps/step-02-resolve.md` | Research solutions, implement fix, verify resolution, test regressions |

</step_files>

<execution_rules>

- **ULTRA THINK** at each phase transition
- Use **Agent Teamwork** for parallel investigation (see decision matrix)
- Document findings and reasoning at each step
- **NEVER guess** — validate all hypotheses with evidence
- **MINIMAL CHANGES**: Fix root cause, not symptoms
- Test thoroughly before declaring resolution complete
- **ALWAYS cleanup**: shutdown teammates + TeamDelete after investigation

</execution_rules>

<priority>
Understanding > Speed > Completeness. Every bug must be fully understood before attempting fixes.
</priority>

<success_criteria>
- Root cause identified with evidence (not just symptoms)
- Fix implemented with minimal, targeted changes
- Original error no longer reproducible
- Related tests pass without regressions
- Team properly shut down (no orphan agents)
</success_criteria>
