specweave 0.23.14 → 0.23.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +55 -0
- package/dist/src/core/spec-detector.d.ts +5 -0
- package/dist/src/core/spec-detector.d.ts.map +1 -1
- package/dist/src/core/spec-detector.js +91 -33
- package/dist/src/core/spec-detector.js.map +1 -1
- package/package.json +1 -1
- package/plugins/specweave-github/.claude-plugin/plugin.json +15 -1
- package/plugins/specweave-github/hooks/.specweave/logs/hooks-debug.log +16 -0
- package/plugins/specweave-github/hooks/post-task-completion.sh +53 -0
- package/plugins/specweave-release/hooks/.specweave/logs/dora-tracking.log +24 -0
- package/plugins/specweave-alternatives/.claude-plugin/plugin.json +0 -21
- package/plugins/specweave-alternatives/skills/bmad-method-expert/SKILL.md +0 -626
- package/plugins/specweave-alternatives/skills/bmad-method-expert/scripts/analyze-project.js +0 -318
- package/plugins/specweave-alternatives/skills/bmad-method-expert/scripts/check-setup.js +0 -208
- package/plugins/specweave-alternatives/skills/bmad-method-expert/scripts/generate-template.js +0 -1149
- package/plugins/specweave-alternatives/skills/bmad-method-expert/scripts/validate-documents.js +0 -340
- package/plugins/specweave-alternatives/skills/spec-kit-expert/SKILL.md +0 -1010
- package/plugins/specweave-cost-optimizer/.claude-plugin/plugin.json +0 -20
- package/plugins/specweave-cost-optimizer/skills/cost-optimizer/SKILL.md +0 -190
- package/plugins/specweave-docs/.claude-plugin/plugin.json +0 -19
- package/plugins/specweave-docs/skills/docusaurus/SKILL.md +0 -613
- package/plugins/specweave-docs/skills/spec-driven-brainstorming/README.md +0 -264
- package/plugins/specweave-docs/skills/spec-driven-brainstorming/SKILL.md +0 -439
- package/plugins/specweave-docs/skills/spec-driven-debugging/README.md +0 -479
- package/plugins/specweave-docs/skills/spec-driven-debugging/SKILL.md +0 -652
- package/plugins/specweave-figma/.claude-plugin/.mcp.json +0 -12
- package/plugins/specweave-figma/.claude-plugin/plugin.json +0 -20
- package/plugins/specweave-figma/ARCHITECTURE.md +0 -453
- package/plugins/specweave-figma/README.md +0 -728
- package/plugins/specweave-figma/skills/figma-to-code/SKILL.md +0 -632
- package/plugins/specweave-figma/skills/figma-to-code/test-1-token-generation.yaml +0 -29
- package/plugins/specweave-figma/skills/figma-to-code/test-2-component-generation.yaml +0 -27
- package/plugins/specweave-figma/skills/figma-to-code/test-3-typescript-generation.yaml +0 -28
- package/plugins/specweave-frontend/.claude-plugin/plugin.json +0 -21
- package/plugins/specweave-frontend/skills/design-system-architect/SKILL.md +0 -107
- package/plugins/specweave-frontend/skills/frontend/SKILL.md +0 -177
- package/plugins/specweave-frontend/skills/nextjs/SKILL.md +0 -176
- package/plugins/specweave-testing/.claude-plugin/plugin.json +0 -20
- package/plugins/specweave-testing/skills/e2e-playwright/README.md +0 -506
- package/plugins/specweave-testing/skills/e2e-playwright/SKILL.md +0 -457
- package/plugins/specweave-testing/skills/e2e-playwright/execute.js +0 -373
- package/plugins/specweave-testing/skills/e2e-playwright/lib/utils.js +0 -514
- package/plugins/specweave-testing/skills/e2e-playwright/package.json +0 -33
- package/plugins/specweave-tooling/.claude-plugin/plugin.json +0 -19
- package/plugins/specweave-tooling/skills/skill-creator/LICENSE.txt +0 -202
- package/plugins/specweave-tooling/skills/skill-creator/SKILL.md +0 -209
- package/plugins/specweave-tooling/skills/skill-creator/scripts/init_skill.py +0 -303
- package/plugins/specweave-tooling/skills/skill-creator/scripts/package_skill.py +0 -110
- package/plugins/specweave-tooling/skills/skill-creator/scripts/quick_validate.py +0 -65
- package/plugins/specweave-tooling/skills/skill-router/SKILL.md +0 -479
- package/plugins/specweave-ui/.claude-plugin/plugin.json +0 -26
- package/plugins/specweave-ui/.mcp.json +0 -10
- package/plugins/specweave-ui/README.md +0 -492
- package/plugins/specweave-ui/skills/browser-automation/SKILL.md +0 -676
|
@@ -1,479 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: spec-driven-debugging
|
|
3
|
-
description: Systematic debugging framework integrated with SpecWeave's spec-driven development methodology. Ensures root cause investigation AND spec alignment before proposing fixes. Includes ultrathink mode for complex bugs (31,999 thinking tokens).
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Spec-Driven Debugging Skill
|
|
7
|
-
|
|
8
|
-
## Overview
|
|
9
|
-
|
|
10
|
-
The **spec-driven-debugging** skill extends systematic debugging with SpecWeave's spec-driven development methodology. It ensures that every bug is investigated for root cause AND checked against specifications before proposing fixes.
|
|
11
|
-
|
|
12
|
-
**Core principle:** NO FIXES WITHOUT ROOT CAUSE INVESTIGATION + SPEC ALIGNMENT CHECK
|
|
13
|
-
|
|
14
|
-
This prevents:
|
|
15
|
-
- ❌ Random fixes that waste time
|
|
16
|
-
- ❌ Symptom patches that mask underlying issues
|
|
17
|
-
- ❌ Spec-code divergence
|
|
18
|
-
- ❌ Repeat bugs due to missing regression tests
|
|
19
|
-
- ❌ Architectural issues mistaken for code bugs
|
|
20
|
-
|
|
21
|
-
## Purpose
|
|
22
|
-
|
|
23
|
-
This skill bridges the gap between **"There's a bug"** and **"Bug fixed with full understanding and documentation."**
|
|
24
|
-
|
|
25
|
-
It helps developers:
|
|
26
|
-
- **Investigate systematically** instead of guessing
|
|
27
|
-
- **Verify spec alignment** before fixing code
|
|
28
|
-
- **Create retroactive specs** for brownfield code
|
|
29
|
-
- **Identify architectural issues** vs simple code bugs
|
|
30
|
-
- **Use ultrathink mode** for complex distributed systems bugs
|
|
31
|
-
- **Update living documentation** after every fix
|
|
32
|
-
- **Prevent regressions** with proper test cases
|
|
33
|
-
|
|
34
|
-
## Inspired By
|
|
35
|
-
|
|
36
|
-
This skill is **adapted from** [obra/superpowers systematic-debugging skill](https://github.com/obra/superpowers/tree/main/skills/systematic-debugging) and enhanced for SpecWeave's spec-driven workflow.
|
|
37
|
-
|
|
38
|
-
**Key differences from the original:**
|
|
39
|
-
- ✅ **Phase 0: Context Loading** - Loads spec.md, plan.md, ADRs before investigating
|
|
40
|
-
- ✅ **Spec alignment checks** - Compares behavior vs specification at every phase
|
|
41
|
-
- ✅ **Brownfield support** - Creates retroactive specs for undocumented code
|
|
42
|
-
- ✅ **Ultrathink integration** - Deep reasoning mode (31,999 tokens) for complex bugs
|
|
43
|
-
- ✅ **Multi-level testing** - Creates tests at appropriate level (spec/feature/code/skill)
|
|
44
|
-
- ✅ **Living documentation updates** - Updates spec/plan/tests/ADRs after fix
|
|
45
|
-
- ✅ **Architectural awareness** - Recognizes design issues vs code bugs (triggers after 3 failed fixes)
|
|
46
|
-
- ✅ **SpecWeave agent integration** - Coordinates with Tech Lead, Security, SRE agents
|
|
47
|
-
|
|
48
|
-
## When to Use This Skill
|
|
49
|
-
|
|
50
|
-
### ✅ Use spec-driven-debugging for:
|
|
51
|
-
- **Any bug or test failure** (production or development)
|
|
52
|
-
- **Unexpected behavior** different from spec.md
|
|
53
|
-
- **Performance problems or degradation**
|
|
54
|
-
- **Security vulnerabilities**
|
|
55
|
-
- **Race conditions or concurrency bugs**
|
|
56
|
-
- **Build or deployment failures**
|
|
57
|
-
- **Integration issues between components**
|
|
58
|
-
- **Brownfield code** with no documentation
|
|
59
|
-
- **After 2 failed fix attempts** (3rd requires systematic approach)
|
|
60
|
-
|
|
61
|
-
### ⚠️ ESPECIALLY use when:
|
|
62
|
-
- Under time pressure (emergencies make guessing tempting)
|
|
63
|
-
- "Just one quick fix" seems obvious
|
|
64
|
-
- Previous fix didn't work (don't try fix #4 without this process)
|
|
65
|
-
- You don't fully understand the issue
|
|
66
|
-
- **Behavior differs from spec.md** (spec-code misalignment)
|
|
67
|
-
- **Complex distributed systems** (use ultrathink)
|
|
68
|
-
|
|
69
|
-
### ❌ Never skip when:
|
|
70
|
-
- Issue seems simple (simple bugs need root causes too)
|
|
71
|
-
- You're in a hurry (systematic is faster than thrashing)
|
|
72
|
-
- Manager wants it fixed NOW (prevents rework)
|
|
73
|
-
|
|
74
|
-
## The Five-Phase Framework
|
|
75
|
-
|
|
76
|
-
### Phase 0: Context Loading (SpecWeave-Specific) 🆕
|
|
77
|
-
**BEFORE investigating, understand WHAT SHOULD HAPPEN**
|
|
78
|
-
|
|
79
|
-
1. **Check if bug is in SpecWeave increment**
|
|
80
|
-
- Find increment containing buggy code
|
|
81
|
-
- Load spec.md (WHAT and WHY)
|
|
82
|
-
- Load plan.md (HOW it was designed)
|
|
83
|
-
- Load tests.md (test coverage)
|
|
84
|
-
- Check tasks.md (was this a known issue?)
|
|
85
|
-
|
|
86
|
-
2. **Load architecture context**
|
|
87
|
-
- Read relevant ADRs (design decisions)
|
|
88
|
-
- Understand trade-offs and assumptions
|
|
89
|
-
- Check if requirements evolved since design
|
|
90
|
-
|
|
91
|
-
3. **Classify bug type**
|
|
92
|
-
- **Code bug:** Code doesn't match spec → Fix code
|
|
93
|
-
- **Spec bug:** Spec is wrong/unclear → Update spec first
|
|
94
|
-
- **Missing spec:** Undocumented (brownfield) → Create retroactive spec
|
|
95
|
-
- **Architectural issue:** Design is flawed → Create ADR, refactor
|
|
96
|
-
|
|
97
|
-
4. **🧠 Ultrathink trigger**
|
|
98
|
-
- Complex distributed systems? → Suggest ultrathink
|
|
99
|
-
- Race conditions? → Suggest ultrathink
|
|
100
|
-
- Security vulnerability? → Suggest ultrathink
|
|
101
|
-
|
|
102
|
-
### Phase 1: Root Cause Investigation
|
|
103
|
-
**FIND THE TRUE CAUSE**
|
|
104
|
-
|
|
105
|
-
1. **Read error messages carefully** (don't skip!)
|
|
106
|
-
2. **Reproduce consistently** (exact steps)
|
|
107
|
-
3. **Check recent changes** (git diff, dependencies)
|
|
108
|
-
4. **Compare behavior vs spec.md** (does code match requirements?)
|
|
109
|
-
5. **Add instrumentation** for multi-component systems (log at every boundary)
|
|
110
|
-
6. **Trace data flow** (where does bad value originate?)
|
|
111
|
-
7. **Check for architectural issues** (multiple components affected?)
|
|
112
|
-
|
|
113
|
-
**🧠 If architectural issue detected:** STOP and suggest ultrathink
|
|
114
|
-
|
|
115
|
-
### Phase 2: Pattern Analysis
|
|
116
|
-
**FIND THE PATTERN**
|
|
117
|
-
|
|
118
|
-
1. **Find working examples** in codebase (similar working code)
|
|
119
|
-
2. **Compare against spec and references** (read spec.md completely, check ADRs)
|
|
120
|
-
3. **Identify differences** (what's different between working and broken?)
|
|
121
|
-
4. **Understand dependencies** (what does this need to work?)
|
|
122
|
-
5. **Consult SpecWeave skills** (nextjs, nodejs-backend, python-backend, etc.)
|
|
123
|
-
|
|
124
|
-
### Phase 3: Hypothesis and Testing
|
|
125
|
-
**TEST SCIENTIFICALLY**
|
|
126
|
-
|
|
127
|
-
1. **Form single hypothesis** ("I think X because Y")
|
|
128
|
-
2. **Classify hypothesis** (code bug vs spec bug vs architecture)
|
|
129
|
-
3. **Test minimally** (smallest possible change, one variable)
|
|
130
|
-
4. **Verify before continuing** (did it work? count attempts)
|
|
131
|
-
5. **When you don't know:** Say it! Don't pretend.
|
|
132
|
-
6. **🧠 If 3+ hypotheses failed:** MANDATORY ULTRATHINK
|
|
133
|
-
|
|
134
|
-
**Ultrathink after 3 failures analyzes:**
|
|
135
|
-
- Edge cases thoroughly
|
|
136
|
-
- Architectural implications
|
|
137
|
-
- Race conditions and thread safety
|
|
138
|
-
- Security vulnerabilities
|
|
139
|
-
- Alternative patterns
|
|
140
|
-
|
|
141
|
-
### Phase 4: Implementation (with Spec Alignment)
|
|
142
|
-
**FIX AT THE RIGHT LEVEL**
|
|
143
|
-
|
|
144
|
-
1. **Determine fix level**
|
|
145
|
-
- Code fix → Update code
|
|
146
|
-
- Spec fix → Update spec.md FIRST, then code
|
|
147
|
-
- Test fix → Fix test expectations
|
|
148
|
-
- Architecture fix → Create ADR + new increment for refactor
|
|
149
|
-
|
|
150
|
-
2. **Create failing test** at appropriate level:
|
|
151
|
-
- **Level 1:** Specification tests (TC-0001 in requirements.md)
|
|
152
|
-
- **Level 2:** Feature tests (tests.md in increment)
|
|
153
|
-
- **Level 3:** Code tests (tests/ directory - unit/integration/E2E)
|
|
154
|
-
- **Level 4:** Skill tests (test-cases/ in skill)
|
|
155
|
-
|
|
156
|
-
3. **Update spec if needed** (BEFORE code fix if spec was unclear)
|
|
157
|
-
4. **Implement single fix** (one change, no "while I'm here" improvements)
|
|
158
|
-
5. **Verify fix** (test passes, no other tests broken, spec aligned)
|
|
159
|
-
6. **🧠 If 3+ fixes failed:** MANDATORY ULTRATHINK ARCHITECTURE ANALYSIS
|
|
160
|
-
|
|
161
|
-
**After 3 failed fixes, ultrathink explores:**
|
|
162
|
-
- Is this pattern fundamentally sound?
|
|
163
|
-
- What architectural refactor would eliminate this bug class?
|
|
164
|
-
- Trade-offs of different refactoring approaches
|
|
165
|
-
- Should we create ADR to document decision?
|
|
166
|
-
|
|
167
|
-
7. **Create ADR if architectural decision made**
|
|
168
|
-
|
|
169
|
-
### Phase 5: Living Documentation Update (SpecWeave-Specific) 🆕
|
|
170
|
-
**UPDATE DOCUMENTATION AFTER FIX**
|
|
171
|
-
|
|
172
|
-
1. **Update increment documentation**
|
|
173
|
-
- spec.md (if requirements clarified)
|
|
174
|
-
- plan.md (if implementation changed)
|
|
175
|
-
- tests.md (add regression test)
|
|
176
|
-
- tasks.md (mark complete or add follow-up)
|
|
177
|
-
|
|
178
|
-
2. **Update architecture documentation** (if architectural change)
|
|
179
|
-
- Create ADR (decision, context, consequences)
|
|
180
|
-
- Update system-design.md
|
|
181
|
-
- Update component-design.md
|
|
182
|
-
|
|
183
|
-
3. **Update strategy documentation** (if requirements changed)
|
|
184
|
-
- requirements.md (functional/non-functional)
|
|
185
|
-
- success-criteria.md (acceptance criteria)
|
|
186
|
-
|
|
187
|
-
4. **Create new increment** if fix is substantial (>3 files, breaking change)
|
|
188
|
-
|
|
189
|
-
5. **Commit with proper documentation** (include root cause, solution, spec alignment, test coverage)
|
|
190
|
-
|
|
191
|
-
6. **Update context manifest** (if dependencies changed)
|
|
192
|
-
|
|
193
|
-
## The Iron Law
|
|
194
|
-
|
|
195
|
-
```
|
|
196
|
-
NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST
|
|
197
|
-
NO FIXES WITHOUT CHECKING SPEC ALIGNMENT
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
**New addition:** 3+ failed fixes = MANDATORY ULTRATHINK
|
|
201
|
-
|
|
202
|
-
If you haven't completed Phase 0 and Phase 1, you cannot propose fixes.
|
|
203
|
-
|
|
204
|
-
## Ultrathink Debugging Mode 🧠
|
|
205
|
-
|
|
206
|
-
**What is Ultrathink?**
|
|
207
|
-
- Allocates **31,999 thinking tokens** for deep analysis
|
|
208
|
-
- Most powerful thinking mode available in Claude Code
|
|
209
|
-
- Enables comprehensive edge case exploration and architectural evaluation
|
|
210
|
-
|
|
211
|
-
**When to Use Ultrathink:**
|
|
212
|
-
|
|
213
|
-
**Mandatory (automatic activation):**
|
|
214
|
-
- ✅ After 3 failed fix attempts (architectural issue)
|
|
215
|
-
- ✅ Security vulnerability requiring threat modeling
|
|
216
|
-
- ✅ Distributed systems consensus/consistency bugs
|
|
217
|
-
|
|
218
|
-
**Suggested (agent recommends):**
|
|
219
|
-
- ⚠️ Race conditions or concurrency bugs
|
|
220
|
-
- ⚠️ Memory leaks or performance degradation
|
|
221
|
-
- ⚠️ Complex data flow across many components
|
|
222
|
-
- ⚠️ Novel bug patterns not seen before
|
|
223
|
-
- ⚠️ Brownfield code with no documentation
|
|
224
|
-
|
|
225
|
-
**How to Activate:**
|
|
226
|
-
|
|
227
|
-
**User requests:**
|
|
228
|
-
```
|
|
229
|
-
User: "This bug is complex - can you ultrathink it?"
|
|
230
|
-
```
|
|
231
|
-
|
|
232
|
-
**Agent suggests (after 3 failed fixes):**
|
|
233
|
-
```
|
|
234
|
-
Assistant: "After 3 failed fixes, this is an architectural issue.
|
|
235
|
-
Let me **ultrathink** this to analyze:
|
|
236
|
-
- Alternative architectural patterns
|
|
237
|
-
- Race condition analysis across all components
|
|
238
|
-
- Edge cases in distributed system
|
|
239
|
-
- Security implications
|
|
240
|
-
- Refactoring strategies with trade-offs
|
|
241
|
-
"
|
|
242
|
-
```
|
|
243
|
-
|
|
244
|
-
**Ultrathink Analysis Includes:**
|
|
245
|
-
- ✅ Full call stack analysis (every function, parameter, state)
|
|
246
|
-
- ✅ Concurrency analysis (thread safety, deadlocks, race conditions)
|
|
247
|
-
- ✅ Data flow analysis (every transformation, validation)
|
|
248
|
-
- ✅ Edge case exploration (boundary conditions, error paths)
|
|
249
|
-
- ✅ Architectural pattern evaluation (current vs alternatives)
|
|
250
|
-
- ✅ Security threat modeling (STRIDE, attack vectors)
|
|
251
|
-
- ✅ Performance bottleneck identification
|
|
252
|
-
|
|
253
|
-
**Thinking Token Levels:**
|
|
254
|
-
- `think` - 4,000 tokens (simple problems)
|
|
255
|
-
- `megathink` - 10,000 tokens (moderate complexity)
|
|
256
|
-
- `ultrathink` - 31,999 tokens (high complexity) ← **For complex debugging**
|
|
257
|
-
|
|
258
|
-
## Bug Types and Fix Strategies
|
|
259
|
-
|
|
260
|
-
| Bug Type | Detection | Fix Strategy | Documentation |
|
|
261
|
-
|----------|-----------|--------------|---------------|
|
|
262
|
-
| **Code Bug** | Spec clear, code wrong | Fix code to match spec | Update tests.md |
|
|
263
|
-
| **Spec Bug** | Code correct, spec unclear | Update spec.md FIRST, then code | Update spec.md, plan.md, tests.md |
|
|
264
|
-
| **Missing Spec** | Behavior undocumented (brownfield) | Create retroactive spec, decide if correct | Create increment with spec |
|
|
265
|
-
| **Architectural Bug** | Design flawed, 3+ fixes failed | **Ultrathink** → Create ADR → Refactor | Create ADR, update architecture docs |
|
|
266
|
-
| **Test Bug** | Code & spec correct, test wrong | Fix test expectations | Update tests.md |
|
|
267
|
-
|
|
268
|
-
## Test Cases
|
|
269
|
-
|
|
270
|
-
This skill includes **3 comprehensive test cases**:
|
|
271
|
-
|
|
272
|
-
### TC-001: Simple Authentication Bug with Spec Alignment
|
|
273
|
-
- **Scenario:** Login failing with "401 Unauthorized" even with correct credentials
|
|
274
|
-
- **Root cause:** bcrypt.compare() arguments reversed
|
|
275
|
-
- **Focus:** Spec alignment check, data flow tracing, simple fix
|
|
276
|
-
- **Phases:** Context loading → Root cause → Pattern analysis → Single hypothesis → Fixed first try
|
|
277
|
-
- **Complexity:** Low (code bug)
|
|
278
|
-
- **Time:** 15-20 minutes
|
|
279
|
-
|
|
280
|
-
### TC-002: Race Condition Bug Requiring Ultrathink
|
|
281
|
-
- **Scenario:** Task queue occasionally processes same task twice (violates exactly-once delivery)
|
|
282
|
-
- **Root cause:** Race condition between Redis lock and DB idempotency check
|
|
283
|
-
- **Focus:** Deep ultrathink analysis, architectural refactoring, ADR creation
|
|
284
|
-
- **Phases:** Context loading → 3 failed hypotheses → **ULTRATHINK** → Architectural fix → ADR
|
|
285
|
-
- **Complexity:** High (distributed systems, concurrency)
|
|
286
|
-
- **Time:** 45-60 minutes (includes ultrathink)
|
|
287
|
-
- **Ultrathink findings:**
|
|
288
|
-
- Analyzed 3 alternative architectures
|
|
289
|
-
- Identified fundamental design flaw (two separate consistency mechanisms)
|
|
290
|
-
- Recommended hybrid approach (Redis pre-filter + DB source of truth)
|
|
291
|
-
|
|
292
|
-
### TC-003: Brownfield Bug with Missing Spec
|
|
293
|
-
- **Scenario:** Payment webhook randomly failing with "Invalid signature" (20% failure rate)
|
|
294
|
-
- **Root cause:** Express middleware parsing large webhook bodies (>5mb) as JSON
|
|
295
|
-
- **Focus:** Retroactive spec creation, brownfield documentation, middleware configuration
|
|
296
|
-
- **Phases:** No spec found → Create retroactive spec → Debug with spec → Fix → Full documentation
|
|
297
|
-
- **Complexity:** Medium (brownfield, requires business context gathering)
|
|
298
|
-
- **Time:** 30-40 minutes
|
|
299
|
-
- **Documentation created:**
|
|
300
|
-
- Retroactive spec.md, plan.md, tests.md
|
|
301
|
-
- ADR-0013 for webhook middleware pattern
|
|
302
|
-
- Strategy doc for payment webhooks
|
|
303
|
-
|
|
304
|
-
## Red Flags - When You're Violating the Process
|
|
305
|
-
|
|
306
|
-
**STOP immediately if you catch yourself thinking:**
|
|
307
|
-
- ❌ "Quick fix for now, investigate later"
|
|
308
|
-
- ❌ "Just try changing X and see if it works"
|
|
309
|
-
- ❌ "Add multiple changes, run tests"
|
|
310
|
-
- ❌ "Skip the test, I'll manually verify"
|
|
311
|
-
- ❌ "I don't fully understand but this might work"
|
|
312
|
-
- ❌ Proposing solutions before tracing data flow
|
|
313
|
-
- ❌ **Proposing code fix before checking spec.md**
|
|
314
|
-
- ❌ **"One more fix attempt" (after 2 failures) WITHOUT ultrathinking**
|
|
315
|
-
- ❌ **Each fix reveals new problem in different place** (architectural issue!)
|
|
316
|
-
|
|
317
|
-
**ALL of these mean:** STOP. Return to Phase 0 and Phase 1.
|
|
318
|
-
|
|
319
|
-
**If 3+ fixes failed:** MANDATORY ultrathink (not optional)
|
|
320
|
-
|
|
321
|
-
## Integration with SpecWeave
|
|
322
|
-
|
|
323
|
-
### Relationship to Other Skills
|
|
324
|
-
|
|
325
|
-
**This skill coordinates with:**
|
|
326
|
-
- **increment-planner** - Create new increment for large fixes or retroactive specs
|
|
327
|
-
- **e2e-playwright** - Create E2E tests for UI bugs
|
|
328
|
-
- **nextjs** / **nodejs-backend** / **python-backend** / **dotnet-backend** - Domain-specific debugging patterns
|
|
329
|
-
- **frontend** - React/Vue/Angular debugging patterns
|
|
330
|
-
- **diagrams-architect** - Create sequence diagrams for complex data flow
|
|
331
|
-
- **context-loader** - Load relevant context for bug investigation
|
|
332
|
-
|
|
333
|
-
### Relationship to SpecWeave Agents
|
|
334
|
-
|
|
335
|
-
**This skill may invoke:**
|
|
336
|
-
- **tech-lead** agent - Code review of complex fixes
|
|
337
|
-
- **security** agent - Security vulnerability analysis (use ultrathink)
|
|
338
|
-
- **sre** agent - Production incident investigation
|
|
339
|
-
- **architect** agent - Architectural refactoring proposals (after 3 failed fixes + ultrathink)
|
|
340
|
-
- **qa-lead** agent - Test strategy for regression prevention
|
|
341
|
-
|
|
342
|
-
### Documentation Flow
|
|
343
|
-
|
|
344
|
-
```
|
|
345
|
-
Bug reported
|
|
346
|
-
↓
|
|
347
|
-
Phase 0: Load context (spec.md, plan.md, ADRs)
|
|
348
|
-
↓ (understand WHAT SHOULD HAPPEN)
|
|
349
|
-
Phase 1-3: Investigate, analyze, test hypothesis
|
|
350
|
-
↓ (find root cause, test scientifically)
|
|
351
|
-
Phase 4: Implement fix at right level (code/spec/architecture)
|
|
352
|
-
↓ (create test, fix, verify)
|
|
353
|
-
Phase 5: Update living docs
|
|
354
|
-
├─ spec.md (if requirements clarified)
|
|
355
|
-
├─ plan.md (if implementation changed)
|
|
356
|
-
├─ tests.md (add regression test)
|
|
357
|
-
├─ ADR (if architectural decision)
|
|
358
|
-
└─ Commit with full documentation
|
|
359
|
-
```
|
|
360
|
-
|
|
361
|
-
## Key Principles
|
|
362
|
-
|
|
363
|
-
| Principle | Application |
|
|
364
|
-
|-----------|-------------|
|
|
365
|
-
| **Root cause first** | NEVER fix symptoms, always find true cause |
|
|
366
|
-
| **Spec alignment** | Check spec.md before assuming code is wrong |
|
|
367
|
-
| **Scientific method** | Form hypothesis, test minimally, verify |
|
|
368
|
-
| **One change at a time** | No bundled fixes (can't isolate what worked) |
|
|
369
|
-
| **Test before fix** | Failing test proves you caught the bug |
|
|
370
|
-
| **Count attempts** | After 3 failures → ultrathink required |
|
|
371
|
-
| **Brownfield support** | Create retroactive spec before debugging |
|
|
372
|
-
| **Living documentation** | Update docs after every fix |
|
|
373
|
-
| **Ultrathink for complexity** | Use 31,999 thinking tokens for hard bugs |
|
|
374
|
-
|
|
375
|
-
## Common Rationalizations (Don't Fall for These!)
|
|
376
|
-
|
|
377
|
-
| Excuse | Reality | What to Do |
|
|
378
|
-
|--------|---------|-----------|
|
|
379
|
-
| "Issue is simple, don't need process" | Simple bugs have root causes too | Follow process (it's fast for simple bugs) |
|
|
380
|
-
| "Emergency, no time for process" | Systematic is FASTER than thrashing | Use process to avoid wasted hours |
|
|
381
|
-
| "Just try this first, investigate later" | First fix sets bad pattern | Do it right from start |
|
|
382
|
-
| "I'll write test after fix works" | Untested fixes don't stick | Test first, proves you caught it |
|
|
383
|
-
| "Multiple fixes save time" | Can't isolate what worked | One change at a time |
|
|
384
|
-
| "Spec is probably right, no need to check" | Specs can be wrong | Always verify spec alignment |
|
|
385
|
-
| **"One more fix" (after 2+ failures)** | 3+ = architectural problem | **ULTRATHINK REQUIRED** |
|
|
386
|
-
| **"Ultrathink is overkill"** | If 3+ fixes failed, it's NOT | Use 31,999 tokens to understand |
|
|
387
|
-
|
|
388
|
-
## Anti-Patterns to Avoid
|
|
389
|
-
|
|
390
|
-
| Anti-Pattern | Why It's Bad | What to Do Instead |
|
|
391
|
-
|--------------|--------------|-------------------|
|
|
392
|
-
| Skipping Phase 0 | Don't know what SHOULD happen | Load spec.md, plan.md, ADRs first |
|
|
393
|
-
| Proposing fixes immediately | Random guessing wastes time | Complete Phase 1 investigation |
|
|
394
|
-
| Testing multiple changes | Can't isolate root cause | One variable at a time |
|
|
395
|
-
| Skipping test creation | Can't verify fix, might regress | Create failing test first |
|
|
396
|
-
| Ignoring spec misalignment | Spec-code divergence grows | Update spec if unclear |
|
|
397
|
-
| Continuing after 3 failures | Architectural issue unrecognized | STOP and ultrathink |
|
|
398
|
-
| Not updating documentation | Knowledge lost, bugs repeat | Phase 5: Update living docs |
|
|
399
|
-
|
|
400
|
-
## Real-World Impact
|
|
401
|
-
|
|
402
|
-
From debugging sessions using this framework:
|
|
403
|
-
|
|
404
|
-
**Systematic + SpecWeave approach:**
|
|
405
|
-
- ⏱️ **Time to fix:** 15-30 minutes (with full documentation)
|
|
406
|
-
- ✅ **First-time fix rate:** 95%
|
|
407
|
-
- 📚 **Documentation:** Spec/plan/tests updated
|
|
408
|
-
- 🔁 **Regressions:** Near zero (tests prevent)
|
|
409
|
-
- 🏗️ **Architecture:** Issues identified early
|
|
410
|
-
|
|
411
|
-
**Random fixes approach (old way):**
|
|
412
|
-
- ⏱️ **Time to fix:** 2-3 hours of thrashing
|
|
413
|
-
- ❌ **First-time fix rate:** 40%
|
|
414
|
-
- 📚 **Documentation:** None (divergence grows)
|
|
415
|
-
- 🔁 **Regressions:** Common (no tests)
|
|
416
|
-
- 🏗️ **Architecture:** Issues accumulate
|
|
417
|
-
|
|
418
|
-
**Ultrathink for complex bugs:**
|
|
419
|
-
- ⏱️ **Time:** 30-45 minutes deep analysis
|
|
420
|
-
- 🧠 **Alternative:** Days of random attempts
|
|
421
|
-
- 🎯 **Success rate:** Identifies architectural issues that would take weeks to find
|
|
422
|
-
|
|
423
|
-
## Installation
|
|
424
|
-
|
|
425
|
-
This skill is part of the SpecWeave framework. To install:
|
|
426
|
-
|
|
427
|
-
```bash
|
|
428
|
-
# From SpecWeave project root:
|
|
429
|
-
npm run install:skills
|
|
430
|
-
|
|
431
|
-
# Or install this specific skill to .claude/ (local project):
|
|
432
|
-
cp -r src/skills/spec-driven-debugging ~/.claude/skills/
|
|
433
|
-
|
|
434
|
-
# Restart Claude Code after installation
|
|
435
|
-
```
|
|
436
|
-
|
|
437
|
-
## Activation Triggers
|
|
438
|
-
|
|
439
|
-
This skill activates automatically when users say:
|
|
440
|
-
- "This bug is failing..."
|
|
441
|
-
- "Why is [feature] not working?"
|
|
442
|
-
- "Help me debug [problem]"
|
|
443
|
-
- "Test is failing with [error]"
|
|
444
|
-
- "Investigate [unexpected behavior]"
|
|
445
|
-
- "Ultrathink this bug" (activates deep reasoning mode)
|
|
446
|
-
- "Fix [issue]" (automatically applies systematic debugging)
|
|
447
|
-
|
|
448
|
-
## Contributing
|
|
449
|
-
|
|
450
|
-
This skill is part of the SpecWeave framework. To contribute:
|
|
451
|
-
|
|
452
|
-
1. **Edit the source:** `src/skills/spec-driven-debugging/SKILL.md`
|
|
453
|
-
2. **Update test cases:** Add `.yaml` files to `test-cases/` directory
|
|
454
|
-
3. **Test the skill:** Use SpecWeave's skill testing framework
|
|
455
|
-
4. **Run installation:** `npm run install:skills` to sync to `.claude/`
|
|
456
|
-
5. **Create PR:** Follow SpecWeave's contribution guidelines
|
|
457
|
-
|
|
458
|
-
## License
|
|
459
|
-
|
|
460
|
-
This skill is part of SpecWeave and licensed under [LICENSE].
|
|
461
|
-
|
|
462
|
-
**Acknowledgment:** Adapted from [obra/superpowers systematic-debugging skill](https://github.com/obra/superpowers) by Jesse Vincent. Thank you to the superpowers project for the excellent systematic debugging framework!
|
|
463
|
-
|
|
464
|
-
## Summary
|
|
465
|
-
|
|
466
|
-
**spec-driven-debugging** extends systematic debugging with SpecWeave's spec-driven methodology:
|
|
467
|
-
|
|
468
|
-
1. ✅ **The Iron Law:** NO FIXES WITHOUT ROOT CAUSE + SPEC ALIGNMENT CHECK
|
|
469
|
-
2. ✅ **Phase 0: Context loading** - Load specs, ADRs, increment docs FIRST
|
|
470
|
-
3. ✅ **Spec alignment checks** - Verify behavior matches requirements
|
|
471
|
-
4. ✅ **Brownfield support** - Create retroactive specs for undocumented code
|
|
472
|
-
5. ✅ **Multi-level testing** - Create tests at appropriate level (spec/feature/code/skill)
|
|
473
|
-
6. ✅ **Ultrathink mode** - Deep analysis (31,999 tokens) for complex bugs
|
|
474
|
-
7. ✅ **Architectural awareness** - Recognize design issues vs code bugs
|
|
475
|
-
8. ✅ **Mandatory ultrathink** - After 3 failed fixes (not optional!)
|
|
476
|
-
9. ✅ **Living documentation** - Update spec/plan/tests/ADRs after every fix
|
|
477
|
-
10. ✅ **SpecWeave integration** - Coordinates with agents and skills
|
|
478
|
-
|
|
479
|
-
**Result:** Bugs fixed correctly the first time, with full understanding, proper tests, and updated documentation. No guessing, no rework, no spec-code divergence.
|