Triage a bug or issue by exploring the codebase to find root cause, then create a GitHub issue with a TDD-based fix plan. Use when user reports a bug, wants to file an issue, mentions "triage", or wants to investigate and plan a fix for a problem.
Investigate a reported problem, find its root cause, and create a GitHub issue with a TDD fix plan. Exploration-first — no guessing. The issue is written in terms of behaviors and contracts, not file paths or line numbers, so it stays useful after refactors.
debugging-and-recoveryspec-driven-development| Thought |
|---|
| Reality |
|---|
| "I know what's wrong, I'll skip investigation" | You know the symptom. Cause is found by tracing, not guessing |
| "The fix is obvious — no need for a plan" | Obvious fixes skip TDD cycles and reintroduce the bug |
| "I'll reference the file and line in the issue" | File paths rot — write behaviors and contracts, not pointers |
| "I'll ask the user for more details before investigating" | Codebase exploration answers more than follow-up questions |
Get a brief description from the user. If none provided, ask ONE question: "What's the problem you're seeing?" Do NOT ask follow-up questions — start investigating immediately.
Use the Agent tool with subagent_type=Explore to find:
Look at: related source files, existing tests, recent changes (git log on relevant files), error handling in the code path, similar patterns that work correctly.
Based on investigation, determine:
Ordered list of RED-GREEN cycles. Each is one vertical slice:
Rules: tests verify behavior through public interfaces, not implementation details. One test at a time. Each test must survive internal refactors.
Use gh issue create. Do NOT ask the user to review before creating — create it and share the URL.
[What happens (actual) vs what should happen (expected). How to reproduce.]
[Code path, why it fails, contributing factors — no file paths or line numbers]
RED: Write a test that [describes expected behavior] GREEN: [Minimal change to make it pass]
...
REFACTOR: [Any cleanup needed after all tests pass]
After creating: print the issue URL and a one-line root cause summary.