compound-workflow 0.1.1

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 (55) hide show
  1. package/.claude-plugin/marketplace.json +11 -0
  2. package/.claude-plugin/plugin.json +12 -0
  3. package/.cursor-plugin/plugin.json +12 -0
  4. package/README.md +155 -0
  5. package/package.json +22 -0
  6. package/scripts/install-cli.mjs +313 -0
  7. package/scripts/sync-into-repo.sh +103 -0
  8. package/src/.agents/agents/research/best-practices-researcher.md +132 -0
  9. package/src/.agents/agents/research/framework-docs-researcher.md +134 -0
  10. package/src/.agents/agents/research/git-history-analyzer.md +62 -0
  11. package/src/.agents/agents/research/learnings-researcher.md +288 -0
  12. package/src/.agents/agents/research/repo-research-analyst.md +146 -0
  13. package/src/.agents/agents/review/agent-native-reviewer.md +299 -0
  14. package/src/.agents/agents/workflow/bug-reproduction-validator.md +87 -0
  15. package/src/.agents/agents/workflow/lint.md +20 -0
  16. package/src/.agents/agents/workflow/spec-flow-analyzer.md +149 -0
  17. package/src/.agents/commands/assess.md +60 -0
  18. package/src/.agents/commands/install.md +53 -0
  19. package/src/.agents/commands/metrics.md +59 -0
  20. package/src/.agents/commands/setup.md +9 -0
  21. package/src/.agents/commands/sync.md +9 -0
  22. package/src/.agents/commands/test-browser.md +393 -0
  23. package/src/.agents/commands/workflow/brainstorm.md +252 -0
  24. package/src/.agents/commands/workflow/compound.md +142 -0
  25. package/src/.agents/commands/workflow/plan.md +737 -0
  26. package/src/.agents/commands/workflow/review-v2.md +148 -0
  27. package/src/.agents/commands/workflow/review.md +110 -0
  28. package/src/.agents/commands/workflow/triage.md +54 -0
  29. package/src/.agents/commands/workflow/work.md +439 -0
  30. package/src/.agents/references/README.md +12 -0
  31. package/src/.agents/references/standards/README.md +9 -0
  32. package/src/.agents/scripts/self-check.mjs +227 -0
  33. package/src/.agents/scripts/sync-opencode.mjs +355 -0
  34. package/src/.agents/skills/agent-browser/SKILL.md +223 -0
  35. package/src/.agents/skills/audit-traceability/SKILL.md +260 -0
  36. package/src/.agents/skills/brainstorming/SKILL.md +250 -0
  37. package/src/.agents/skills/compound-docs/SKILL.md +533 -0
  38. package/src/.agents/skills/compound-docs/assets/critical-pattern-template.md +34 -0
  39. package/src/.agents/skills/compound-docs/assets/resolution-template.md +97 -0
  40. package/src/.agents/skills/compound-docs/references/yaml-schema.md +87 -0
  41. package/src/.agents/skills/compound-docs/schema.project.yaml +18 -0
  42. package/src/.agents/skills/compound-docs/schema.yaml +119 -0
  43. package/src/.agents/skills/data-foundations/SKILL.md +185 -0
  44. package/src/.agents/skills/document-review/SKILL.md +108 -0
  45. package/src/.agents/skills/file-todos/SKILL.md +177 -0
  46. package/src/.agents/skills/file-todos/assets/todo-template.md +106 -0
  47. package/src/.agents/skills/financial-workflow-integrity/SKILL.md +423 -0
  48. package/src/.agents/skills/git-worktree/SKILL.md +268 -0
  49. package/src/.agents/skills/pii-protection-prisma/SKILL.md +629 -0
  50. package/src/.agents/skills/process-metrics/SKILL.md +46 -0
  51. package/src/.agents/skills/process-metrics/assets/daily-template.md +37 -0
  52. package/src/.agents/skills/process-metrics/assets/monthly-template.md +21 -0
  53. package/src/.agents/skills/process-metrics/assets/weekly-template.md +25 -0
  54. package/src/.agents/skills/technical-review/SKILL.md +83 -0
  55. package/src/AGENTS.md +213 -0
@@ -0,0 +1,533 @@
1
+ ---
2
+ name: compound-docs
3
+ description: Capture solved problems as categorized documentation with YAML frontmatter for fast lookup
4
+ disable-model-invocation: true
5
+ allowed-tools:
6
+ - Read # Parse conversation context
7
+ - Write # Create resolution docs
8
+ - Bash # Create directories
9
+ - Grep # Search existing docs
10
+ preconditions:
11
+ - Problem has been solved (not in-progress)
12
+ - Solution has been verified working
13
+ ---
14
+
15
+ # compound-docs Skill
16
+
17
+ **Purpose:** Automatically document solved problems to build searchable institutional knowledge with category-based organization (enum-validated problem types).
18
+
19
+ ## Overview
20
+
21
+ This skill captures problem solutions immediately after confirmation, creating structured documentation that serves as a searchable knowledge base for future sessions.
22
+
23
+ **Organization:** Primary capture writes one solution doc per problem in its symptom category directory (e.g., `docs/solutions/performance-issues/2026-02-19-email-processing-n-plus-one-in-brief-generation.md`). Files use YAML frontmatter for metadata and searchability.
24
+
25
+ Post-capture actions (by explicit user choice) may update other references (e.g., patterns indexes).
26
+
27
+ ---
28
+
29
+ <critical_sequence name="documentation-capture" enforce_order="strict">
30
+
31
+ ## 7-Step Process
32
+
33
+ <step number="1" required="true">
34
+ ### Step 1: Detect Confirmation
35
+
36
+ **Auto-invoke after phrases:**
37
+
38
+ - "that worked"
39
+ - "it's fixed"
40
+ - "working now"
41
+ - "problem solved"
42
+ - "that did it"
43
+
44
+ **OR manual:** `/workflow:compound` command
45
+
46
+ **Non-trivial problems only:**
47
+
48
+ - Multiple investigation attempts needed
49
+ - Tricky debugging that took time
50
+ - Non-obvious solution
51
+ - Future sessions would benefit
52
+
53
+ **Skip documentation for:**
54
+
55
+ - Simple typos
56
+ - Obvious syntax errors
57
+ - Trivial fixes immediately corrected
58
+ </step>
59
+
60
+ <step number="2" required="true" depends_on="1">
61
+ ### Step 2: Gather Context
62
+
63
+ Extract from conversation history:
64
+
65
+ **Required information:**
66
+
67
+ - **Module name**: Which module or component had the problem
68
+ - **Symptom**: Observable error/behavior (exact error messages)
69
+ - **Investigation attempts**: What didn't work and why
70
+ - **Root cause**: Technical explanation of actual problem
71
+ - **Solution**: What fixed it (code/config changes)
72
+ - **Prevention**: How to avoid in future
73
+
74
+ **Environment details (as applicable):**
75
+
76
+ - Runtime/framework version
77
+ - Environment/stage (dev/staging/prod)
78
+ - OS version
79
+ - File/line references
80
+ - **Spike-origin:** If this solution came from a spike (timeboxed investigation from `/workflow:work` Spike Protocol), include `spike` in the doc's `tags` frontmatter when creating the documentation.
81
+
82
+ **BLOCKING REQUIREMENT:** If critical context is missing (module name, exact error, environment/stage, or resolution steps), ask user and WAIT for response before proceeding to Step 3:
83
+
84
+ ```
85
+ I need a few details to document this properly:
86
+
87
+ 1. Which module had this issue? [ModuleName]
88
+ 2. What was the exact error message or symptom?
89
+ 3. What environment/stage were you in? (dev/staging/prod)
90
+
91
+ [Continue after user provides details]
92
+ ```
93
+ </step>
94
+
95
+ <step number="3" required="false" depends_on="2">
96
+ ### Step 3: Check Existing Docs
97
+
98
+ Search docs/solutions/ for similar issues using Grep/Glob/Read tools.
99
+
100
+ Search by:
101
+
102
+ - exact error message keywords
103
+ - module/component
104
+ - root-cause phrases
105
+ - tags
106
+
107
+ **IF similar issue found:**
108
+
109
+ THEN present decision options:
110
+
111
+ ```
112
+ Found similar issue: docs/solutions/[path]
113
+
114
+ What's next?
115
+ 1. Create new doc with cross-reference (recommended)
116
+ 2. Update existing doc (separate action; only if same root cause)
117
+ 3. Other
118
+
119
+ Choose (1-3): _
120
+ ```
121
+
122
+ WAIT for user response, then execute chosen action.
123
+
124
+ **ELSE** (no similar issue found):
125
+
126
+ Proceed directly to Step 4 (no user interaction needed).
127
+ </step>
128
+
129
+ <step number="4" required="true" depends_on="2">
130
+ ### Step 4: Generate Filename
131
+
132
+ Format: `YYYY-MM-DD-<module-slug>-<symptom-slug>.md`
133
+
134
+ **Sanitization rules:**
135
+
136
+ - Lowercase
137
+ - Replace spaces with hyphens
138
+ - Remove special characters except hyphens
139
+ - Truncate to reasonable length (< 80 chars)
140
+
141
+ **Examples:**
142
+
143
+ - `2026-02-19-brief-system-missing-include-caused-n-plus-one.md`
144
+ - `2026-02-19-email-processing-parameter-not-saving-state.md`
145
+ - `2026-02-19-assistant-webview-crash-on-resize.md`
146
+ </step>
147
+
148
+ <step number="5" required="true" depends_on="4" blocking="true">
149
+ ### Step 5: Validate YAML Schema
150
+
151
+ **CRITICAL:** All docs require validated YAML frontmatter with enum validation.
152
+
153
+ <validation_gate name="yaml-schema" blocking="true">
154
+
155
+ **Validate against schema:**
156
+
157
+ 1. Load `.agents/skills/compound-docs/schema.yaml`.
158
+ 2. If `.agents/skills/compound-docs/schema.project.yaml` exists, validate against it as the repo-specific overlay.
159
+ 3. Use [yaml-schema.md](./references/yaml-schema.md) as the human-readable reference.
160
+
161
+ Ensure all required fields are present and match allowed values exactly for enum fields.
162
+
163
+ **BLOCK if validation fails:**
164
+
165
+ ```
166
+ ❌ YAML validation failed
167
+
168
+ Errors:
169
+ - problem_type: must be one of schema enums, got "compilation_error"
170
+ - severity: must be one of [critical, high, medium, low], got "invalid"
171
+ - symptoms: must be array with 1-5 items, got string
172
+
173
+ Please provide corrected values.
174
+ ```
175
+
176
+ **GATE ENFORCEMENT:** Do NOT proceed to Step 6 (Create Documentation) until YAML frontmatter passes all validation rules defined in `schema.yaml`.
177
+
178
+ </validation_gate>
179
+ </step>
180
+
181
+ <step number="6" required="true" depends_on="5">
182
+ ### Step 6: Create Documentation
183
+
184
+ **Determine category from problem_type:** Use the category mapping defined in [yaml-schema.md](./references/yaml-schema.md) (lines 49-61).
185
+
186
+ **Create documentation file:**
187
+
188
+ ```bash
189
+ PROBLEM_TYPE="[from validated YAML]"
190
+ CATEGORY="[mapped from problem_type]"
191
+ FILENAME="[generated-filename].md"
192
+ DOC_PATH="docs/solutions/${CATEGORY}/${FILENAME}"
193
+
194
+ # Create directory if needed
195
+ mkdir -p "docs/solutions/${CATEGORY}"
196
+
197
+ # Write documentation using template from assets/resolution-template.md
198
+ # (Content populated with Step 2 context and validated YAML frontmatter)
199
+ ```
200
+
201
+ **Result:**
202
+ - Single file in category directory
203
+ - Enum validation ensures consistent categorization
204
+
205
+ **Create documentation:** Populate the structure from [resolution-template.md](./assets/resolution-template.md) with context gathered in Step 2 and validated YAML frontmatter from Step 5.
206
+ </step>
207
+
208
+ <step number="7" required="false" depends_on="6">
209
+ ### Step 7: Cross-Reference & Critical Pattern Detection
210
+
211
+ If similar issues found in Step 3, include cross-references in the NEW doc.
212
+
213
+ Do not modify existing docs automatically as part of documentation capture. If the user explicitly requests updating an existing doc, do it as a separate, deliberate action.
214
+
215
+ **Pattern suggestions (optional):**
216
+
217
+ If this represents a common pattern (3+ similar issues), suggest using Option 3 in the decision menu to add it to the common patterns index.
218
+
219
+ **Critical Pattern Detection (Optional Proactive Suggestion):**
220
+
221
+ If this issue has automatic indicators suggesting it might be critical:
222
+ - Severity: `critical` in YAML
223
+ - Affects multiple modules OR foundational systems
224
+ - Non-obvious solution
225
+
226
+ Then in the decision menu (Step 8), add a note:
227
+ ```
228
+ 💡 This might be worth adding to Required Reading (Option 2)
229
+ ```
230
+
231
+ But **NEVER auto-promote**. User decides via decision menu (Option 2).
232
+
233
+ **Template for critical pattern addition:**
234
+
235
+ When user selects Option 2 (Add to Required Reading), use the template from [critical-pattern-template.md](./assets/critical-pattern-template.md) to structure the pattern entry. Number it sequentially based on existing patterns in `docs/solutions/patterns/critical-patterns.md`.
236
+ </step>
237
+
238
+ </critical_sequence>
239
+
240
+ ---
241
+
242
+ <decision_gate name="post-documentation" wait_for_user="true">
243
+
244
+ ## Decision Menu After Capture
245
+
246
+ After successful documentation, present options and WAIT for user response:
247
+
248
+ ```
249
+ ✓ Solution documented
250
+
251
+ File created:
252
+ - docs/solutions/[category]/[filename].md
253
+
254
+ What's next?
255
+ 1. Continue workflow (recommended)
256
+ 2. Add to Required Reading - Promote to critical patterns (critical-patterns.md)
257
+ 3. Add to common patterns index - Append to docs/solutions/patterns/common-solutions.md
258
+ 4. Link related issues - Connect to similar problems
259
+ 5. Add to existing skill - Add to an existing learning skill
260
+ 6. Create new skill - Extract into new learning skill
261
+ 7. View documentation - See what was captured
262
+ 8. Other
263
+ ```
264
+
265
+ **Handle responses:**
266
+
267
+ **Option 1: Continue workflow**
268
+
269
+ - Return to calling skill/workflow
270
+ - Documentation is complete
271
+
272
+ **Option 2: Add to Required Reading** ⭐ PRIMARY PATH FOR CRITICAL PATTERNS
273
+
274
+ User selects this when:
275
+ - System made this mistake multiple times across different modules
276
+ - Solution is non-obvious but must be followed every time
277
+ - Foundational requirement (framework/runtime rules, safety practices, etc.)
278
+
279
+ Action:
280
+ 1. Extract pattern from the documentation
281
+ 2. Format as ❌ WRONG vs ✅ CORRECT with code examples
282
+ 3. Add to `docs/solutions/patterns/critical-patterns.md`
283
+ 4. Add cross-reference back to this doc
284
+ 5. Confirm: "✓ Added to Required Reading. All subagents will see this pattern before code generation."
285
+
286
+ **Option 3: Add to common patterns index**
287
+
288
+ User selects this when:
289
+
290
+ - This issue has occurred multiple times (e.g., 3+ similar issues)
291
+ - The solution pattern should be quickly discoverable
292
+
293
+ Action:
294
+
295
+ 1. Ensure directory exists: `docs/solutions/patterns/`
296
+ 2. Append a new entry to `docs/solutions/patterns/common-solutions.md` using the captured doc as an example.
297
+ 3. If the file does not exist, create it with a short header.
298
+ 4. Confirm: "✓ Added to common patterns index"
299
+
300
+ Example append block:
301
+
302
+ ```bash
303
+ cat >> docs/solutions/patterns/common-solutions.md << 'EOF'
304
+
305
+ ## [Pattern Name]
306
+
307
+ **Common symptom:** [Description]
308
+ **Root cause:** [Technical explanation]
309
+ **Solution pattern:** [General approach]
310
+
311
+ **Examples:**
312
+ - [Link to doc 1]
313
+ - [Link to doc 2]
314
+ - [Link to doc 3]
315
+ EOF
316
+ ```
317
+
318
+ NOTE: This is a post-capture action and will create/modify an additional file beyond the primary solution doc.
319
+
320
+ **Option 4: Link related issues**
321
+
322
+ - Prompt: "Which doc to link? (provide filename or describe)"
323
+ - Search docs/solutions/ for the doc
324
+ - Add cross-reference to both docs
325
+ - Confirm: "✓ Cross-reference added"
326
+
327
+ **Option 5: Add to existing skill**
328
+
329
+ User selects this when the documented solution relates to an existing learning skill:
330
+
331
+ Action:
332
+ 1. Prompt: "Which skill? (<skill-name>)"
333
+ 2. Determine which reference file to update (resources.md, patterns.md, or examples.md)
334
+ 3. Add link and brief description to appropriate section
335
+ 4. Confirm: "✓ Added to [skill-name] skill in [file]"
336
+
337
+ Example:
338
+
339
+ - Add to `.agents/skills/<skill-name>/references/resources.md` under "Project-Specific Resources" (if it exists)
340
+ - Add to `.agents/skills/<skill-name>/references/examples.md` with a link to the solution doc (if it exists)
341
+
342
+ **Option 6: Create new skill**
343
+
344
+ User selects this when the solution represents the start of a new learning domain:
345
+
346
+ Action:
347
+ 1. Prompt: "What should the new skill be called? (e.g., stripe-billing, email-processing)"
348
+ 2. Create a new skill directory: `.agents/skills/<skill-name>/`
349
+ 3. Add `.agents/skills/<skill-name>/SKILL.md` with a clear description (what + when to use)
350
+ 4. Create initial reference files (optional) and add this solution doc as the first example
351
+ 5. Confirm: "✓ Created new <skill-name> skill with this solution as first example"
352
+
353
+ **Option 7: View documentation**
354
+
355
+ - Display the created documentation
356
+ - Present decision menu again
357
+
358
+ **Option 8: Other**
359
+
360
+ - Ask what they'd like to do
361
+
362
+ </decision_gate>
363
+
364
+ ---
365
+
366
+ <integration_protocol>
367
+
368
+ ## Integration Points
369
+
370
+ **Invoked by:**
371
+ - /workflow:compound command (primary interface)
372
+ - Manual invocation in conversation after solution confirmed
373
+ - Can be triggered by detecting confirmation phrases like "that worked", "it's fixed", etc.
374
+
375
+ **Invokes:**
376
+ - None (terminal skill - does not delegate to other skills)
377
+
378
+ **Handoff expectations:**
379
+ All context needed for documentation should be present in conversation history before invocation.
380
+
381
+ </integration_protocol>
382
+
383
+ ---
384
+
385
+ <success_criteria>
386
+
387
+ ## Success Criteria
388
+
389
+ Documentation is successful when ALL of the following are true:
390
+
391
+ - ✅ YAML frontmatter validated (all required fields, correct formats)
392
+ - ✅ File created in docs/solutions/[category]/[filename].md
393
+ - ✅ Enum values match schema.yaml exactly
394
+ - ✅ Code examples included in solution section
395
+ - ✅ Cross-references included in the new doc when related issues are found (bidirectional links are optional via the decision menu)
396
+ - ✅ User presented with decision menu and action confirmed
397
+
398
+ </success_criteria>
399
+
400
+ ---
401
+
402
+ ## Error Handling
403
+
404
+ **Missing context:**
405
+
406
+ - Ask user for missing details
407
+ - Don't proceed until critical info provided
408
+
409
+ **YAML validation failure:**
410
+
411
+ - Show specific errors
412
+ - Present retry with corrected values
413
+ - BLOCK until valid
414
+
415
+ **Similar issue ambiguity:**
416
+
417
+ - Present multiple matches
418
+ - Let user choose: new doc, update existing, or link as duplicate
419
+
420
+ **Module not in modules documentation:**
421
+
422
+ - Warn but don't block
423
+ - Proceed with documentation
424
+ - Suggest: "Add [Module] to modules documentation if not there"
425
+
426
+ ---
427
+
428
+ ## Execution Guidelines
429
+
430
+ **MUST do:**
431
+ - Validate YAML frontmatter (BLOCK if invalid per Step 5 validation gate)
432
+ - Extract exact error messages from conversation
433
+ - Include code examples in solution section
434
+ - Create directories before writing files (`mkdir -p`)
435
+ - Ask user and WAIT if critical context missing
436
+
437
+ **MUST NOT do:**
438
+ - Skip YAML validation (validation gate is blocking)
439
+ - Use vague descriptions (not searchable)
440
+ - Omit code examples or cross-references
441
+
442
+ ---
443
+
444
+ ## Quality Guidelines
445
+
446
+ **Good documentation has:**
447
+
448
+ - ✅ Exact error messages (copy-paste from output)
449
+ - ✅ Specific file:line references
450
+ - ✅ Observable symptoms (what you saw, not interpretations)
451
+ - ✅ Failed attempts documented (helps avoid wrong paths)
452
+ - ✅ Technical explanation (not just "what" but "why")
453
+ - ✅ Code examples (before/after if applicable)
454
+ - ✅ Prevention guidance (how to catch early)
455
+ - ✅ Cross-references (related issues)
456
+
457
+ **Avoid:**
458
+
459
+ - ❌ Vague descriptions ("something was wrong")
460
+ - ❌ Missing technical details ("fixed the code")
461
+ - ❌ No context (which version? which file?)
462
+ - ❌ Just code dumps (explain why it works)
463
+ - ❌ No prevention guidance
464
+ - ❌ No cross-references
465
+
466
+ ---
467
+
468
+ ## Example Scenario
469
+
470
+ **User:** "That worked! The N+1 query is fixed."
471
+
472
+ **Skill activates:**
473
+
474
+ 1. **Detect confirmation:** "That worked!" triggers auto-invoke
475
+ 2. **Gather context:**
476
+ - Module: Brief System
477
+ - Symptom: Brief generation taking >5 seconds, N+1 query when loading email threads
478
+ - Failed attempts: Added pagination (didn't help), checked background job performance
479
+ - Solution: Added eager loading with `includes(:emails)` on Brief model
480
+ - Root cause: Missing eager loading causing separate database query per email thread
481
+ 3. **Check existing:** No similar issue found
482
+ 4. **Generate filename:** `2025-11-10-brief-system-n-plus-one-brief-generation.md`
483
+ 5. **Validate YAML:**
484
+ ```yaml
485
+ module: Brief System
486
+ date: 2025-11-10
487
+ problem_type: performance_issue
488
+ component: backend
489
+ symptoms:
490
+ - "N+1 query when loading email threads"
491
+ - "Brief generation taking >5 seconds"
492
+ root_cause: missing_include
493
+ framework: rails
494
+ framework_version: 7.1.2
495
+ severity: high
496
+ tags: [n-plus-one, eager-loading, performance]
497
+ ```
498
+ ✅ Valid
499
+ 6. **Create documentation:**
500
+ - `docs/solutions/performance-issues/2025-11-10-brief-system-n-plus-one-brief-generation.md`
501
+ 7. **Cross-reference:** None needed (no similar issues)
502
+
503
+ **Output:**
504
+
505
+ ```
506
+ ✓ Solution documented
507
+
508
+ File created:
509
+ - docs/solutions/performance-issues/2025-11-10-brief-system-n-plus-one-brief-generation.md
510
+
511
+ What's next?
512
+ 1. Continue workflow (recommended)
513
+ 2. Add to Required Reading - Promote to critical patterns (critical-patterns.md)
514
+ 3. Add to common patterns index - Append to docs/solutions/patterns/common-solutions.md
515
+ 4. Link related issues - Connect to similar problems
516
+ 5. Add to existing skill - Add to an existing learning skill
517
+ 6. Create new skill - Extract into new learning skill
518
+ 7. View documentation - See what was captured
519
+ 8. Other
520
+ ```
521
+
522
+ ---
523
+
524
+ ## Future Enhancements
525
+
526
+ **Not in Phase 7 scope, but potential:**
527
+
528
+ - Search by date range
529
+ - Filter by severity
530
+ - Tag-based search interface
531
+ - Metrics (most common issues, resolution time)
532
+ - Export to shareable format (community knowledge sharing)
533
+ - Import community solutions
@@ -0,0 +1,34 @@
1
+ # Critical Pattern Template
2
+
3
+ Use this template when adding a pattern to `docs/solutions/patterns/critical-patterns.md`:
4
+
5
+ ---
6
+
7
+ ## N. [Pattern Name] (ALWAYS REQUIRED)
8
+
9
+ ### ❌ WRONG ([Will cause X error])
10
+ ```[language]
11
+ [code showing wrong approach]
12
+ ```
13
+
14
+ ### ✅ CORRECT
15
+ ```[language]
16
+ [code showing correct approach]
17
+ ```
18
+
19
+ **Why:** [Technical explanation of why this is required]
20
+
21
+ **Placement/Context:** [When this applies]
22
+
23
+ **Documented in:** `docs/solutions/[category]/[filename].md`
24
+
25
+ ---
26
+
27
+ **Instructions:**
28
+ 1. Replace N with the next pattern number
29
+ 2. Replace [Pattern Name] with descriptive title
30
+ 3. Fill in WRONG example with code that causes the problem
31
+ 4. Fill in CORRECT example with the solution
32
+ 5. Explain the technical reason in "Why"
33
+ 6. Clarify when this pattern applies in "Placement/Context"
34
+ 7. Link to the full troubleshooting doc where this was originally solved
@@ -0,0 +1,97 @@
1
+ ---
2
+ module: [Module name or "System" for system-wide]
3
+ date: [YYYY-MM-DD]
4
+ problem_type: [build_error|test_failure|runtime_error|performance_issue|database_issue|security_issue|ui_bug|integration_issue|logic_error|developer_experience|workflow_issue|best_practice|documentation_gap]
5
+ component: [e.g., backend|frontend|database|infra|ci|auth|api|docs|tooling]
6
+ symptoms:
7
+ - [Observable symptom 1 - specific error message or behavior]
8
+ - [Observable symptom 2 - what user actually saw/experienced]
9
+ root_cause: [Free text or stable slug describing actual cause]
10
+ framework: [optional, e.g., rails|react|django]
11
+ framework_version: [optional, X.Y.Z]
12
+ runtime_version: [optional, e.g., ruby 3.3.1|node 20.11.0]
13
+ environment: [optional, dev|staging|prod|other]
14
+ resolution_type: [code_fix|migration|config_change|test_fix|dependency_update|environment_setup]
15
+ severity: [critical|high|medium|low]
16
+ tags: [keyword1, keyword2, keyword3] # include "spike" when this doc originated from a spike
17
+ ---
18
+
19
+ # Troubleshooting: [Clear Problem Title]
20
+
21
+ ## Problem
22
+ [1-2 sentence clear description of the issue and what the user experienced]
23
+
24
+ ## Environment
25
+ - Module: [Name or "System-wide"]
26
+ - Framework/Runtime: [if relevant]
27
+ - Environment/Stage: [dev|staging|prod|other]
28
+ - Affected Component: [e.g., "Email Processing model", "Brief System service", "Authentication controller"]
29
+ - Date: [YYYY-MM-DD when this was solved]
30
+
31
+ ## Symptoms
32
+ - [Observable symptom 1 - what the user saw/experienced]
33
+ - [Observable symptom 2 - error messages, visual issues, unexpected behavior]
34
+ - [Continue as needed - be specific]
35
+
36
+ ## What Didn't Work
37
+
38
+ **Attempted Solution 1:** [Description of what was tried]
39
+ - **Why it failed:** [Technical reason this didn't solve the problem]
40
+
41
+ **Attempted Solution 2:** [Description of second attempt]
42
+ - **Why it failed:** [Technical reason]
43
+
44
+ [Continue for all significant attempts that DIDN'T work]
45
+
46
+ [If nothing else was attempted first, write:]
47
+ **Direct solution:** The problem was identified and fixed on the first attempt.
48
+
49
+ ## Solution
50
+
51
+ [The actual fix that worked - provide specific details]
52
+
53
+ **Code changes** (if applicable):
54
+ ```text
55
+ # Before (broken):
56
+ [Show the problematic code]
57
+
58
+ # After (fixed):
59
+ [Show the corrected code with explanation]
60
+ ```
61
+
62
+ **Database migration** (if applicable):
63
+ ```text
64
+ # Migration change:
65
+ [Show what was changed in the migration]
66
+ ```
67
+
68
+ **Commands run** (if applicable):
69
+ ```bash
70
+ # Steps taken to fix:
71
+ [Commands or actions]
72
+ ```
73
+
74
+ ## Why This Works
75
+
76
+ [Technical explanation of:]
77
+ 1. What was the ROOT CAUSE of the problem?
78
+ 2. Why does the solution address this root cause?
79
+ 3. What was the underlying issue (API misuse, configuration error, version constraint, etc.)?
80
+
81
+ [Be detailed enough that future developers understand the "why", not just the "what"]
82
+
83
+ ## Prevention
84
+
85
+ [How to avoid this problem in future development:]
86
+ - [Specific coding practice, check, or pattern to follow]
87
+ - [What to watch out for]
88
+ - [How to catch this early]
89
+
90
+ ## Related Issues
91
+
92
+ [If any similar problems exist in docs/solutions/, link to them:]
93
+ - See also: [another-related-issue.md](../category/another-related-issue.md)
94
+ - Similar to: [related-problem.md](../category/related-problem.md)
95
+
96
+ [If no related issues, write:]
97
+ No related issues documented yet.