@anhth2/spec-driven-dev-plugin 0.7.0 → 0.9.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 (96) hide show
  1. package/ARCHITECTURE.md +6 -2
  2. package/bin/index.js +105 -0
  3. package/commands/debug.md +189 -1
  4. package/commands/debug.tmpl +16 -0
  5. package/commands/define-product.md +94 -1
  6. package/commands/fix-bug.md +190 -1
  7. package/commands/fix-bug.tmpl +17 -0
  8. package/commands/generate-bdd.md +314 -14
  9. package/commands/generate-bdd.tmpl +220 -13
  10. package/commands/generate-code.md +191 -3
  11. package/commands/generate-code.tmpl +97 -2
  12. package/commands/generate-design-spec.md +811 -0
  13. package/commands/generate-design-spec.tmpl +399 -0
  14. package/commands/generate-prd.md +133 -1
  15. package/commands/generate-prd.tmpl +39 -0
  16. package/commands/generate-spec-manifest.md +576 -0
  17. package/commands/generate-spec-manifest.tmpl +164 -0
  18. package/commands/generate-tech-docs.md +116 -2
  19. package/commands/generate-tech-docs.tmpl +22 -1
  20. package/commands/generate-tests.md +94 -1
  21. package/commands/learn.md +554 -0
  22. package/commands/learn.tmpl +63 -0
  23. package/commands/propose-scenario.md +521 -0
  24. package/commands/propose-scenario.tmpl +109 -0
  25. package/commands/refine-prd.md +94 -1
  26. package/commands/report-bug.md +543 -0
  27. package/commands/report-bug.tmpl +131 -0
  28. package/commands/review-code.md +190 -1
  29. package/commands/review-code.tmpl +17 -0
  30. package/commands/review-context.md +134 -1
  31. package/commands/review-context.tmpl +40 -0
  32. package/commands/review-tech-docs.md +176 -5
  33. package/commands/review-tech-docs.tmpl +82 -4
  34. package/commands/run-tests.md +119 -1
  35. package/commands/run-tests.tmpl +25 -0
  36. package/commands/setup-ai-first.md +142 -4
  37. package/commands/setup-ai-first.tmpl +135 -3
  38. package/commands/smoke-test.md +94 -1
  39. package/commands/sync.md +405 -0
  40. package/commands/sync.tmpl +345 -0
  41. package/commands/update-framework.md +211 -0
  42. package/commands/update-framework.tmpl +151 -0
  43. package/commands/validate-traces.md +152 -3
  44. package/commands/validate-traces.tmpl +58 -2
  45. package/core/FRAMEWORK_VERSION +1 -1
  46. package/core/commands/debug.md +189 -1
  47. package/core/commands/define-product.md +94 -1
  48. package/core/commands/fix-bug.md +190 -1
  49. package/core/commands/generate-bdd.md +314 -14
  50. package/core/commands/generate-code.md +191 -3
  51. package/core/commands/generate-design-spec.md +811 -0
  52. package/core/commands/generate-prd.md +133 -1
  53. package/core/commands/generate-spec-manifest.md +576 -0
  54. package/core/commands/generate-tech-docs.md +116 -2
  55. package/core/commands/generate-tests.md +94 -1
  56. package/core/commands/learn.md +554 -0
  57. package/core/commands/propose-scenario.md +521 -0
  58. package/core/commands/refine-prd.md +94 -1
  59. package/core/commands/report-bug.md +543 -0
  60. package/core/commands/review-code.md +190 -1
  61. package/core/commands/review-context.md +134 -1
  62. package/core/commands/review-tech-docs.md +176 -5
  63. package/core/commands/run-tests.md +119 -1
  64. package/core/commands/setup-ai-first.md +142 -4
  65. package/core/commands/smoke-test.md +94 -1
  66. package/core/commands/sync.md +405 -0
  67. package/core/commands/update-framework.md +211 -0
  68. package/core/commands/validate-traces.md +152 -3
  69. package/core/skills/code/SKILL.md +101 -2
  70. package/core/skills/debug/SKILL.md +108 -3
  71. package/core/skills/design-spec/SKILL.md +507 -0
  72. package/core/skills/discovery/SKILL.md +94 -1
  73. package/core/skills/prd/SKILL.md +14 -2
  74. package/core/skills/setup-ai-first/SKILL.md +7 -1
  75. package/core/skills/spec/SKILL.md +14 -2
  76. package/core/skills/test/SKILL.md +195 -3
  77. package/core/steps/capture-lesson.md +79 -0
  78. package/core/steps/context-loader.md +87 -0
  79. package/core/steps/report-footer.md +7 -1
  80. package/core/templates/design-spec.template.md +209 -0
  81. package/core/templates/project-context.yaml +40 -0
  82. package/package.json +1 -1
  83. package/skills/code/SKILL.md +101 -2
  84. package/skills/debug/SKILL.md +108 -3
  85. package/skills/design-spec/SKILL.md +507 -0
  86. package/skills/design-spec/SKILL.tmpl +95 -0
  87. package/skills/discovery/SKILL.md +94 -1
  88. package/skills/prd/SKILL.md +14 -2
  89. package/skills/setup-ai-first/SKILL.md +7 -1
  90. package/skills/spec/SKILL.md +14 -2
  91. package/skills/test/SKILL.md +195 -3
  92. package/steps/capture-lesson.md +79 -0
  93. package/steps/context-loader.md +87 -0
  94. package/steps/report-footer.md +7 -1
  95. package/templates/design-spec.template.md +209 -0
  96. package/templates/project-context.yaml +40 -0
@@ -52,6 +52,7 @@ Read `.agent/project-context.yaml`. Extract and store:
52
52
  - `paths.core_entities` → path to core-entities.md
53
53
  - `paths.tech_docs_dir` → technical documentation root
54
54
  - `paths.trace_dir` → trace state directory
55
+ - `paths.design_spec_dir` → Design Spec documents root (FE/App only)
55
56
 
56
57
  If `paths` section is absent, use these defaults:
57
58
  - `specs_dir` = `specs/bdd`
@@ -63,11 +64,75 @@ If `paths` section is absent, use these defaults:
63
64
  - `core_entities` = `specs/domain-knowledge/core-entities.md`
64
65
  - `tech_docs_dir` = `specs/tech-docs`
65
66
  - `trace_dir` = `.trace`
67
+ - `design_spec_dir` = `specs/design-spec`
66
68
 
67
69
  If `tech_stack.module` is set, also load `.agent/modules/{module}/stack-profile.yaml` if it exists.
68
70
 
69
71
  ---
70
72
 
73
+ ## Step 1.5 — [SERVICE ROUTING] Resolve service paths (umbrella mode)
74
+
75
+ *Skip this step entirely if `setup.mode` is not `"umbrella"` and `services` section is absent from project-context.yaml.*
76
+
77
+ If `services` section is present:
78
+
79
+ **1. Detect active domain** (in priority order):
80
+ - Read `@trace.domain` from target file frontmatter (if Gate loaded a target file)
81
+ - Extract from target file path: segment immediately after `prd_dir` base path
82
+ *(e.g., `specs/prd/user/FEAT-01.md` → domain = `user`)*
83
+ - If `$ARGUMENTS` contains a path, extract the segment after `prd_dir`
84
+
85
+ **2. Route to service** — if active domain matches a key in `services`:
86
+ - Override `paths.specs_dir` → `services.{domain}.specs_dir`
87
+ - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir`
88
+ - Store `active_service` = `services.{domain}.path`
89
+ - Store `active_service_module` = `services.{domain}.module`
90
+ - If service has its own `module` → use it as `active_module` (overrides `tech_stack.module`)
91
+
92
+ **3. Fallback** — if domain not detected or no matching service key:
93
+ - Keep default paths from Step 1
94
+ - Set `active_service = unresolved`
95
+
96
+ **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
97
+ - Override `paths.prd_dir` → `{spec_source}/specs/prd`
98
+ - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
99
+ - Override `paths.domain_knowledge_dir` → `{spec_source}/specs/domain-knowledge`
100
+ - Override `paths.business_dictionary` → `{spec_source}/specs/domain-knowledge/business-dictionary.md`
101
+ - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
102
+ - Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
103
+ - Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
104
+
105
+ > **Why under `spec_source`:** tester feedback (`/report-bug`, `/propose-scenario`) must land in the **shared spec repo** so PO/Dev see it when they `/sync`. In single-service mode (no `spec_source`), these default to `feedback/bug-reports` and `feedback/bdd-proposals` at repo root — still shared, same repo.
106
+
107
+ ---
108
+
109
+ ## Step 1.6 — [SERVICE CONVENTIONS] Load service-specific conventions (umbrella mode)
110
+
111
+ *Skip this step entirely if `active_service` is `"unresolved"` or context is single-service mode.*
112
+
113
+ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-service/`):
114
+
115
+ **1. Locate service config** — try in priority order:
116
+ - `{active_service}/.agent/project-context.yaml`
117
+ - `{active_service}/project-context.yaml`
118
+
119
+ **2. If found, override with service-specific values:**
120
+
121
+ | Variable | Source |
122
+ |----------|--------|
123
+ | `conventions.test_command` | service's `conventions.test_command` |
124
+ | `conventions.build_command` | service's `conventions.build_command` |
125
+ | `paths.trace_dir` | `{active_service}/{service paths.trace_dir}` — default: `{active_service}/.trace` |
126
+ | `paths.specs_dir` | `{active_service}/{service paths.specs_dir}` (if set in service config, else keep Step 1.5 override) |
127
+
128
+ **3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
129
+ - Shell commands (`/run-tests`, `/generate-tests`) run **from within** `service_root`
130
+ - File write operations (test files, trace TSVs) use paths **relative to** `service_root`
131
+
132
+ **4. If service config not found** — keep umbrella defaults, still set `service_root = {active_service}` (path anchor is always needed even without a config override).
133
+
134
+ ---
135
+
71
136
  ## Step 2 — [PROJECT-CONFIG] Load module stack profile (conditional)
72
137
 
73
138
  If `tech_stack.module` is set, read `.agent/modules/{module}/stack-profile.yaml`.
@@ -158,6 +223,25 @@ These two variables (`active_module`, `platform_type`) are the canonical source
158
223
 
159
224
  ---
160
225
 
226
+ ## Step 6.7 — [GUARDRAILS] Load Project Lessons (conditional)
227
+
228
+ *Accumulated mistakes the AI must not repeat in this project. These are added over time via `/learn`
229
+ or accepted during `/review-code`, `/fix-bug`, `/debug`.*
230
+
231
+ Resolve the lessons file path:
232
+ - Use `paths.lessons_file` if set (may be service-overridden in umbrella mode, Step 1.6)
233
+ - Else default `specs/domain-knowledge/lessons-learned.md`
234
+ - In umbrella/service mode (when `service_root` is set), if `paths.lessons_file` is unset, default to `{service_root}/.agent/project-lessons.md`
235
+
236
+ If the file exists, read it and store ALL lessons as **ACTIVE GUARDRAILS** for the session:
237
+ - Treat each lesson's **Rule** as a hard constraint — same priority as CLAUDE.md coding standards (Step 3).
238
+ - Before generating or modifying any artifact (PRD, BDD, tech-doc, code, test), check the output against every lesson whose `category` matches the current command AND whose `scope` matches the target (domain / file).
239
+ - If a generated output would violate a lesson → correct it **before** presenting, and note which lesson (`L-NNN`) was applied.
240
+
241
+ If the file does not exist → skip silently (no lessons captured yet).
242
+
243
+ ---
244
+
161
245
  ## Step 7 — [RECAP] Working Memory Recap (anti-lost-in-middle)
162
246
 
163
247
  After loading all context, synthesize and output a compact summary block.
@@ -173,6 +257,9 @@ Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Ser
173
257
  Ticket : {ticket_prefix}-
174
258
  Dict : {loaded — N canonical terms, M banned terms | missing}
175
259
  Entities : {loaded — EntityA, EntityB, EntityC | missing}
260
+ Lessons : {loaded — N guardrails | none yet}
261
+ Service : {active_service} ({active_service_module}) | single-service
262
+ Svc Root : {service_root} — conventions + trace_dir loaded from service config | —
176
263
  Status : {FULL | PARTIAL — missing: CLAUDE.md / business-dict / core-entities | MINIMAL}
177
264
  ```
178
265
 
@@ -360,7 +447,8 @@ Suggest the logical next command based on workflow phase:
360
447
  | /define-product | `/generate-prd {product-definition-file}` |
361
448
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
362
449
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
363
- | /review-context (PRD) | `/generate-bdd {prd-file}` if APPROVED; fix PRD if NEEDS_FIX |
450
+ | /review-context (PRD) | FE/App: `/generate-design-spec {prd-file}` (then BDD after sign-off); BE: `/generate-bdd {prd-file}` directly; fix PRD if NEEDS_FIX |
451
+ | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
364
452
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
365
453
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
366
454
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
@@ -374,6 +462,11 @@ Suggest the logical next command based on workflow phase:
374
462
  | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
375
463
  | /fix-bug | Create PR and link to ticket |
376
464
  | /debug | `/fix-bug {ticket-id}` if fix needed |
465
+ | /report-bug | Send to dev (`/fix-bug {BUG-ID}`); if coverage gap → `/propose-scenario {UC-ID}` |
466
+ | /propose-scenario | Notify PO/Dev to review the proposal in `feedback/bdd-proposals/` |
467
+ | /learn | Continue working — lesson applies on next command |
468
+ | /sync | `/validate-traces` for full coverage; act on any `📥 tester feedback` surfaced |
469
+ | /update-framework | Review `git diff .agent/`, commit; `/sync` for project content |
377
470
 
378
471
  Format the footer as:
379
472
  ```
@@ -190,7 +190,8 @@ Suggest the logical next command based on workflow phase:
190
190
  | /define-product | `/generate-prd {product-definition-file}` |
191
191
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
192
192
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
193
- | /review-context (PRD) | `/generate-bdd {prd-file}` if APPROVED; fix PRD if NEEDS_FIX |
193
+ | /review-context (PRD) | FE/App: `/generate-design-spec {prd-file}` (then BDD after sign-off); BE: `/generate-bdd {prd-file}` directly; fix PRD if NEEDS_FIX |
194
+ | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
194
195
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
195
196
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
196
197
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
@@ -204,6 +205,11 @@ Suggest the logical next command based on workflow phase:
204
205
  | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
205
206
  | /fix-bug | Create PR and link to ticket |
206
207
  | /debug | `/fix-bug {ticket-id}` if fix needed |
208
+ | /report-bug | Send to dev (`/fix-bug {BUG-ID}`); if coverage gap → `/propose-scenario {UC-ID}` |
209
+ | /propose-scenario | Notify PO/Dev to review the proposal in `feedback/bdd-proposals/` |
210
+ | /learn | Continue working — lesson applies on next command |
211
+ | /sync | `/validate-traces` for full coverage; act on any `📥 tester feedback` surfaced |
212
+ | /update-framework | Review `git diff .agent/`, commit; `/sync` for project content |
207
213
 
208
214
  Format the footer as:
209
215
  ```
@@ -433,7 +439,8 @@ Suggest the logical next command based on workflow phase:
433
439
  | /define-product | `/generate-prd {product-definition-file}` |
434
440
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
435
441
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
436
- | /review-context (PRD) | `/generate-bdd {prd-file}` if APPROVED; fix PRD if NEEDS_FIX |
442
+ | /review-context (PRD) | FE/App: `/generate-design-spec {prd-file}` (then BDD after sign-off); BE: `/generate-bdd {prd-file}` directly; fix PRD if NEEDS_FIX |
443
+ | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
437
444
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
438
445
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
439
446
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
@@ -447,6 +454,11 @@ Suggest the logical next command based on workflow phase:
447
454
  | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
448
455
  | /fix-bug | Create PR and link to ticket |
449
456
  | /debug | `/fix-bug {ticket-id}` if fix needed |
457
+ | /report-bug | Send to dev (`/fix-bug {BUG-ID}`); if coverage gap → `/propose-scenario {UC-ID}` |
458
+ | /propose-scenario | Notify PO/Dev to review the proposal in `feedback/bdd-proposals/` |
459
+ | /learn | Continue working — lesson applies on next command |
460
+ | /sync | `/validate-traces` for full coverage; act on any `📥 tester feedback` surfaced |
461
+ | /update-framework | Review `git diff .agent/`, commit; `/sync` for project content |
450
462
 
451
463
  Format the footer as:
452
464
  ```
@@ -136,7 +136,8 @@ Suggest the logical next command based on workflow phase:
136
136
  | /define-product | `/generate-prd {product-definition-file}` |
137
137
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
138
138
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
139
- | /review-context (PRD) | `/generate-bdd {prd-file}` if APPROVED; fix PRD if NEEDS_FIX |
139
+ | /review-context (PRD) | FE/App: `/generate-design-spec {prd-file}` (then BDD after sign-off); BE: `/generate-bdd {prd-file}` directly; fix PRD if NEEDS_FIX |
140
+ | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
140
141
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
141
142
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
142
143
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
@@ -150,6 +151,11 @@ Suggest the logical next command based on workflow phase:
150
151
  | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
151
152
  | /fix-bug | Create PR and link to ticket |
152
153
  | /debug | `/fix-bug {ticket-id}` if fix needed |
154
+ | /report-bug | Send to dev (`/fix-bug {BUG-ID}`); if coverage gap → `/propose-scenario {UC-ID}` |
155
+ | /propose-scenario | Notify PO/Dev to review the proposal in `feedback/bdd-proposals/` |
156
+ | /learn | Continue working — lesson applies on next command |
157
+ | /sync | `/validate-traces` for full coverage; act on any `📥 tester feedback` surfaced |
158
+ | /update-framework | Review `git diff .agent/`, commit; `/sync` for project content |
153
159
 
154
160
  Format the footer as:
155
161
  ```
@@ -207,7 +207,8 @@ Suggest the logical next command based on workflow phase:
207
207
  | /define-product | `/generate-prd {product-definition-file}` |
208
208
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
209
209
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
210
- | /review-context (PRD) | `/generate-bdd {prd-file}` if APPROVED; fix PRD if NEEDS_FIX |
210
+ | /review-context (PRD) | FE/App: `/generate-design-spec {prd-file}` (then BDD after sign-off); BE: `/generate-bdd {prd-file}` directly; fix PRD if NEEDS_FIX |
211
+ | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
211
212
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
212
213
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
213
214
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
@@ -221,6 +222,11 @@ Suggest the logical next command based on workflow phase:
221
222
  | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
222
223
  | /fix-bug | Create PR and link to ticket |
223
224
  | /debug | `/fix-bug {ticket-id}` if fix needed |
225
+ | /report-bug | Send to dev (`/fix-bug {BUG-ID}`); if coverage gap → `/propose-scenario {UC-ID}` |
226
+ | /propose-scenario | Notify PO/Dev to review the proposal in `feedback/bdd-proposals/` |
227
+ | /learn | Continue working — lesson applies on next command |
228
+ | /sync | `/validate-traces` for full coverage; act on any `📥 tester feedback` surfaced |
229
+ | /update-framework | Review `git diff .agent/`, commit; `/sync` for project content |
224
230
 
225
231
  Format the footer as:
226
232
  ```
@@ -338,7 +344,8 @@ Suggest the logical next command based on workflow phase:
338
344
  | /define-product | `/generate-prd {product-definition-file}` |
339
345
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
340
346
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
341
- | /review-context (PRD) | `/generate-bdd {prd-file}` if APPROVED; fix PRD if NEEDS_FIX |
347
+ | /review-context (PRD) | FE/App: `/generate-design-spec {prd-file}` (then BDD after sign-off); BE: `/generate-bdd {prd-file}` directly; fix PRD if NEEDS_FIX |
348
+ | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
342
349
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
343
350
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
344
351
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
@@ -352,6 +359,11 @@ Suggest the logical next command based on workflow phase:
352
359
  | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
353
360
  | /fix-bug | Create PR and link to ticket |
354
361
  | /debug | `/fix-bug {ticket-id}` if fix needed |
362
+ | /report-bug | Send to dev (`/fix-bug {BUG-ID}`); if coverage gap → `/propose-scenario {UC-ID}` |
363
+ | /propose-scenario | Notify PO/Dev to review the proposal in `feedback/bdd-proposals/` |
364
+ | /learn | Continue working — lesson applies on next command |
365
+ | /sync | `/validate-traces` for full coverage; act on any `📥 tester feedback` surfaced |
366
+ | /update-framework | Review `git diff .agent/`, commit; `/sync` for project content |
355
367
 
356
368
  Format the footer as:
357
369
  ```
@@ -250,7 +250,8 @@ Suggest the logical next command based on workflow phase:
250
250
  | /define-product | `/generate-prd {product-definition-file}` |
251
251
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
252
252
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
253
- | /review-context (PRD) | `/generate-bdd {prd-file}` if APPROVED; fix PRD if NEEDS_FIX |
253
+ | /review-context (PRD) | FE/App: `/generate-design-spec {prd-file}` (then BDD after sign-off); BE: `/generate-bdd {prd-file}` directly; fix PRD if NEEDS_FIX |
254
+ | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
254
255
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
255
256
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
256
257
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
@@ -264,6 +265,11 @@ Suggest the logical next command based on workflow phase:
264
265
  | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
265
266
  | /fix-bug | Create PR and link to ticket |
266
267
  | /debug | `/fix-bug {ticket-id}` if fix needed |
268
+ | /report-bug | Send to dev (`/fix-bug {BUG-ID}`); if coverage gap → `/propose-scenario {UC-ID}` |
269
+ | /propose-scenario | Notify PO/Dev to review the proposal in `feedback/bdd-proposals/` |
270
+ | /learn | Continue working — lesson applies on next command |
271
+ | /sync | `/validate-traces` for full coverage; act on any `📥 tester feedback` surfaced |
272
+ | /update-framework | Review `git diff .agent/`, commit; `/sync` for project content |
267
273
 
268
274
  Format the footer as:
269
275
  ```
@@ -324,6 +330,7 @@ Read `.agent/project-context.yaml`. Extract and store:
324
330
  - `paths.core_entities` → path to core-entities.md
325
331
  - `paths.tech_docs_dir` → technical documentation root
326
332
  - `paths.trace_dir` → trace state directory
333
+ - `paths.design_spec_dir` → Design Spec documents root (FE/App only)
327
334
 
328
335
  If `paths` section is absent, use these defaults:
329
336
  - `specs_dir` = `specs/bdd`
@@ -335,11 +342,75 @@ If `paths` section is absent, use these defaults:
335
342
  - `core_entities` = `specs/domain-knowledge/core-entities.md`
336
343
  - `tech_docs_dir` = `specs/tech-docs`
337
344
  - `trace_dir` = `.trace`
345
+ - `design_spec_dir` = `specs/design-spec`
338
346
 
339
347
  If `tech_stack.module` is set, also load `.agent/modules/{module}/stack-profile.yaml` if it exists.
340
348
 
341
349
  ---
342
350
 
351
+ ## Step 1.5 — [SERVICE ROUTING] Resolve service paths (umbrella mode)
352
+
353
+ *Skip this step entirely if `setup.mode` is not `"umbrella"` and `services` section is absent from project-context.yaml.*
354
+
355
+ If `services` section is present:
356
+
357
+ **1. Detect active domain** (in priority order):
358
+ - Read `@trace.domain` from target file frontmatter (if Gate loaded a target file)
359
+ - Extract from target file path: segment immediately after `prd_dir` base path
360
+ *(e.g., `specs/prd/user/FEAT-01.md` → domain = `user`)*
361
+ - If `$ARGUMENTS` contains a path, extract the segment after `prd_dir`
362
+
363
+ **2. Route to service** — if active domain matches a key in `services`:
364
+ - Override `paths.specs_dir` → `services.{domain}.specs_dir`
365
+ - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir`
366
+ - Store `active_service` = `services.{domain}.path`
367
+ - Store `active_service_module` = `services.{domain}.module`
368
+ - If service has its own `module` → use it as `active_module` (overrides `tech_stack.module`)
369
+
370
+ **3. Fallback** — if domain not detected or no matching service key:
371
+ - Keep default paths from Step 1
372
+ - Set `active_service = unresolved`
373
+
374
+ **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
375
+ - Override `paths.prd_dir` → `{spec_source}/specs/prd`
376
+ - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
377
+ - Override `paths.domain_knowledge_dir` → `{spec_source}/specs/domain-knowledge`
378
+ - Override `paths.business_dictionary` → `{spec_source}/specs/domain-knowledge/business-dictionary.md`
379
+ - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
380
+ - Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
381
+ - Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
382
+
383
+ > **Why under `spec_source`:** tester feedback (`/report-bug`, `/propose-scenario`) must land in the **shared spec repo** so PO/Dev see it when they `/sync`. In single-service mode (no `spec_source`), these default to `feedback/bug-reports` and `feedback/bdd-proposals` at repo root — still shared, same repo.
384
+
385
+ ---
386
+
387
+ ## Step 1.6 — [SERVICE CONVENTIONS] Load service-specific conventions (umbrella mode)
388
+
389
+ *Skip this step entirely if `active_service` is `"unresolved"` or context is single-service mode.*
390
+
391
+ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-service/`):
392
+
393
+ **1. Locate service config** — try in priority order:
394
+ - `{active_service}/.agent/project-context.yaml`
395
+ - `{active_service}/project-context.yaml`
396
+
397
+ **2. If found, override with service-specific values:**
398
+
399
+ | Variable | Source |
400
+ |----------|--------|
401
+ | `conventions.test_command` | service's `conventions.test_command` |
402
+ | `conventions.build_command` | service's `conventions.build_command` |
403
+ | `paths.trace_dir` | `{active_service}/{service paths.trace_dir}` — default: `{active_service}/.trace` |
404
+ | `paths.specs_dir` | `{active_service}/{service paths.specs_dir}` (if set in service config, else keep Step 1.5 override) |
405
+
406
+ **3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
407
+ - Shell commands (`/run-tests`, `/generate-tests`) run **from within** `service_root`
408
+ - File write operations (test files, trace TSVs) use paths **relative to** `service_root`
409
+
410
+ **4. If service config not found** — keep umbrella defaults, still set `service_root = {active_service}` (path anchor is always needed even without a config override).
411
+
412
+ ---
413
+
343
414
  ## Step 2 — [PROJECT-CONFIG] Load module stack profile (conditional)
344
415
 
345
416
  If `tech_stack.module` is set, read `.agent/modules/{module}/stack-profile.yaml`.
@@ -430,6 +501,25 @@ These two variables (`active_module`, `platform_type`) are the canonical source
430
501
 
431
502
  ---
432
503
 
504
+ ## Step 6.7 — [GUARDRAILS] Load Project Lessons (conditional)
505
+
506
+ *Accumulated mistakes the AI must not repeat in this project. These are added over time via `/learn`
507
+ or accepted during `/review-code`, `/fix-bug`, `/debug`.*
508
+
509
+ Resolve the lessons file path:
510
+ - Use `paths.lessons_file` if set (may be service-overridden in umbrella mode, Step 1.6)
511
+ - Else default `specs/domain-knowledge/lessons-learned.md`
512
+ - In umbrella/service mode (when `service_root` is set), if `paths.lessons_file` is unset, default to `{service_root}/.agent/project-lessons.md`
513
+
514
+ If the file exists, read it and store ALL lessons as **ACTIVE GUARDRAILS** for the session:
515
+ - Treat each lesson's **Rule** as a hard constraint — same priority as CLAUDE.md coding standards (Step 3).
516
+ - Before generating or modifying any artifact (PRD, BDD, tech-doc, code, test), check the output against every lesson whose `category` matches the current command AND whose `scope` matches the target (domain / file).
517
+ - If a generated output would violate a lesson → correct it **before** presenting, and note which lesson (`L-NNN`) was applied.
518
+
519
+ If the file does not exist → skip silently (no lessons captured yet).
520
+
521
+ ---
522
+
433
523
  ## Step 7 — [RECAP] Working Memory Recap (anti-lost-in-middle)
434
524
 
435
525
  After loading all context, synthesize and output a compact summary block.
@@ -445,6 +535,9 @@ Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Ser
445
535
  Ticket : {ticket_prefix}-
446
536
  Dict : {loaded — N canonical terms, M banned terms | missing}
447
537
  Entities : {loaded — EntityA, EntityB, EntityC | missing}
538
+ Lessons : {loaded — N guardrails | none yet}
539
+ Service : {active_service} ({active_service_module}) | single-service
540
+ Svc Root : {service_root} — conventions + trace_dir loaded from service config | —
448
541
  Status : {FULL | PARTIAL — missing: CLAUDE.md / business-dict / core-entities | MINIMAL}
449
542
  ```
450
543
 
@@ -557,7 +650,8 @@ Suggest the logical next command based on workflow phase:
557
650
  | /define-product | `/generate-prd {product-definition-file}` |
558
651
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
559
652
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
560
- | /review-context (PRD) | `/generate-bdd {prd-file}` if APPROVED; fix PRD if NEEDS_FIX |
653
+ | /review-context (PRD) | FE/App: `/generate-design-spec {prd-file}` (then BDD after sign-off); BE: `/generate-bdd {prd-file}` directly; fix PRD if NEEDS_FIX |
654
+ | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
561
655
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
562
656
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
563
657
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
@@ -571,6 +665,11 @@ Suggest the logical next command based on workflow phase:
571
665
  | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
572
666
  | /fix-bug | Create PR and link to ticket |
573
667
  | /debug | `/fix-bug {ticket-id}` if fix needed |
668
+ | /report-bug | Send to dev (`/fix-bug {BUG-ID}`); if coverage gap → `/propose-scenario {UC-ID}` |
669
+ | /propose-scenario | Notify PO/Dev to review the proposal in `feedback/bdd-proposals/` |
670
+ | /learn | Continue working — lesson applies on next command |
671
+ | /sync | `/validate-traces` for full coverage; act on any `📥 tester feedback` surfaced |
672
+ | /update-framework | Review `git diff .agent/`, commit; `/sync` for project content |
574
673
 
575
674
  Format the footer as:
576
675
  ```
@@ -634,6 +733,7 @@ Read `.agent/project-context.yaml`. Extract and store:
634
733
  - `paths.core_entities` → path to core-entities.md
635
734
  - `paths.tech_docs_dir` → technical documentation root
636
735
  - `paths.trace_dir` → trace state directory
736
+ - `paths.design_spec_dir` → Design Spec documents root (FE/App only)
637
737
 
638
738
  If `paths` section is absent, use these defaults:
639
739
  - `specs_dir` = `specs/bdd`
@@ -645,11 +745,75 @@ If `paths` section is absent, use these defaults:
645
745
  - `core_entities` = `specs/domain-knowledge/core-entities.md`
646
746
  - `tech_docs_dir` = `specs/tech-docs`
647
747
  - `trace_dir` = `.trace`
748
+ - `design_spec_dir` = `specs/design-spec`
648
749
 
649
750
  If `tech_stack.module` is set, also load `.agent/modules/{module}/stack-profile.yaml` if it exists.
650
751
 
651
752
  ---
652
753
 
754
+ ## Step 1.5 — [SERVICE ROUTING] Resolve service paths (umbrella mode)
755
+
756
+ *Skip this step entirely if `setup.mode` is not `"umbrella"` and `services` section is absent from project-context.yaml.*
757
+
758
+ If `services` section is present:
759
+
760
+ **1. Detect active domain** (in priority order):
761
+ - Read `@trace.domain` from target file frontmatter (if Gate loaded a target file)
762
+ - Extract from target file path: segment immediately after `prd_dir` base path
763
+ *(e.g., `specs/prd/user/FEAT-01.md` → domain = `user`)*
764
+ - If `$ARGUMENTS` contains a path, extract the segment after `prd_dir`
765
+
766
+ **2. Route to service** — if active domain matches a key in `services`:
767
+ - Override `paths.specs_dir` → `services.{domain}.specs_dir`
768
+ - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir`
769
+ - Store `active_service` = `services.{domain}.path`
770
+ - Store `active_service_module` = `services.{domain}.module`
771
+ - If service has its own `module` → use it as `active_module` (overrides `tech_stack.module`)
772
+
773
+ **3. Fallback** — if domain not detected or no matching service key:
774
+ - Keep default paths from Step 1
775
+ - Set `active_service = unresolved`
776
+
777
+ **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
778
+ - Override `paths.prd_dir` → `{spec_source}/specs/prd`
779
+ - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
780
+ - Override `paths.domain_knowledge_dir` → `{spec_source}/specs/domain-knowledge`
781
+ - Override `paths.business_dictionary` → `{spec_source}/specs/domain-knowledge/business-dictionary.md`
782
+ - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
783
+ - Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
784
+ - Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
785
+
786
+ > **Why under `spec_source`:** tester feedback (`/report-bug`, `/propose-scenario`) must land in the **shared spec repo** so PO/Dev see it when they `/sync`. In single-service mode (no `spec_source`), these default to `feedback/bug-reports` and `feedback/bdd-proposals` at repo root — still shared, same repo.
787
+
788
+ ---
789
+
790
+ ## Step 1.6 — [SERVICE CONVENTIONS] Load service-specific conventions (umbrella mode)
791
+
792
+ *Skip this step entirely if `active_service` is `"unresolved"` or context is single-service mode.*
793
+
794
+ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-service/`):
795
+
796
+ **1. Locate service config** — try in priority order:
797
+ - `{active_service}/.agent/project-context.yaml`
798
+ - `{active_service}/project-context.yaml`
799
+
800
+ **2. If found, override with service-specific values:**
801
+
802
+ | Variable | Source |
803
+ |----------|--------|
804
+ | `conventions.test_command` | service's `conventions.test_command` |
805
+ | `conventions.build_command` | service's `conventions.build_command` |
806
+ | `paths.trace_dir` | `{active_service}/{service paths.trace_dir}` — default: `{active_service}/.trace` |
807
+ | `paths.specs_dir` | `{active_service}/{service paths.specs_dir}` (if set in service config, else keep Step 1.5 override) |
808
+
809
+ **3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
810
+ - Shell commands (`/run-tests`, `/generate-tests`) run **from within** `service_root`
811
+ - File write operations (test files, trace TSVs) use paths **relative to** `service_root`
812
+
813
+ **4. If service config not found** — keep umbrella defaults, still set `service_root = {active_service}` (path anchor is always needed even without a config override).
814
+
815
+ ---
816
+
653
817
  ## Step 2 — [PROJECT-CONFIG] Load module stack profile (conditional)
654
818
 
655
819
  If `tech_stack.module` is set, read `.agent/modules/{module}/stack-profile.yaml`.
@@ -740,6 +904,25 @@ These two variables (`active_module`, `platform_type`) are the canonical source
740
904
 
741
905
  ---
742
906
 
907
+ ## Step 6.7 — [GUARDRAILS] Load Project Lessons (conditional)
908
+
909
+ *Accumulated mistakes the AI must not repeat in this project. These are added over time via `/learn`
910
+ or accepted during `/review-code`, `/fix-bug`, `/debug`.*
911
+
912
+ Resolve the lessons file path:
913
+ - Use `paths.lessons_file` if set (may be service-overridden in umbrella mode, Step 1.6)
914
+ - Else default `specs/domain-knowledge/lessons-learned.md`
915
+ - In umbrella/service mode (when `service_root` is set), if `paths.lessons_file` is unset, default to `{service_root}/.agent/project-lessons.md`
916
+
917
+ If the file exists, read it and store ALL lessons as **ACTIVE GUARDRAILS** for the session:
918
+ - Treat each lesson's **Rule** as a hard constraint — same priority as CLAUDE.md coding standards (Step 3).
919
+ - Before generating or modifying any artifact (PRD, BDD, tech-doc, code, test), check the output against every lesson whose `category` matches the current command AND whose `scope` matches the target (domain / file).
920
+ - If a generated output would violate a lesson → correct it **before** presenting, and note which lesson (`L-NNN`) was applied.
921
+
922
+ If the file does not exist → skip silently (no lessons captured yet).
923
+
924
+ ---
925
+
743
926
  ## Step 7 — [RECAP] Working Memory Recap (anti-lost-in-middle)
744
927
 
745
928
  After loading all context, synthesize and output a compact summary block.
@@ -755,6 +938,9 @@ Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Ser
755
938
  Ticket : {ticket_prefix}-
756
939
  Dict : {loaded — N canonical terms, M banned terms | missing}
757
940
  Entities : {loaded — EntityA, EntityB, EntityC | missing}
941
+ Lessons : {loaded — N guardrails | none yet}
942
+ Service : {active_service} ({active_service_module}) | single-service
943
+ Svc Root : {service_root} — conventions + trace_dir loaded from service config | —
758
944
  Status : {FULL | PARTIAL — missing: CLAUDE.md / business-dict / core-entities | MINIMAL}
759
945
  ```
760
946
 
@@ -882,7 +1068,8 @@ Suggest the logical next command based on workflow phase:
882
1068
  | /define-product | `/generate-prd {product-definition-file}` |
883
1069
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
884
1070
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
885
- | /review-context (PRD) | `/generate-bdd {prd-file}` if APPROVED; fix PRD if NEEDS_FIX |
1071
+ | /review-context (PRD) | FE/App: `/generate-design-spec {prd-file}` (then BDD after sign-off); BE: `/generate-bdd {prd-file}` directly; fix PRD if NEEDS_FIX |
1072
+ | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
886
1073
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
887
1074
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
888
1075
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
@@ -896,6 +1083,11 @@ Suggest the logical next command based on workflow phase:
896
1083
  | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
897
1084
  | /fix-bug | Create PR and link to ticket |
898
1085
  | /debug | `/fix-bug {ticket-id}` if fix needed |
1086
+ | /report-bug | Send to dev (`/fix-bug {BUG-ID}`); if coverage gap → `/propose-scenario {UC-ID}` |
1087
+ | /propose-scenario | Notify PO/Dev to review the proposal in `feedback/bdd-proposals/` |
1088
+ | /learn | Continue working — lesson applies on next command |
1089
+ | /sync | `/validate-traces` for full coverage; act on any `📥 tester feedback` surfaced |
1090
+ | /update-framework | Review `git diff .agent/`, commit; `/sync` for project content |
899
1091
 
900
1092
  Format the footer as:
901
1093
  ```
@@ -0,0 +1,79 @@
1
+ # Capture Lesson — Record a Recurring Mistake as a Guardrail
2
+
3
+ Reusable procedure to persist a "lesson" so the AI does not repeat a mistake in this project.
4
+ Used by `/learn` (manual) and offered by `/review-code`, `/fix-bug`, `/debug` (auto).
5
+
6
+ > **Project memory, not model training.** A lesson is plain text injected into context at the
7
+ > start of every command (context-loader Step 6.7). Functionally this stops the repeat — the AI
8
+ > sees the guardrail before it generates. No model weights change.
9
+
10
+ ## L1 — Resolve the lessons file
11
+
12
+ Resolve `lessons_path` in this order:
13
+ 1. `paths.lessons_file` from loaded context (may be service-overridden in umbrella mode, Step 1.6)
14
+ 2. Default `specs/domain-knowledge/lessons-learned.md` (single-service)
15
+ 3. In umbrella/service mode (when `service_root` is set) default `{service_root}/.agent/project-lessons.md`
16
+
17
+ ## L2 — Build the lesson
18
+
19
+ Gather these fields — from `$ARGUMENTS` (for `/learn`) or from the calling command's findings
20
+ (for `/review-code`, `/fix-bug`, `/debug`):
21
+
22
+ | Field | Meaning |
23
+ |-------|---------|
24
+ | `category` | one of: `code-gen` \| `bdd` \| `tech-docs` \| `tests` \| `prd` \| `general` |
25
+ | `title` | short phrase naming the mistake |
26
+ | `mistake` | concretely, what the AI did wrong |
27
+ | `rule` | imperative correction — "Always …" / "Never …" — testable, not vague |
28
+ | `scope` | where it applies: a domain, a file glob (e.g. `*Controller.*`), or `all` |
29
+ | `source` | how captured: `/learn` \| `/review-code {UC-ID}` \| `/fix-bug {TICKET}` \| `/debug` |
30
+
31
+ If `rule` is vague (e.g. "be careful"), rewrite it into a concrete, checkable instruction before saving.
32
+
33
+ ## L3 — De-duplicate
34
+
35
+ Read existing lessons in `lessons_path`. If one already covers the same mistake:
36
+ - **Refine** that entry (tighten the Rule, widen/narrow Scope, bump Date, append the new Source) — do NOT add a duplicate.
37
+
38
+ Otherwise assign the next id `L-{NNN}` = (highest existing number + 1), zero-padded to 3 digits.
39
+
40
+ ## L4 — Write
41
+
42
+ If `lessons_path` does not exist, create it with this header first:
43
+
44
+ ```markdown
45
+ # Project Lessons — Learned Guardrails
46
+
47
+ > Mistakes the AI must NOT repeat in this project. Loaded by context-loader at the start of
48
+ > every command and treated as hard constraints (same priority as CLAUDE.md coding standards).
49
+ > Add with /learn, or accept the prompt during /review-code, /fix-bug, /debug.
50
+ > Commit this file so the whole team shares the guardrails.
51
+
52
+ | Category | Applies to |
53
+ |----------|-----------|
54
+ | code-gen | /generate-code output |
55
+ | bdd | /generate-bdd output |
56
+ | tech-docs | /generate-tech-docs output |
57
+ | tests | /generate-tests output |
58
+ | prd | /generate-prd, /refine-prd output |
59
+ | general | every command |
60
+
61
+ ---
62
+ ```
63
+
64
+ Insert the new lesson directly under the `---` separator (**newest first**), in this exact shape:
65
+
66
+ ```markdown
67
+ ### L-{NNN} — [{category}] {title}
68
+ - **Date**: {today YYYY-MM-DD}
69
+ - **Scope**: {scope}
70
+ - **Mistake**: {mistake}
71
+ - **Rule**: {rule}
72
+ - **Source**: {source}
73
+
74
+ ```
75
+
76
+ ## L5 — Confirm
77
+
78
+ Print: `📝 Lesson {id} recorded → {lessons_path} ([{category}] {title})`
79
+ Then remind: `Commit {lessons_path} so the team shares this guardrail.`