@qball-inc/the-bulwark 1.0.0

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.
Files changed (175) hide show
  1. package/.claude-plugin/plugin.json +43 -0
  2. package/agents/bulwark-fix-validator.md +633 -0
  3. package/agents/bulwark-implementer.md +391 -0
  4. package/agents/bulwark-issue-analyzer.md +308 -0
  5. package/agents/bulwark-standards-reviewer.md +221 -0
  6. package/agents/plan-creation-architect.md +323 -0
  7. package/agents/plan-creation-eng-lead.md +352 -0
  8. package/agents/plan-creation-po.md +300 -0
  9. package/agents/plan-creation-qa-critic.md +334 -0
  10. package/agents/product-ideation-competitive-analyzer.md +298 -0
  11. package/agents/product-ideation-idea-validator.md +268 -0
  12. package/agents/product-ideation-market-researcher.md +292 -0
  13. package/agents/product-ideation-pattern-documenter.md +308 -0
  14. package/agents/product-ideation-segment-analyzer.md +303 -0
  15. package/agents/product-ideation-strategist.md +259 -0
  16. package/agents/statusline-setup.md +97 -0
  17. package/hooks/hooks.json +59 -0
  18. package/package.json +45 -0
  19. package/scripts/hooks/cleanup-stale.sh +13 -0
  20. package/scripts/hooks/enforce-quality.sh +166 -0
  21. package/scripts/hooks/implementer-quality.sh +256 -0
  22. package/scripts/hooks/inject-protocol.sh +52 -0
  23. package/scripts/hooks/suggest-pipeline.sh +175 -0
  24. package/scripts/hooks/track-pipeline-start.sh +37 -0
  25. package/scripts/hooks/track-pipeline-stop.sh +52 -0
  26. package/scripts/init-rules.sh +35 -0
  27. package/scripts/init.sh +151 -0
  28. package/skills/anthropic-validator/SKILL.md +607 -0
  29. package/skills/anthropic-validator/references/agents-checklist.md +131 -0
  30. package/skills/anthropic-validator/references/commands-checklist.md +102 -0
  31. package/skills/anthropic-validator/references/hooks-checklist.md +151 -0
  32. package/skills/anthropic-validator/references/mcp-checklist.md +136 -0
  33. package/skills/anthropic-validator/references/plugins-checklist.md +148 -0
  34. package/skills/anthropic-validator/references/skills-checklist.md +85 -0
  35. package/skills/assertion-patterns/SKILL.md +296 -0
  36. package/skills/bug-magnet-data/SKILL.md +284 -0
  37. package/skills/bug-magnet-data/context/cli-args.md +91 -0
  38. package/skills/bug-magnet-data/context/db-query.md +104 -0
  39. package/skills/bug-magnet-data/context/file-contents.md +103 -0
  40. package/skills/bug-magnet-data/context/http-body.md +91 -0
  41. package/skills/bug-magnet-data/context/process-spawn.md +123 -0
  42. package/skills/bug-magnet-data/data/booleans/boundaries.yaml +143 -0
  43. package/skills/bug-magnet-data/data/collections/arrays.yaml +114 -0
  44. package/skills/bug-magnet-data/data/collections/objects.yaml +123 -0
  45. package/skills/bug-magnet-data/data/concurrency/race-conditions.yaml +118 -0
  46. package/skills/bug-magnet-data/data/concurrency/state-machines.yaml +115 -0
  47. package/skills/bug-magnet-data/data/dates/boundaries.yaml +137 -0
  48. package/skills/bug-magnet-data/data/dates/invalid.yaml +132 -0
  49. package/skills/bug-magnet-data/data/dates/timezone.yaml +118 -0
  50. package/skills/bug-magnet-data/data/encoding/charset.yaml +79 -0
  51. package/skills/bug-magnet-data/data/encoding/normalization.yaml +105 -0
  52. package/skills/bug-magnet-data/data/formats/email.yaml +154 -0
  53. package/skills/bug-magnet-data/data/formats/json.yaml +187 -0
  54. package/skills/bug-magnet-data/data/formats/url.yaml +165 -0
  55. package/skills/bug-magnet-data/data/language-specific/javascript.yaml +182 -0
  56. package/skills/bug-magnet-data/data/language-specific/python.yaml +174 -0
  57. package/skills/bug-magnet-data/data/language-specific/rust.yaml +148 -0
  58. package/skills/bug-magnet-data/data/numbers/boundaries.yaml +161 -0
  59. package/skills/bug-magnet-data/data/numbers/precision.yaml +89 -0
  60. package/skills/bug-magnet-data/data/numbers/special.yaml +69 -0
  61. package/skills/bug-magnet-data/data/strings/boundaries.yaml +109 -0
  62. package/skills/bug-magnet-data/data/strings/injection.yaml +208 -0
  63. package/skills/bug-magnet-data/data/strings/special-chars.yaml +190 -0
  64. package/skills/bug-magnet-data/data/strings/unicode.yaml +139 -0
  65. package/skills/bug-magnet-data/references/external-lists.md +115 -0
  66. package/skills/bulwark-brainstorm/SKILL.md +563 -0
  67. package/skills/bulwark-brainstorm/references/at-teammate-prompts.md +60 -0
  68. package/skills/bulwark-brainstorm/references/role-critical-analyst.md +78 -0
  69. package/skills/bulwark-brainstorm/references/role-development-lead.md +66 -0
  70. package/skills/bulwark-brainstorm/references/role-product-delivery-lead.md +79 -0
  71. package/skills/bulwark-brainstorm/references/role-product-manager.md +62 -0
  72. package/skills/bulwark-brainstorm/references/role-project-sme.md +59 -0
  73. package/skills/bulwark-brainstorm/references/role-technical-architect.md +66 -0
  74. package/skills/bulwark-research/SKILL.md +298 -0
  75. package/skills/bulwark-research/references/viewpoint-contrarian.md +63 -0
  76. package/skills/bulwark-research/references/viewpoint-direct-investigation.md +62 -0
  77. package/skills/bulwark-research/references/viewpoint-first-principles.md +65 -0
  78. package/skills/bulwark-research/references/viewpoint-practitioner.md +62 -0
  79. package/skills/bulwark-research/references/viewpoint-prior-art.md +66 -0
  80. package/skills/bulwark-scaffold/SKILL.md +330 -0
  81. package/skills/bulwark-statusline/SKILL.md +161 -0
  82. package/skills/bulwark-statusline/scripts/statusline.sh +144 -0
  83. package/skills/bulwark-verify/SKILL.md +519 -0
  84. package/skills/code-review/SKILL.md +428 -0
  85. package/skills/code-review/examples/anti-patterns/linting.ts +181 -0
  86. package/skills/code-review/examples/anti-patterns/security.ts +91 -0
  87. package/skills/code-review/examples/anti-patterns/standards.ts +195 -0
  88. package/skills/code-review/examples/anti-patterns/type-safety.ts +108 -0
  89. package/skills/code-review/examples/recommended/linting.ts +195 -0
  90. package/skills/code-review/examples/recommended/security.ts +154 -0
  91. package/skills/code-review/examples/recommended/standards.ts +231 -0
  92. package/skills/code-review/examples/recommended/type-safety.ts +181 -0
  93. package/skills/code-review/frameworks/angular.md +218 -0
  94. package/skills/code-review/frameworks/django.md +235 -0
  95. package/skills/code-review/frameworks/express.md +207 -0
  96. package/skills/code-review/frameworks/flask.md +298 -0
  97. package/skills/code-review/frameworks/generic.md +146 -0
  98. package/skills/code-review/frameworks/react.md +152 -0
  99. package/skills/code-review/frameworks/vue.md +244 -0
  100. package/skills/code-review/references/linting-patterns.md +221 -0
  101. package/skills/code-review/references/security-patterns.md +125 -0
  102. package/skills/code-review/references/standards-patterns.md +246 -0
  103. package/skills/code-review/references/type-safety-patterns.md +130 -0
  104. package/skills/component-patterns/SKILL.md +131 -0
  105. package/skills/component-patterns/references/pattern-cli-command.md +118 -0
  106. package/skills/component-patterns/references/pattern-database.md +166 -0
  107. package/skills/component-patterns/references/pattern-external-api.md +139 -0
  108. package/skills/component-patterns/references/pattern-file-parser.md +168 -0
  109. package/skills/component-patterns/references/pattern-http-server.md +162 -0
  110. package/skills/component-patterns/references/pattern-process-spawner.md +133 -0
  111. package/skills/continuous-feedback/SKILL.md +327 -0
  112. package/skills/continuous-feedback/references/collect-instructions.md +81 -0
  113. package/skills/continuous-feedback/references/specialize-code-review.md +82 -0
  114. package/skills/continuous-feedback/references/specialize-general.md +98 -0
  115. package/skills/continuous-feedback/references/specialize-test-audit.md +81 -0
  116. package/skills/create-skill/SKILL.md +359 -0
  117. package/skills/create-skill/references/agent-conventions.md +194 -0
  118. package/skills/create-skill/references/agent-template.md +195 -0
  119. package/skills/create-skill/references/content-guidance.md +291 -0
  120. package/skills/create-skill/references/decision-framework.md +124 -0
  121. package/skills/create-skill/references/template-pipeline.md +217 -0
  122. package/skills/create-skill/references/template-reference-heavy.md +111 -0
  123. package/skills/create-skill/references/template-research.md +210 -0
  124. package/skills/create-skill/references/template-script-driven.md +172 -0
  125. package/skills/create-skill/references/template-simple.md +80 -0
  126. package/skills/create-subagent/SKILL.md +353 -0
  127. package/skills/create-subagent/references/agent-conventions.md +268 -0
  128. package/skills/create-subagent/references/content-guidance.md +232 -0
  129. package/skills/create-subagent/references/decision-framework.md +134 -0
  130. package/skills/create-subagent/references/template-single-agent.md +192 -0
  131. package/skills/fix-bug/SKILL.md +241 -0
  132. package/skills/governance-protocol/SKILL.md +116 -0
  133. package/skills/init/SKILL.md +341 -0
  134. package/skills/issue-debugging/SKILL.md +385 -0
  135. package/skills/issue-debugging/references/anti-patterns.md +245 -0
  136. package/skills/issue-debugging/references/debug-report-schema.md +227 -0
  137. package/skills/mock-detection/SKILL.md +511 -0
  138. package/skills/mock-detection/references/false-positive-prevention.md +402 -0
  139. package/skills/mock-detection/references/stub-patterns.md +236 -0
  140. package/skills/pipeline-templates/SKILL.md +215 -0
  141. package/skills/pipeline-templates/references/code-change-workflow.md +277 -0
  142. package/skills/pipeline-templates/references/code-review.md +336 -0
  143. package/skills/pipeline-templates/references/fix-validation.md +421 -0
  144. package/skills/pipeline-templates/references/new-feature.md +335 -0
  145. package/skills/pipeline-templates/references/research-brainstorm.md +161 -0
  146. package/skills/pipeline-templates/references/research-planning.md +257 -0
  147. package/skills/pipeline-templates/references/test-audit.md +389 -0
  148. package/skills/pipeline-templates/references/test-execution-fix.md +238 -0
  149. package/skills/plan-creation/SKILL.md +497 -0
  150. package/skills/product-ideation/SKILL.md +372 -0
  151. package/skills/product-ideation/references/analysis-frameworks.md +161 -0
  152. package/skills/session-handoff/SKILL.md +139 -0
  153. package/skills/session-handoff/references/examples.md +223 -0
  154. package/skills/setup-lsp/SKILL.md +312 -0
  155. package/skills/setup-lsp/references/server-registry.md +85 -0
  156. package/skills/setup-lsp/references/troubleshooting.md +135 -0
  157. package/skills/subagent-output-templating/SKILL.md +415 -0
  158. package/skills/subagent-output-templating/references/examples.md +440 -0
  159. package/skills/subagent-prompting/SKILL.md +364 -0
  160. package/skills/subagent-prompting/references/examples.md +342 -0
  161. package/skills/test-audit/SKILL.md +531 -0
  162. package/skills/test-audit/references/known-limitations.md +41 -0
  163. package/skills/test-audit/references/priority-classification.md +30 -0
  164. package/skills/test-audit/references/prompts/deep-mode-detection.md +83 -0
  165. package/skills/test-audit/references/prompts/synthesis.md +57 -0
  166. package/skills/test-audit/references/rewrite-instructions.md +46 -0
  167. package/skills/test-audit/references/schemas/audit-output.yaml +100 -0
  168. package/skills/test-audit/references/schemas/diagnostic-output.yaml +49 -0
  169. package/skills/test-audit/scripts/data-flow-analyzer.ts +509 -0
  170. package/skills/test-audit/scripts/integration-mock-detector.ts +462 -0
  171. package/skills/test-audit/scripts/package.json +20 -0
  172. package/skills/test-audit/scripts/skip-detector.ts +211 -0
  173. package/skills/test-audit/scripts/verification-counter.ts +295 -0
  174. package/skills/test-classification/SKILL.md +310 -0
  175. package/skills/test-fixture-creation/SKILL.md +295 -0
@@ -0,0 +1,385 @@
1
+ ---
2
+ name: issue-debugging
3
+ description: Systematic methodology for issue debugging including root cause analysis, impact mapping, tiered validation plans, and confidence assessment. Use when analyzing bugs, fixing issues, or validating fixes.
4
+ user-invocable: false
5
+ ---
6
+
7
+ # Issue Debugging
8
+
9
+ Systematic methodology for debugging that prevents the "first error fix and declare done" anti-pattern. Ensures root cause analysis, impact assessment, and verified fixes.
10
+
11
+ ---
12
+
13
+ ## When to Use This Skill
14
+
15
+ **Load this skill when the user request matches ANY of these patterns:**
16
+
17
+ | Trigger Pattern | Example User Request |
18
+ |-----------------|---------------------|
19
+ | Bug investigation | "Why is X failing?", "Debug this error", "Investigate this issue" |
20
+ | Test failures | "Tests are failing", "Fix the broken tests", "Why did CI fail?" |
21
+ | Error analysis | "Getting this error...", "Exception in...", "Stack trace shows..." |
22
+ | Regression hunting | "This used to work", "Something broke after...", "Regression in..." |
23
+ | Fix validation | "Did the fix work?", "Verify this change", "Make sure it's fixed" |
24
+ | Root cause requests | "What's causing this?", "Find the root cause", "Why does this happen?" |
25
+
26
+ **DO NOT use for:**
27
+ - New feature implementation (no existing bug)
28
+ - Refactoring without reported issues
29
+ - General code questions
30
+
31
+ ---
32
+
33
+ ## Overview
34
+
35
+ ### The Problem
36
+
37
+ AI (and developers) often fix the first visible error and declare victory without verifying end-user functionality works. This leads to:
38
+ - Symptom fixes instead of root cause fixes
39
+ - Regressions in seemingly unrelated areas
40
+ - False confidence in fix completeness
41
+
42
+ ### The Solution
43
+
44
+ This skill provides:
45
+ 1. **Root Cause Analysis** - Find the actual cause, not just symptoms
46
+ 2. **Impact Analysis** - Map affected areas and dependencies
47
+ 3. **Validation Planning** - Tiered test priorities (P1/P2/P3)
48
+ 4. **Confidence Assessment** - Objective fix reliability rating
49
+ 5. **Escalation Triggers** - When manual testing is required
50
+
51
+ ---
52
+
53
+ ## Root Cause Analysis
54
+
55
+ ### The 5 Whys Method
56
+
57
+ Iteratively ask "Why?" to drill past symptoms to root cause:
58
+
59
+ ```
60
+ Problem: Login fails with 500 error
61
+ ├─ Why? → API returns null for user profile
62
+ ├─ Why? → Database query found no records
63
+ ├─ Why? → Migration didn't run on deploy
64
+ ├─ Why? → Deployment script skipped migration step
65
+ └─ Why? → Environment variable missing
66
+
67
+ Root Cause: Missing environment variable (not the 500 error)
68
+ ```
69
+
70
+ **Key Principle**: Focus on HOW and WHY the defect occurred, not just WHERE.
71
+
72
+ ### Hypothesis-Driven Debugging
73
+
74
+ Apply scientific method:
75
+
76
+ | Step | Action |
77
+ |------|--------|
78
+ | **Observe** | Gather data: errors, logs, stack traces, reproduction steps |
79
+ | **Hypothesize** | Form a **falsifiable** hypothesis about the cause |
80
+ | **Experiment** | Design tests to prove/disprove hypothesis |
81
+ | **Conclude** | If confirmed, proceed. If rejected, form new hypothesis |
82
+ | **Document** | Write down hypotheses tested (prevents circular investigation) |
83
+
84
+ ### Binary Search / Bisection
85
+
86
+ For isolating bugs in time or space:
87
+ 1. Place checkpoint at midpoint
88
+ 2. Determine if bug is before or after
89
+ 3. Repeat on remaining half
90
+ 4. Continue until exact location found
91
+
92
+ **Efficiency**: O(log n) - approximately 7 tests for 100 commits.
93
+
94
+ ---
95
+
96
+ ## Impact / Dependency Analysis
97
+
98
+ ### Mapping Procedure
99
+
100
+ For each affected file, identify:
101
+
102
+ ```
103
+ Affected Code: src/auth/login.ts
104
+
105
+ Upstream (What calls this?):
106
+ ├─ src/api/auth-routes.ts → POST /login
107
+ ├─ src/middleware/session.ts → validateSession()
108
+ └─ src/pages/login.tsx → handleSubmit()
109
+
110
+ Downstream (What does this affect?):
111
+ ├─ User dashboard → fetches profile on load
112
+ ├─ Settings page → assumes profile exists
113
+ └─ API responses → include user context
114
+ ```
115
+
116
+ ### Risk Scope Assessment
117
+
118
+ | Scope | Definition | Validation Approach |
119
+ |-------|------------|---------------------|
120
+ | **Isolated** | Self-contained, no affected areas | Unit tests only |
121
+ | **Medium** | 1-5 affected areas | Integration tests |
122
+ | **Broad** | >5 affected areas, cross-cutting | Integration + E2E + manual |
123
+
124
+ ---
125
+
126
+ ## Debug Report Format
127
+
128
+ ### Location
129
+
130
+ Debug reports are written to: `logs/debug-reports/{issue-id}-{timestamp}.yaml`
131
+
132
+ This location is separate from standard agent logs to:
133
+ - Enable easy reference by downstream pipeline stages
134
+ - Keep debug context grouped by issue
135
+ - Allow FixValidator to read validation plans
136
+
137
+ ### Schema Overview
138
+
139
+ ```yaml
140
+ debug_report:
141
+ metadata:
142
+ issue_id: "{id}"
143
+ timestamp: "{ISO-8601}"
144
+ analyzer: "bulwark-issue-analyzer"
145
+ complexity: low | medium | high
146
+
147
+ analysis:
148
+ symptom: "{user-visible problem}"
149
+ root_cause: "{underlying reason}"
150
+ fix_approach: "{recommended approach}"
151
+
152
+ impact_analysis:
153
+ affected_files: [...]
154
+ upstream_dependencies: [...]
155
+ downstream_effects: [...]
156
+ risk_scope: isolated | medium | broad
157
+
158
+ validation_plan:
159
+ tests_to_execute:
160
+ - path: "{test file}"
161
+ reason: "{why this test}"
162
+ priority: 1 # P1=must, P2=should, P3=nice-to-have
163
+ functionalities_to_validate: [...]
164
+
165
+ confidence_criteria:
166
+ high: [...]
167
+ medium: [...]
168
+ low: [...]
169
+
170
+ debug_journey: # Required for medium/high complexity
171
+ hypotheses_tested: [...]
172
+ ```
173
+
174
+ **Full schema**: See `references/debug-report-schema.md`
175
+
176
+ ---
177
+
178
+ ## Validation Plan
179
+
180
+ ### Tiered Test Priorities
181
+
182
+ | Priority | Definition | Action |
183
+ |----------|------------|--------|
184
+ | **P1 (Must)** | Direct tests of affected function | Always run |
185
+ | **P2 (Should)** | Integration tests for upstream/downstream | Run if time/tokens allow |
186
+ | **P3 (Nice-to-have)** | E2E tests, edge cases | Run if available |
187
+
188
+ ### Selection Criteria
189
+
190
+ **P1 Tests** (always run):
191
+ - Tests in the same file/module as the fix
192
+ - Tests named after the affected function
193
+ - Tests that were failing before the fix
194
+
195
+ **P2 Tests** (run if possible):
196
+ - Tests for upstream callers
197
+ - Tests for downstream consumers
198
+ - Tests for related functionality
199
+
200
+ **P3 Tests** (run if available):
201
+ - E2E tests that include the affected flow
202
+ - Performance tests
203
+ - Edge case tests
204
+
205
+ ### Functionality Validation
206
+
207
+ Beyond tests, list user-level verifications:
208
+ - "User can log in successfully"
209
+ - "Dashboard displays correct data after login"
210
+ - "Session persists across page refresh"
211
+
212
+ ---
213
+
214
+ ## Confidence Rubric
215
+
216
+ ### Assessment Criteria
217
+
218
+ | Level | Criteria |
219
+ |-------|----------|
220
+ | **High** | All P1-P2 tests pass, no regression, at least one functionality verified |
221
+ | **Medium** | P1 tests pass, some P2-P3 skipped or not applicable |
222
+ | **Low** | Tests cannot reliably validate, broad risk scope with untested paths |
223
+
224
+ ### Determining Complexity
225
+
226
+ | Complexity | Indicators |
227
+ |------------|------------|
228
+ | **Low** | Single file, isolated change, clear cause |
229
+ | **Medium** | 2-5 files, some dependencies, requires investigation |
230
+ | **High** | >5 files, cross-cutting, unclear cause, multiple hypotheses needed |
231
+
232
+ ---
233
+
234
+ ## Escalation Triggers
235
+
236
+ Manual testing is **required** when ANY of:
237
+ - Confidence level is `low`
238
+ - Risk scope is `broad` AND confidence is not `high`
239
+ - Any functionality cannot be validated via automated tests
240
+ - Security-related fix without security test coverage
241
+
242
+ ### Escalation Message Format
243
+
244
+ When escalation is triggered, the Orchestrator must inform the user:
245
+
246
+ ```
247
+ Manual testing required for:
248
+ - [functionality 1]
249
+ - [functionality 2]
250
+
251
+ Reason: [why automated validation insufficient]
252
+
253
+ Recommended manual test steps:
254
+ 1. [step]
255
+ 2. [step]
256
+ ```
257
+
258
+ ---
259
+
260
+ ## Debug Journey Logging
261
+
262
+ ### When Required
263
+
264
+ | Complexity | Debug Journey Required? |
265
+ |------------|------------------------|
266
+ | Low | Optional |
267
+ | Medium | **Required** |
268
+ | High | **Required** |
269
+
270
+ ### Format
271
+
272
+ ```yaml
273
+ debug_journey:
274
+ started_at: "{timestamp}"
275
+ completed_at: "{timestamp}"
276
+
277
+ hypotheses_tested:
278
+ - hypothesis: "Database connection timeout causing failure"
279
+ tested_at: "{timestamp}"
280
+ method: "Checked DB logs and connection pool stats"
281
+ result: rejected
282
+ evidence: "DB logs show successful queries, pool not exhausted"
283
+
284
+ - hypothesis: "Null profile object when user has no data"
285
+ tested_at: "{timestamp}"
286
+ method: "Added logging at profile access point"
287
+ result: confirmed
288
+ evidence: "Stack trace shows NPE at profile.name access"
289
+
290
+ investigation_path:
291
+ - "Started with error log analysis"
292
+ - "Ruled out infrastructure issues"
293
+ - "Narrowed to application code"
294
+ - "Identified profile access as failure point"
295
+ ```
296
+
297
+ ---
298
+
299
+ ## Anti-Patterns
300
+
301
+ ### What NOT to Do
302
+
303
+ | Anti-Pattern | Description | Correct Approach |
304
+ |--------------|-------------|------------------|
305
+ | **Shotgun Debugging** | Random changes hoping bug disappears | Hypothesis-driven approach |
306
+ | **Fix Without Verify** | Declaring "fixed" without running tests | Always verify at code + user level |
307
+ | **Symptom Fixing** | Adding workarounds instead of root cause fix | Use 5 Whys |
308
+ | **Blind AI Trust** | Accepting suggestions without verification | Test the failing scenario |
309
+ | **Full Regression** | Running 4000+ tests after every fix | Use tiered validation |
310
+ | **Circular Investigation** | Repeating tested hypotheses | Document debug journey |
311
+
312
+ **Full checklist**: See `references/anti-patterns.md`
313
+
314
+ ---
315
+
316
+ ## Quick Reference
317
+
318
+ ### Before Fixing
319
+
320
+ - [ ] Symptom identified and documented
321
+ - [ ] Root cause analysis completed (not just symptom)
322
+ - [ ] Impact analysis completed (upstream/downstream)
323
+ - [ ] Risk scope assessed (isolated/medium/broad)
324
+ - [ ] Complexity determined (low/medium/high)
325
+
326
+ ### After Fixing
327
+
328
+ - [ ] Fix implemented
329
+ - [ ] P1 tests pass
330
+ - [ ] P2 tests pass (or documented why skipped)
331
+ - [ ] Confidence level assessed
332
+ - [ ] Manual testing escalated if required
333
+ - [ ] Debug journey documented (if medium/high complexity)
334
+ - [ ] Debug report written to `logs/debug-reports/`
335
+
336
+ ### Complexity → Actions
337
+
338
+ | Complexity | Debug Journey | Validation | Escalation |
339
+ |------------|---------------|------------|------------|
340
+ | Low | Optional | P1 tests | Only if low confidence |
341
+ | Medium | Required | P1 + P2 tests | If broad scope |
342
+ | High | Required | P1 + P2 + P3 | Almost always |
343
+
344
+ ---
345
+
346
+ ## Integration
347
+
348
+ ### Pipeline Integration
349
+
350
+ This skill is used by the Fix Validation pipeline:
351
+
352
+ ```fsharp
353
+ IssueAnalyzer (loads this skill, produces debug report)
354
+ |> FixWriter (reads debug report for context)
355
+ |> TestWriter (reads validation plan)
356
+ |> FixValidator (executes validation plan, assesses confidence)
357
+ |> CodeReviewer (reviews all, makes approval decision)
358
+ ```
359
+
360
+ ### Agent Integration
361
+
362
+ | Agent | Usage |
363
+ |-------|-------|
364
+ | `bulwark-issue-analyzer` (P1.2) | Loads via `skills: issue-debugging`, produces debug report |
365
+ | `bulwark-fix-validator` (P1.3) | Loads via `skills: issue-debugging`, executes validation plan |
366
+
367
+ ### Artifact Flow
368
+
369
+ ```
370
+ IssueAnalyzer
371
+ └─> logs/debug-reports/{issue-id}.yaml
372
+
373
+ ├─> FixWriter (reads root cause, fix approach)
374
+ ├─> TestWriter (reads validation plan)
375
+ ├─> FixValidator (executes tests, assesses confidence)
376
+ └─> CodeReviewer (reviews everything)
377
+ ```
378
+
379
+ ---
380
+
381
+ ## Related Skills
382
+
383
+ - `subagent-prompting` (P0.1) - 4-part template for agent invocation
384
+ - `subagent-output-templating` (P0.2) - Output format for logs
385
+ - `pipeline-templates` (P0.3) - Fix Validation pipeline definition
@@ -0,0 +1,245 @@
1
+ # Debugging Anti-Patterns
2
+
3
+ Common debugging mistakes that waste time and reduce fix reliability. Avoid these patterns.
4
+
5
+ ---
6
+
7
+ ## Anti-Pattern Checklist
8
+
9
+ Before debugging, review this checklist to avoid common traps:
10
+
11
+ ### Pre-Fix Anti-Patterns
12
+
13
+ | Anti-Pattern | Symptoms | Correct Approach |
14
+ |--------------|----------|------------------|
15
+ | **Shotgun Debugging** | Making random changes, "try this and see" | Form hypothesis first, then test it |
16
+ | **Premature Fixing** | Fixing before understanding root cause | Complete 5 Whys before writing code |
17
+ | **Tunnel Vision** | Only looking at obvious locations | Map upstream/downstream dependencies |
18
+ | **Stack Overflow Copy-Paste** | Applying solutions without understanding | Understand WHY the solution works |
19
+
20
+ ### During-Fix Anti-Patterns
21
+
22
+ | Anti-Pattern | Symptoms | Correct Approach |
23
+ |--------------|----------|------------------|
24
+ | **Symptom Fixing** | Adding workarounds, null checks without understanding why | Find and fix root cause |
25
+ | **Fix Pile-Up** | Multiple unrelated changes in one fix | One fix per root cause |
26
+ | **Magic Numbers** | Adding arbitrary delays, retries without analysis | Understand timing/resource issue |
27
+ | **Commented Code** | Leaving "backup" code commented out | Use version control, delete cleanly |
28
+
29
+ ### Post-Fix Anti-Patterns
30
+
31
+ | Anti-Pattern | Symptoms | Correct Approach |
32
+ |--------------|----------|------------------|
33
+ | **Fix Without Verify** | Declaring "fixed" without running tests | Always run P1 tests minimum |
34
+ | **Blind AI Trust** | Accepting AI suggestions without testing | Verify fix addresses the failing scenario |
35
+ | **Full Regression Compulsion** | Running 4000+ tests for every fix | Use tiered validation (P1/P2/P3) |
36
+ | **Silent Merge** | Merging without review for "simple" fixes | All fixes need verification |
37
+
38
+ ### Investigation Anti-Patterns
39
+
40
+ | Anti-Pattern | Symptoms | Correct Approach |
41
+ |--------------|----------|------------------|
42
+ | **Circular Investigation** | Testing same hypotheses repeatedly | Document debug journey |
43
+ | **Heisenberg Debugging** | Adding debug code that changes behavior | Use non-invasive logging |
44
+ | **Blame Game** | Assuming it's someone else's code/library | Verify assumptions with tests |
45
+ | **Environment Blame** | "Works on my machine" | Test in consistent environment |
46
+
47
+ ---
48
+
49
+ ## Detailed Anti-Pattern Analysis
50
+
51
+ ### Shotgun Debugging
52
+
53
+ **Description**: Making random changes hoping the bug will disappear.
54
+
55
+ **Example**:
56
+ ```typescript
57
+ // BAD: Random changes without hypothesis
58
+ function login(user) {
59
+ // Try adding timeout?
60
+ await sleep(100);
61
+ // Maybe add null check?
62
+ if (user == null) return;
63
+ // What if we try-catch?
64
+ try {
65
+ return doLogin(user);
66
+ } catch (e) {
67
+ // Maybe retry?
68
+ return doLogin(user);
69
+ }
70
+ }
71
+ ```
72
+
73
+ **Why It's Bad**:
74
+ - Wastes time on irrelevant changes
75
+ - May mask the real bug without fixing it
76
+ - Makes code harder to maintain
77
+ - No understanding = bug will recur
78
+
79
+ **Correct Approach**:
80
+ 1. Observe: What exactly fails?
81
+ 2. Hypothesize: "The null user case isn't handled"
82
+ 3. Experiment: Add logging to confirm user is null
83
+ 4. Fix: Handle the specific case
84
+ 5. Verify: Test the scenario that was failing
85
+
86
+ ---
87
+
88
+ ### Fix Without Verify
89
+
90
+ **Description**: Declaring a fix complete without running tests or verifying the scenario.
91
+
92
+ **Example Conversation**:
93
+ ```
94
+ Developer: "I fixed the login bug, the null check was missing"
95
+ Reviewer: "Did you test it?"
96
+ Developer: "The code looks right, it should work"
97
+ ```
98
+
99
+ **Why It's Bad**:
100
+ - "Should work" ≠ "Does work"
101
+ - Untested fixes often introduce regressions
102
+ - User may still experience the bug
103
+ - Erodes trust in "fixed" status
104
+
105
+ **Correct Approach**:
106
+ 1. Before fixing: Reproduce the bug
107
+ 2. After fixing: Verify the scenario that was failing
108
+ 3. Run P1 tests (direct coverage)
109
+ 4. Run P2 tests if time allows
110
+ 5. Document verification in debug report
111
+
112
+ ---
113
+
114
+ ### Symptom Fixing
115
+
116
+ **Description**: Adding workarounds instead of fixing the root cause.
117
+
118
+ **Example**:
119
+ ```typescript
120
+ // SYMPTOM: API returns 500 when profile is null
121
+
122
+ // BAD: Workaround without understanding
123
+ function getProfile(user) {
124
+ try {
125
+ return fetchProfile(user);
126
+ } catch (e) {
127
+ return {}; // Just return empty, "fixes" the 500
128
+ }
129
+ }
130
+
131
+ // GOOD: Fix root cause
132
+ function getProfile(user) {
133
+ if (!user.hasProfile) {
134
+ return createDefaultProfile(user); // Handle the actual case
135
+ }
136
+ return fetchProfile(user);
137
+ }
138
+ ```
139
+
140
+ **Why It's Bad**:
141
+ - Bug still exists, just hidden
142
+ - Data inconsistency downstream
143
+ - Users may see incorrect behavior
144
+ - Future bugs harder to diagnose
145
+
146
+ **Correct Approach**:
147
+ 1. Use 5 Whys to find root cause
148
+ 2. Fix at the appropriate level
149
+ 3. Consider: Why was the symptom happening?
150
+ 4. Add proper handling, not just suppression
151
+
152
+ ---
153
+
154
+ ### Full Regression Compulsion
155
+
156
+ **Description**: Running all 4000+ tests after every small fix.
157
+
158
+ **Why It's Bad**:
159
+ - Wastes CI resources
160
+ - Slows down development
161
+ - Creates analysis paralysis
162
+ - Often triggered by fear, not necessity
163
+
164
+ **When Full Regression IS Appropriate**:
165
+ - Before major release
166
+ - After architecture changes
167
+ - When risk scope is "broad"
168
+ - When confidence is "low"
169
+
170
+ **Correct Approach**:
171
+ Use tiered validation:
172
+ - P1 tests: Always run (direct coverage)
173
+ - P2 tests: Run for medium+ complexity
174
+ - P3 tests: Run for high complexity or broad scope
175
+
176
+ ---
177
+
178
+ ### Circular Investigation
179
+
180
+ **Description**: Testing the same hypotheses multiple times without documenting.
181
+
182
+ **Example Timeline**:
183
+ ```
184
+ 10:00 - "Maybe it's a timing issue" - added delay, didn't help
185
+ 10:30 - "Let me check the database" - queries look fine
186
+ 11:00 - "What if it's timing?" - added delay again (forgot)
187
+ 11:30 - "Database seems slow" - checked queries again
188
+ ```
189
+
190
+ **Why It's Bad**:
191
+ - Wastes time on already-ruled-out theories
192
+ - Context lost between attempts
193
+ - Frustration increases, efficiency drops
194
+ - No learning accumulates
195
+
196
+ **Correct Approach**:
197
+ Document debug journey:
198
+ ```yaml
199
+ hypotheses_tested:
200
+ - hypothesis: "Timing issue"
201
+ result: rejected
202
+ evidence: "Delays don't fix it"
203
+ - hypothesis: "Database slow"
204
+ result: rejected
205
+ evidence: "Query logs show <10ms"
206
+ ```
207
+
208
+ ---
209
+
210
+ ## Quick Reference: What to Do Instead
211
+
212
+ | Instead of... | Do This |
213
+ |---------------|---------|
214
+ | Random changes | Form and test hypotheses |
215
+ | Declaring "fixed" | Verify with P1 tests |
216
+ | Workarounds | Find and fix root cause |
217
+ | Full regression every time | Use tiered validation |
218
+ | Forgetting investigations | Document debug journey |
219
+ | Copying solutions | Understand why they work |
220
+ | Assuming library bugs | Verify with isolated test |
221
+ | "Works on my machine" | Test in CI environment |
222
+
223
+ ---
224
+
225
+ ## Red Flags During Code Review
226
+
227
+ When reviewing a fix, watch for these indicators of anti-patterns:
228
+
229
+ 1. **No tests changed/added** - Fix may not be verified
230
+ 2. **Generic try-catch added** - May be symptom fixing
231
+ 3. **Magic numbers or delays** - May be shotgun debugging
232
+ 4. **"Cleanup" mixed with fix** - May obscure actual fix
233
+ 5. **No explanation of root cause** - May not understand issue
234
+ 6. **"This should work"** - Not verified
235
+
236
+ ---
237
+
238
+ ## Self-Check Before Declaring Fixed
239
+
240
+ - [ ] Can I explain the root cause in one sentence?
241
+ - [ ] Did I verify the scenario that was failing?
242
+ - [ ] Did I run P1 tests (direct coverage)?
243
+ - [ ] Is this fix addressing root cause, not just symptoms?
244
+ - [ ] Did I document my investigation (if medium/high complexity)?
245
+ - [ ] Would I bet $100 this is actually fixed?