Triage Issue
$ARGUMENTS
Investigate a bug, find root cause, and create a GitHub issue with a TDD fix plan. Mostly hands-off.
Usage
/triage-issue [bug description or symptom]
What This Command Does
- Captures problem description (ONE question max)
- Explores codebase deeply for root cause
- Identifies fix approach
- Designs TDD fix plan (RED→GREEN cycles)
- Creates GitHub issue via
gh issue create
Process
1. Capture the Problem
Get brief description. If not provided, ask ONE question: "What's the problem you're seeing?"
Do NOT ask follow-up questions. Start investigating immediately.
2. Explore and Diagnose
Use Agent (subagent_type=Explore) to deeply investigate:
| Target |
What to look for |
| Manifestation |
Where the bug appears (entry points, UI, API) |
| Code path |
Trace the flow from trigger to symptom |
| Root cause |
Why it fails (not just the symptom) |
| Related code |
Similar patterns, adjacent modules, existing tests |
| Recent changes |
git log on relevant files |
| Working patterns |
Similar code elsewhere that works correctly |
3. Identify Fix Approach
Determine:
- Minimal change to fix root cause
- Affected modules/interfaces
- Behaviors to verify via tests
- Classification: regression, missing feature, or design flaw
4. Design TDD Fix Plan
Ordered list of RED→GREEN cycles. Each cycle is one vertical slice:
- RED: Specific test capturing broken/missing behavior
- GREEN: Minimal code change to pass that test
Rules:
- Tests verify behavior through public interfaces
- One test at a time, vertical slices
- Tests must survive internal refactors
- Describe behaviors and contracts, not internal structure
5. Create GitHub Issue
Use gh issue create with template below. Share URL immediately.
Issue Template
Problem
- What happens (actual behavior)
- What should happen (expected behavior)
- How to reproduce
Root Cause Analysis
What was found during investigation:
- The code path involved
- Why the current code fails
- Contributing factors
Do NOT include file paths, line numbers, or implementation details. Describe modules, behaviors, and contracts.
TDD Fix Plan
RED: Write test that [expected behavior]
GREEN: [Minimal change to pass]
RED: Write test that [next behavior]
GREEN: [Minimal change to pass]
REFACTOR: [Cleanup after all tests pass]
Acceptance Criteria
Rules
- MUST explore the codebase for root cause before filing — symptoms masquerade as causes often
- MUST propose a TDD fix plan with ordered RED→GREEN cycles, each a vertical slice
- NEVER ask follow-up clarifying questions; one initial question maximum, then investigate autonomously
- NEVER include file paths, function names, or line numbers in the issue body — they go stale before the issue is picked up
- CRITICAL: the issue must be reproducible. If reproduction steps cannot be determined from the investigation, say so explicitly in the Problem section — do not fabricate them.
- MANDATORY: file the issue immediately via
gh issue create and share the URL — do not ask the user to review a draft first
Gotchas
gh issue create without --body opens $EDITOR. In automated flows the skill hangs — always pass the body file or inline text.
- "Root cause" often turns out to be two concurrent issues. If the investigation keeps branching, file the most-probable primary cause and note the secondary as a follow-up in the same issue.
- TDD plans with more than ~5 RED→GREEN cycles usually conceal a deeper design issue. Short plans (2-3 cycles) reflect confident root-cause identification; long plans reflect fishing.
- The
debugger agent explored autonomously but returns a narrative. Parse it for: confirmed hypothesis, code paths, and recent changes. Discard speculation.
- Bugs in framework-adjacent code (middleware, ORM hooks) require test setup that mirrors the framework's call context. A TDD plan that writes the test "like a unit test" may not actually reproduce the framework bug.
When NOT to Use
- For a conversational bug report from a non-engineer — use
/qa-session first, which returns refined reports this skill can then process
- For a specific reproducible error with known root cause — use
/fix directly
- For architectural-scale problems — use
/architecture-audit
- For creating issues from a PRD — use
/prd-to-issues
- For debugging without filing an issue — use
/debug
1---2name: triage-issue3description: Bug triage: explores codebase for root cause, files GitHub issue with TDD fix plan. Triggers: triage, investigate bug, fix plan, root cause, file issue, bug report.4---56# Triage Issue78$ARGUMENTS910Investigate a bug, find root cause, and create a GitHub issue with a TDD fix plan. Mostly hands-off.1112## Usage1314```15/triage-issue [bug description or symptom]16```1718## What This Command Does19201. **Captures** problem description (ONE question max)212. **Explores** codebase deeply for root cause223. **Identifies** fix approach234. **Designs** TDD fix plan (RED→GREEN cycles)245. **Creates** GitHub issue via `gh issue create`2526## Process2728### 1. Capture the Problem2930Get brief description. If not provided, ask ONE question: "What's the problem you're seeing?"3132Do NOT ask follow-up questions. Start investigating immediately.3334### 2. Explore and Diagnose3536Use Agent (subagent_type=Explore) to deeply investigate:3738| Target | What to look for |39|--------|-----------------|40| Manifestation | Where the bug appears (entry points, UI, API) |41| Code path | Trace the flow from trigger to symptom |42| Root cause | Why it fails (not just the symptom) |43| Related code | Similar patterns, adjacent modules, existing tests |44| Recent changes | `git log` on relevant files |45| Working patterns | Similar code elsewhere that works correctly |4647### 3. Identify Fix Approach4849Determine:50- Minimal change to fix root cause51- Affected modules/interfaces52- Behaviors to verify via tests53- Classification: regression, missing feature, or design flaw5455### 4. Design TDD Fix Plan5657Ordered list of RED→GREEN cycles. Each cycle is one vertical slice:5859- **RED**: Specific test capturing broken/missing behavior60- **GREEN**: Minimal code change to pass that test6162Rules:63- Tests verify behavior through public interfaces64- One test at a time, vertical slices65- Tests must survive internal refactors66- Describe behaviors and contracts, not internal structure6768### 5. Create GitHub Issue6970Use `gh issue create` with template below. Share URL immediately.7172## Issue Template7374<issue-template>7576## Problem7778- What happens (actual behavior)79- What should happen (expected behavior)80- How to reproduce8182## Root Cause Analysis8384What was found during investigation:85- The code path involved86- Why the current code fails87- Contributing factors8889Do NOT include file paths, line numbers, or implementation details. Describe modules, behaviors, and contracts.9091## TDD Fix Plan92931. **RED**: Write test that [expected behavior]94 **GREEN**: [Minimal change to pass]95962. **RED**: Write test that [next behavior]97 **GREEN**: [Minimal change to pass]9899**REFACTOR**: [Cleanup after all tests pass]100101## Acceptance Criteria102103- [ ] Criterion 1104- [ ] All new tests pass105- [ ] Existing tests still pass106107</issue-template>108109## Rules110111- **MUST** explore the codebase for root cause before filing — symptoms masquerade as causes often112- **MUST** propose a TDD fix plan with ordered RED→GREEN cycles, each a vertical slice113- **NEVER** ask follow-up clarifying questions; one initial question maximum, then investigate autonomously114- **NEVER** include file paths, function names, or line numbers in the issue body — they go stale before the issue is picked up115- **CRITICAL**: the issue must be reproducible. If reproduction steps cannot be determined from the investigation, say so explicitly in the Problem section — do not fabricate them.116- **MANDATORY**: file the issue immediately via `gh issue create` and share the URL — do not ask the user to review a draft first117118## Gotchas119120- `gh issue create` without `--body` opens `$EDITOR`. In automated flows the skill hangs — always pass the body file or inline text.121- "Root cause" often turns out to be two concurrent issues. If the investigation keeps branching, file the most-probable primary cause and note the secondary as a follow-up in the same issue.122- TDD plans with more than ~5 RED→GREEN cycles usually conceal a deeper design issue. Short plans (2-3 cycles) reflect confident root-cause identification; long plans reflect fishing.123- The `debugger` agent explored autonomously but returns a narrative. Parse it for: confirmed hypothesis, code paths, and recent changes. Discard speculation.124- Bugs in framework-adjacent code (middleware, ORM hooks) require test setup that mirrors the framework's call context. A TDD plan that writes the test "like a unit test" may not actually reproduce the framework bug.125126## When NOT to Use127128- For a conversational bug report from a non-engineer — use `/qa-session` first, which returns refined reports this skill can then process129- For a specific reproducible error with known root cause — use `/fix` directly130- For architectural-scale problems — use `/architecture-audit`131- For creating issues from a PRD — use `/prd-to-issues`132- For debugging without filing an issue — use `/debug`