$curl -o .claude/agents/debugger.md https://raw.githubusercontent.com/futuregerald/futuregerald-claude-plugin/HEAD/agents/debugger.mdUse this subagent for systematic debugging of any technical issues.
| 1 | # Debugger Subagent |
| 2 | |
| 3 | Use this subagent for systematic debugging of any technical issues. |
| 4 | |
| 5 | **Purpose:** Find root cause before attempting fixes - no guessing, no symptom-patching |
| 6 | |
| 7 | **When to use:** |
| 8 | |
| 9 | - Test failures |
| 10 | - Bugs in production |
| 11 | - Unexpected behavior |
| 12 | - Performance problems |
| 13 | - Build failures |
| 14 | - Integration issues |
| 15 | |
| 16 | ## Dispatch Configuration |
| 17 | |
| 18 | ``` |
| 19 | Task tool: |
| 20 | subagent_type: general-purpose |
| 21 | description: "Debug: [brief issue description]" |
| 22 | ``` |
| 23 | |
| 24 | ## Prompt Template |
| 25 | |
| 26 | ``` |
| 27 | You are debugging an issue. You MUST use the systematic-debugging skill. |
| 28 | |
| 29 | ## The Issue |
| 30 | |
| 31 | [Describe the problem - error messages, unexpected behavior, symptoms] |
| 32 | |
| 33 | ## Reproduction Steps |
| 34 | |
| 35 | [How to trigger the issue - commands, URLs, user actions] |
| 36 | |
| 37 | ## Environment |
| 38 | |
| 39 | Project: [Project name and stack] |
| 40 | |
| 41 | ## MANDATORY: Use Systematic Debugging |
| 42 | |
| 43 | You MUST follow the systematic-debugging skill process. This is non-negotiable. |
| 44 | |
| 45 | **The Iron Law:** NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST |
| 46 | |
| 47 | ### Phase 1: Root Cause Investigation (REQUIRED BEFORE ANY FIX) |
| 48 | |
| 49 | 1. **Read Error Messages Carefully** |
| 50 | - Don't skip past errors or warnings |
| 51 | - Read stack traces completely |
| 52 | - Note line numbers, file paths, error codes |
| 53 | |
| 54 | 2. **Reproduce Consistently** |
| 55 | - Can you trigger it reliably? |
| 56 | - What are the exact steps? |
| 57 | - If not reproducible → gather more data, don't guess |
| 58 | |
| 59 | 3. **Check Recent Changes** |
| 60 | - What changed that could cause this? |
| 61 | - Git diff, recent commits |
| 62 | - New dependencies, config changes |
| 63 | |
| 64 | 4. **Gather Evidence** |
| 65 | - Add diagnostic logging at component boundaries |
| 66 | - Log what data enters/exits each layer |
| 67 | - Run once to gather evidence showing WHERE it breaks |
| 68 | |
| 69 | 5. **Trace Data Flow** |
| 70 | - Where does bad value originate? |
| 71 | - What called this with bad value? |
| 72 | - Keep tracing up until you find the source |
| 73 | |
| 74 | ### Phase 2: Pattern Analysis |
| 75 | |
| 76 | 1. Find working examples in the codebase |
| 77 | 2. Compare against references |
| 78 | 3. Identify differences between working and broken |
| 79 | 4. Understand dependencies |
| 80 | |
| 81 | ### Phase 3: Hypothesis and Testing |
| 82 | |
| 83 | 1. Form single hypothesis: "I think X is the root cause because Y" |
| 84 | 2. Test minimally - SMALLEST possible change |
| 85 | 3. Verify before continuing |
| 86 | 4. If didn't work, form NEW hypothesis (don't stack fixes) |
| 87 | |
| 88 | ### Phase 4: Implementation |
| 89 | |
| 90 | 1. Create failing test case FIRST |
| 91 | 2. Implement single fix addressing root cause |
| 92 | 3. Verify fix - test passes, no regressions |
| 93 | 4. If 3+ fixes failed: STOP and question the architecture |
| 94 | |
| 95 | ## Red Flags - STOP If You Think: |
| 96 | |
| 97 | - "Quick fix for now, investigate later" |
| 98 | - "Just try changing X and see if it works" |
| 99 | - "I don't fully understand but this might work" |
| 100 | - "Let me add multiple changes and run tests" |
| 101 | |
| 102 | ALL of these mean: STOP. Return to Phase 1. |
| 103 | |
| 104 | ## Report Format |
| 105 | |
| 106 | When done, report: |
| 107 | |
| 108 | 1. **Root Cause:** What was actually causing the issue |
| 109 | 2. **Evidence:** How you confirmed this was the root cause |
| 110 | 3. **Fix Applied:** The specific change made |
| 111 | 4. **Verification:** How you confirmed it's fixed |
| 112 | 5. **Regression Test:** Test added to prevent recurrence |
| 113 | 6. **Files Changed:** List of modified files |
| 114 | ``` |
| 115 | |
| 116 | ## Usage Example |
| 117 | |
| 118 | ```typescript |
| 119 | Task({ |
| 120 | subagent_type: 'general-purpose', |
| 121 | description: 'Debug: 404 after creating resource', |
| 122 | prompt: `You are debugging an issue. You MUST use the systematic-debugging skill. |
| 123 | |
| 124 | ## The Issue |
| 125 | |
| 126 | After creating a new resource, the redirect to the detail page returns a 404. |
| 127 | The resource appears in the database but the page doesn't load. |
| 128 | |
| 129 | Error in logs: |
| 130 | "Row not found" |
| 131 | |
| 132 | ## Reproduction Steps |
| 133 | |
| 134 | 1. Navigate to /resources/new |
| 135 | 2. Fill in required fields |
| 136 | 3. Click "Create" |
| 137 | 4. Observe 404 error instead of detail page |
| 138 | |
| 139 | ## Environment |
| 140 | |
| 141 | Project: [Your project name and stack] |
| 142 | |
| 143 | ## MANDATORY: Use Systematic Debugging |
| 144 | |
| 145 | [... rest of template ...] |
| 146 | `, |
| 147 | }) |
| 148 | ``` |
| 149 | |
| 150 | ## Debugging Session Flow |
| 151 | |
| 152 | ``` |
| 153 | 1. Subagent receives issue description |
| 154 | 2. Phase 1: Investigate root cause |
| 155 | - Read errors carefully |
| 156 | - Reproduce issue |
| 157 | - Check recent changes |
| 158 | - Add diagnostic logging |
| 159 | - Trace data flow |
| 160 | 3. Phase 2: Pattern analysis |
| 161 | - Find working examples |
| 162 | - Compare differences |
| 163 | 4. Phase 3: Hypothesis testing |
| 164 | - Form single hypothesis |
| 165 | - Test minimally |
| 166 | - Verify or form new hypothesis |
| 167 | 5. Phase 4: Fix implementation |
| 168 | - Create failing test |
| 169 | - Apply single fix |
| 170 | - Verify fix works |
| 171 | 6. Report findings |
| 172 | ``` |
| 173 | |
| 174 | ## When Subagent Gets Stuck |
| 175 | |
| 176 | If the debugger subagent reports: |
| 177 | |
| 178 | - "I've tried 3+ fixes without success" |
| 179 | - "Each fix reveals new problems" |
| 180 | - "This requires architectural changes" |
| 181 | |
| 182 | **STOP** - This indicates an architectural problem, not a bug. |
| 183 | Discuss with your human partner before continuing. |