@anhth2/spec-driven-dev-plugin 0.8.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.
- package/ARCHITECTURE.md +6 -2
- package/commands/debug.md +152 -0
- package/commands/debug.tmpl +16 -0
- package/commands/define-product.md +57 -0
- package/commands/fix-bug.md +153 -0
- package/commands/fix-bug.tmpl +17 -0
- package/commands/generate-bdd.md +277 -13
- package/commands/generate-bdd.tmpl +220 -13
- package/commands/generate-code.md +154 -2
- package/commands/generate-code.tmpl +97 -2
- package/commands/generate-design-spec.md +57 -0
- package/commands/generate-prd.md +75 -0
- package/commands/generate-prd.tmpl +18 -0
- package/commands/generate-spec-manifest.md +57 -0
- package/commands/generate-tech-docs.md +79 -1
- package/commands/generate-tech-docs.tmpl +22 -1
- package/commands/generate-tests.md +57 -0
- package/commands/learn.md +554 -0
- package/commands/learn.tmpl +63 -0
- package/commands/propose-scenario.md +521 -0
- package/commands/propose-scenario.tmpl +109 -0
- package/commands/refine-prd.md +57 -0
- package/commands/report-bug.md +543 -0
- package/commands/report-bug.tmpl +131 -0
- package/commands/review-code.md +153 -0
- package/commands/review-code.tmpl +17 -0
- package/commands/review-context.md +57 -0
- package/commands/review-tech-docs.md +139 -4
- package/commands/review-tech-docs.tmpl +82 -4
- package/commands/run-tests.md +82 -0
- package/commands/run-tests.tmpl +25 -0
- package/commands/setup-ai-first.md +15 -5
- package/commands/setup-ai-first.tmpl +10 -5
- package/commands/smoke-test.md +57 -0
- package/commands/sync.md +405 -0
- package/commands/sync.tmpl +345 -0
- package/commands/update-framework.md +211 -0
- package/commands/update-framework.tmpl +151 -0
- package/commands/validate-traces.md +115 -2
- package/commands/validate-traces.tmpl +58 -2
- package/core/FRAMEWORK_VERSION +1 -1
- package/core/commands/debug.md +152 -0
- package/core/commands/define-product.md +57 -0
- package/core/commands/fix-bug.md +153 -0
- package/core/commands/generate-bdd.md +277 -13
- package/core/commands/generate-code.md +154 -2
- package/core/commands/generate-design-spec.md +57 -0
- package/core/commands/generate-prd.md +75 -0
- package/core/commands/generate-spec-manifest.md +57 -0
- package/core/commands/generate-tech-docs.md +79 -1
- package/core/commands/generate-tests.md +57 -0
- package/core/commands/learn.md +554 -0
- package/core/commands/propose-scenario.md +521 -0
- package/core/commands/refine-prd.md +57 -0
- package/core/commands/report-bug.md +543 -0
- package/core/commands/review-code.md +153 -0
- package/core/commands/review-context.md +57 -0
- package/core/commands/review-tech-docs.md +139 -4
- package/core/commands/run-tests.md +82 -0
- package/core/commands/setup-ai-first.md +15 -5
- package/core/commands/smoke-test.md +57 -0
- package/core/commands/sync.md +405 -0
- package/core/commands/update-framework.md +211 -0
- package/core/commands/validate-traces.md +115 -2
- package/core/skills/code/SKILL.md +62 -0
- package/core/skills/debug/SKILL.md +67 -0
- package/core/skills/design-spec/SKILL.md +57 -0
- package/core/skills/discovery/SKILL.md +57 -0
- package/core/skills/prd/SKILL.md +10 -0
- package/core/skills/setup-ai-first/SKILL.md +5 -0
- package/core/skills/spec/SKILL.md +10 -0
- package/core/skills/test/SKILL.md +119 -0
- package/core/steps/capture-lesson.md +79 -0
- package/core/steps/context-loader.md +52 -0
- package/core/steps/report-footer.md +5 -0
- package/core/templates/project-context.yaml +11 -0
- package/package.json +1 -1
- package/skills/code/SKILL.md +62 -0
- package/skills/debug/SKILL.md +67 -0
- package/skills/design-spec/SKILL.md +57 -0
- package/skills/discovery/SKILL.md +57 -0
- package/skills/prd/SKILL.md +10 -0
- package/skills/setup-ai-first/SKILL.md +5 -0
- package/skills/spec/SKILL.md +10 -0
- package/skills/test/SKILL.md +119 -0
- package/steps/capture-lesson.md +79 -0
- package/steps/context-loader.md +52 -0
- package/steps/report-footer.md +5 -0
- package/templates/project-context.yaml +11 -0
package/skills/debug/SKILL.md
CHANGED
|
@@ -120,6 +120,37 @@ If `services` section is present:
|
|
|
120
120
|
- Override `paths.domain_knowledge_dir` → `{spec_source}/specs/domain-knowledge`
|
|
121
121
|
- Override `paths.business_dictionary` → `{spec_source}/specs/domain-knowledge/business-dictionary.md`
|
|
122
122
|
- Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
|
|
123
|
+
- Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
|
|
124
|
+
- Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
|
|
125
|
+
|
|
126
|
+
> **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.
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## Step 1.6 — [SERVICE CONVENTIONS] Load service-specific conventions (umbrella mode)
|
|
131
|
+
|
|
132
|
+
*Skip this step entirely if `active_service` is `"unresolved"` or context is single-service mode.*
|
|
133
|
+
|
|
134
|
+
When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-service/`):
|
|
135
|
+
|
|
136
|
+
**1. Locate service config** — try in priority order:
|
|
137
|
+
- `{active_service}/.agent/project-context.yaml`
|
|
138
|
+
- `{active_service}/project-context.yaml`
|
|
139
|
+
|
|
140
|
+
**2. If found, override with service-specific values:**
|
|
141
|
+
|
|
142
|
+
| Variable | Source |
|
|
143
|
+
|----------|--------|
|
|
144
|
+
| `conventions.test_command` | service's `conventions.test_command` |
|
|
145
|
+
| `conventions.build_command` | service's `conventions.build_command` |
|
|
146
|
+
| `paths.trace_dir` | `{active_service}/{service paths.trace_dir}` — default: `{active_service}/.trace` |
|
|
147
|
+
| `paths.specs_dir` | `{active_service}/{service paths.specs_dir}` (if set in service config, else keep Step 1.5 override) |
|
|
148
|
+
|
|
149
|
+
**3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
|
|
150
|
+
- Shell commands (`/run-tests`, `/generate-tests`) run **from within** `service_root`
|
|
151
|
+
- File write operations (test files, trace TSVs) use paths **relative to** `service_root`
|
|
152
|
+
|
|
153
|
+
**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).
|
|
123
154
|
|
|
124
155
|
---
|
|
125
156
|
|
|
@@ -213,6 +244,25 @@ These two variables (`active_module`, `platform_type`) are the canonical source
|
|
|
213
244
|
|
|
214
245
|
---
|
|
215
246
|
|
|
247
|
+
## Step 6.7 — [GUARDRAILS] Load Project Lessons (conditional)
|
|
248
|
+
|
|
249
|
+
*Accumulated mistakes the AI must not repeat in this project. These are added over time via `/learn`
|
|
250
|
+
or accepted during `/review-code`, `/fix-bug`, `/debug`.*
|
|
251
|
+
|
|
252
|
+
Resolve the lessons file path:
|
|
253
|
+
- Use `paths.lessons_file` if set (may be service-overridden in umbrella mode, Step 1.6)
|
|
254
|
+
- Else default `specs/domain-knowledge/lessons-learned.md`
|
|
255
|
+
- In umbrella/service mode (when `service_root` is set), if `paths.lessons_file` is unset, default to `{service_root}/.agent/project-lessons.md`
|
|
256
|
+
|
|
257
|
+
If the file exists, read it and store ALL lessons as **ACTIVE GUARDRAILS** for the session:
|
|
258
|
+
- Treat each lesson's **Rule** as a hard constraint — same priority as CLAUDE.md coding standards (Step 3).
|
|
259
|
+
- 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).
|
|
260
|
+
- If a generated output would violate a lesson → correct it **before** presenting, and note which lesson (`L-NNN`) was applied.
|
|
261
|
+
|
|
262
|
+
If the file does not exist → skip silently (no lessons captured yet).
|
|
263
|
+
|
|
264
|
+
---
|
|
265
|
+
|
|
216
266
|
## Step 7 — [RECAP] Working Memory Recap (anti-lost-in-middle)
|
|
217
267
|
|
|
218
268
|
After loading all context, synthesize and output a compact summary block.
|
|
@@ -228,7 +278,9 @@ Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Ser
|
|
|
228
278
|
Ticket : {ticket_prefix}-
|
|
229
279
|
Dict : {loaded — N canonical terms, M banned terms | missing}
|
|
230
280
|
Entities : {loaded — EntityA, EntityB, EntityC | missing}
|
|
281
|
+
Lessons : {loaded — N guardrails | none yet}
|
|
231
282
|
Service : {active_service} ({active_service_module}) | single-service
|
|
283
|
+
Svc Root : {service_root} — conventions + trace_dir loaded from service config | —
|
|
232
284
|
Status : {FULL | PARTIAL — missing: CLAUDE.md / business-dict / core-entities | MINIMAL}
|
|
233
285
|
```
|
|
234
286
|
|
|
@@ -400,6 +452,11 @@ Suggest the logical next command based on workflow phase:
|
|
|
400
452
|
| /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
|
|
401
453
|
| /fix-bug | Create PR and link to ticket |
|
|
402
454
|
| /debug | `/fix-bug {ticket-id}` if fix needed |
|
|
455
|
+
| /report-bug | Send to dev (`/fix-bug {BUG-ID}`); if coverage gap → `/propose-scenario {UC-ID}` |
|
|
456
|
+
| /propose-scenario | Notify PO/Dev to review the proposal in `feedback/bdd-proposals/` |
|
|
457
|
+
| /learn | Continue working — lesson applies on next command |
|
|
458
|
+
| /sync | `/validate-traces` for full coverage; act on any `📥 tester feedback` surfaced |
|
|
459
|
+
| /update-framework | Review `git diff .agent/`, commit; `/sync` for project content |
|
|
403
460
|
|
|
404
461
|
Format the footer as:
|
|
405
462
|
```
|
|
@@ -539,6 +596,11 @@ Suggest the logical next command based on workflow phase:
|
|
|
539
596
|
| /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
|
|
540
597
|
| /fix-bug | Create PR and link to ticket |
|
|
541
598
|
| /debug | `/fix-bug {ticket-id}` if fix needed |
|
|
599
|
+
| /report-bug | Send to dev (`/fix-bug {BUG-ID}`); if coverage gap → `/propose-scenario {UC-ID}` |
|
|
600
|
+
| /propose-scenario | Notify PO/Dev to review the proposal in `feedback/bdd-proposals/` |
|
|
601
|
+
| /learn | Continue working — lesson applies on next command |
|
|
602
|
+
| /sync | `/validate-traces` for full coverage; act on any `📥 tester feedback` surfaced |
|
|
603
|
+
| /update-framework | Review `git diff .agent/`, commit; `/sync` for project content |
|
|
542
604
|
|
|
543
605
|
Format the footer as:
|
|
544
606
|
```
|
|
@@ -635,6 +697,11 @@ Suggest the logical next command based on workflow phase:
|
|
|
635
697
|
| /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
|
|
636
698
|
| /fix-bug | Create PR and link to ticket |
|
|
637
699
|
| /debug | `/fix-bug {ticket-id}` if fix needed |
|
|
700
|
+
| /report-bug | Send to dev (`/fix-bug {BUG-ID}`); if coverage gap → `/propose-scenario {UC-ID}` |
|
|
701
|
+
| /propose-scenario | Notify PO/Dev to review the proposal in `feedback/bdd-proposals/` |
|
|
702
|
+
| /learn | Continue working — lesson applies on next command |
|
|
703
|
+
| /sync | `/validate-traces` for full coverage; act on any `📥 tester feedback` surfaced |
|
|
704
|
+
| /update-framework | Review `git diff .agent/`, commit; `/sync` for project content |
|
|
638
705
|
|
|
639
706
|
Format the footer as:
|
|
640
707
|
```
|
|
@@ -194,6 +194,37 @@ If `services` section is present:
|
|
|
194
194
|
- Override `paths.domain_knowledge_dir` → `{spec_source}/specs/domain-knowledge`
|
|
195
195
|
- Override `paths.business_dictionary` → `{spec_source}/specs/domain-knowledge/business-dictionary.md`
|
|
196
196
|
- Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
|
|
197
|
+
- Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
|
|
198
|
+
- Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
|
|
199
|
+
|
|
200
|
+
> **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.
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## Step 1.6 — [SERVICE CONVENTIONS] Load service-specific conventions (umbrella mode)
|
|
205
|
+
|
|
206
|
+
*Skip this step entirely if `active_service` is `"unresolved"` or context is single-service mode.*
|
|
207
|
+
|
|
208
|
+
When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-service/`):
|
|
209
|
+
|
|
210
|
+
**1. Locate service config** — try in priority order:
|
|
211
|
+
- `{active_service}/.agent/project-context.yaml`
|
|
212
|
+
- `{active_service}/project-context.yaml`
|
|
213
|
+
|
|
214
|
+
**2. If found, override with service-specific values:**
|
|
215
|
+
|
|
216
|
+
| Variable | Source |
|
|
217
|
+
|----------|--------|
|
|
218
|
+
| `conventions.test_command` | service's `conventions.test_command` |
|
|
219
|
+
| `conventions.build_command` | service's `conventions.build_command` |
|
|
220
|
+
| `paths.trace_dir` | `{active_service}/{service paths.trace_dir}` — default: `{active_service}/.trace` |
|
|
221
|
+
| `paths.specs_dir` | `{active_service}/{service paths.specs_dir}` (if set in service config, else keep Step 1.5 override) |
|
|
222
|
+
|
|
223
|
+
**3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
|
|
224
|
+
- Shell commands (`/run-tests`, `/generate-tests`) run **from within** `service_root`
|
|
225
|
+
- File write operations (test files, trace TSVs) use paths **relative to** `service_root`
|
|
226
|
+
|
|
227
|
+
**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).
|
|
197
228
|
|
|
198
229
|
---
|
|
199
230
|
|
|
@@ -287,6 +318,25 @@ These two variables (`active_module`, `platform_type`) are the canonical source
|
|
|
287
318
|
|
|
288
319
|
---
|
|
289
320
|
|
|
321
|
+
## Step 6.7 — [GUARDRAILS] Load Project Lessons (conditional)
|
|
322
|
+
|
|
323
|
+
*Accumulated mistakes the AI must not repeat in this project. These are added over time via `/learn`
|
|
324
|
+
or accepted during `/review-code`, `/fix-bug`, `/debug`.*
|
|
325
|
+
|
|
326
|
+
Resolve the lessons file path:
|
|
327
|
+
- Use `paths.lessons_file` if set (may be service-overridden in umbrella mode, Step 1.6)
|
|
328
|
+
- Else default `specs/domain-knowledge/lessons-learned.md`
|
|
329
|
+
- In umbrella/service mode (when `service_root` is set), if `paths.lessons_file` is unset, default to `{service_root}/.agent/project-lessons.md`
|
|
330
|
+
|
|
331
|
+
If the file exists, read it and store ALL lessons as **ACTIVE GUARDRAILS** for the session:
|
|
332
|
+
- Treat each lesson's **Rule** as a hard constraint — same priority as CLAUDE.md coding standards (Step 3).
|
|
333
|
+
- 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).
|
|
334
|
+
- If a generated output would violate a lesson → correct it **before** presenting, and note which lesson (`L-NNN`) was applied.
|
|
335
|
+
|
|
336
|
+
If the file does not exist → skip silently (no lessons captured yet).
|
|
337
|
+
|
|
338
|
+
---
|
|
339
|
+
|
|
290
340
|
## Step 7 — [RECAP] Working Memory Recap (anti-lost-in-middle)
|
|
291
341
|
|
|
292
342
|
After loading all context, synthesize and output a compact summary block.
|
|
@@ -302,7 +352,9 @@ Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Ser
|
|
|
302
352
|
Ticket : {ticket_prefix}-
|
|
303
353
|
Dict : {loaded — N canonical terms, M banned terms | missing}
|
|
304
354
|
Entities : {loaded — EntityA, EntityB, EntityC | missing}
|
|
355
|
+
Lessons : {loaded — N guardrails | none yet}
|
|
305
356
|
Service : {active_service} ({active_service_module}) | single-service
|
|
357
|
+
Svc Root : {service_root} — conventions + trace_dir loaded from service config | —
|
|
306
358
|
Status : {FULL | PARTIAL — missing: CLAUDE.md / business-dict / core-entities | MINIMAL}
|
|
307
359
|
```
|
|
308
360
|
|
|
@@ -429,6 +481,11 @@ Suggest the logical next command based on workflow phase:
|
|
|
429
481
|
| /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
|
|
430
482
|
| /fix-bug | Create PR and link to ticket |
|
|
431
483
|
| /debug | `/fix-bug {ticket-id}` if fix needed |
|
|
484
|
+
| /report-bug | Send to dev (`/fix-bug {BUG-ID}`); if coverage gap → `/propose-scenario {UC-ID}` |
|
|
485
|
+
| /propose-scenario | Notify PO/Dev to review the proposal in `feedback/bdd-proposals/` |
|
|
486
|
+
| /learn | Continue working — lesson applies on next command |
|
|
487
|
+
| /sync | `/validate-traces` for full coverage; act on any `📥 tester feedback` surfaced |
|
|
488
|
+
| /update-framework | Review `git diff .agent/`, commit; `/sync` for project content |
|
|
432
489
|
|
|
433
490
|
Format the footer as:
|
|
434
491
|
```
|
|
@@ -99,6 +99,37 @@ If `services` section is present:
|
|
|
99
99
|
- Override `paths.domain_knowledge_dir` → `{spec_source}/specs/domain-knowledge`
|
|
100
100
|
- Override `paths.business_dictionary` → `{spec_source}/specs/domain-knowledge/business-dictionary.md`
|
|
101
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).
|
|
102
133
|
|
|
103
134
|
---
|
|
104
135
|
|
|
@@ -192,6 +223,25 @@ These two variables (`active_module`, `platform_type`) are the canonical source
|
|
|
192
223
|
|
|
193
224
|
---
|
|
194
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
|
+
|
|
195
245
|
## Step 7 — [RECAP] Working Memory Recap (anti-lost-in-middle)
|
|
196
246
|
|
|
197
247
|
After loading all context, synthesize and output a compact summary block.
|
|
@@ -207,7 +257,9 @@ Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Ser
|
|
|
207
257
|
Ticket : {ticket_prefix}-
|
|
208
258
|
Dict : {loaded — N canonical terms, M banned terms | missing}
|
|
209
259
|
Entities : {loaded — EntityA, EntityB, EntityC | missing}
|
|
260
|
+
Lessons : {loaded — N guardrails | none yet}
|
|
210
261
|
Service : {active_service} ({active_service_module}) | single-service
|
|
262
|
+
Svc Root : {service_root} — conventions + trace_dir loaded from service config | —
|
|
211
263
|
Status : {FULL | PARTIAL — missing: CLAUDE.md / business-dict / core-entities | MINIMAL}
|
|
212
264
|
```
|
|
213
265
|
|
|
@@ -410,6 +462,11 @@ Suggest the logical next command based on workflow phase:
|
|
|
410
462
|
| /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
|
|
411
463
|
| /fix-bug | Create PR and link to ticket |
|
|
412
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 |
|
|
413
470
|
|
|
414
471
|
Format the footer as:
|
|
415
472
|
```
|
package/skills/prd/SKILL.md
CHANGED
|
@@ -205,6 +205,11 @@ Suggest the logical next command based on workflow phase:
|
|
|
205
205
|
| /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
|
|
206
206
|
| /fix-bug | Create PR and link to ticket |
|
|
207
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 |
|
|
208
213
|
|
|
209
214
|
Format the footer as:
|
|
210
215
|
```
|
|
@@ -449,6 +454,11 @@ Suggest the logical next command based on workflow phase:
|
|
|
449
454
|
| /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
|
|
450
455
|
| /fix-bug | Create PR and link to ticket |
|
|
451
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 |
|
|
452
462
|
|
|
453
463
|
Format the footer as:
|
|
454
464
|
```
|
|
@@ -151,6 +151,11 @@ Suggest the logical next command based on workflow phase:
|
|
|
151
151
|
| /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
|
|
152
152
|
| /fix-bug | Create PR and link to ticket |
|
|
153
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 |
|
|
154
159
|
|
|
155
160
|
Format the footer as:
|
|
156
161
|
```
|
package/skills/spec/SKILL.md
CHANGED
|
@@ -222,6 +222,11 @@ Suggest the logical next command based on workflow phase:
|
|
|
222
222
|
| /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
|
|
223
223
|
| /fix-bug | Create PR and link to ticket |
|
|
224
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 |
|
|
225
230
|
|
|
226
231
|
Format the footer as:
|
|
227
232
|
```
|
|
@@ -354,6 +359,11 @@ Suggest the logical next command based on workflow phase:
|
|
|
354
359
|
| /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
|
|
355
360
|
| /fix-bug | Create PR and link to ticket |
|
|
356
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 |
|
|
357
367
|
|
|
358
368
|
Format the footer as:
|
|
359
369
|
```
|
package/skills/test/SKILL.md
CHANGED
|
@@ -265,6 +265,11 @@ Suggest the logical next command based on workflow phase:
|
|
|
265
265
|
| /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
|
|
266
266
|
| /fix-bug | Create PR and link to ticket |
|
|
267
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 |
|
|
268
273
|
|
|
269
274
|
Format the footer as:
|
|
270
275
|
```
|
|
@@ -372,6 +377,37 @@ If `services` section is present:
|
|
|
372
377
|
- Override `paths.domain_knowledge_dir` → `{spec_source}/specs/domain-knowledge`
|
|
373
378
|
- Override `paths.business_dictionary` → `{spec_source}/specs/domain-knowledge/business-dictionary.md`
|
|
374
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).
|
|
375
411
|
|
|
376
412
|
---
|
|
377
413
|
|
|
@@ -465,6 +501,25 @@ These two variables (`active_module`, `platform_type`) are the canonical source
|
|
|
465
501
|
|
|
466
502
|
---
|
|
467
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
|
+
|
|
468
523
|
## Step 7 — [RECAP] Working Memory Recap (anti-lost-in-middle)
|
|
469
524
|
|
|
470
525
|
After loading all context, synthesize and output a compact summary block.
|
|
@@ -480,7 +535,9 @@ Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Ser
|
|
|
480
535
|
Ticket : {ticket_prefix}-
|
|
481
536
|
Dict : {loaded — N canonical terms, M banned terms | missing}
|
|
482
537
|
Entities : {loaded — EntityA, EntityB, EntityC | missing}
|
|
538
|
+
Lessons : {loaded — N guardrails | none yet}
|
|
483
539
|
Service : {active_service} ({active_service_module}) | single-service
|
|
540
|
+
Svc Root : {service_root} — conventions + trace_dir loaded from service config | —
|
|
484
541
|
Status : {FULL | PARTIAL — missing: CLAUDE.md / business-dict / core-entities | MINIMAL}
|
|
485
542
|
```
|
|
486
543
|
|
|
@@ -608,6 +665,11 @@ Suggest the logical next command based on workflow phase:
|
|
|
608
665
|
| /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
|
|
609
666
|
| /fix-bug | Create PR and link to ticket |
|
|
610
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 |
|
|
611
673
|
|
|
612
674
|
Format the footer as:
|
|
613
675
|
```
|
|
@@ -718,6 +780,37 @@ If `services` section is present:
|
|
|
718
780
|
- Override `paths.domain_knowledge_dir` → `{spec_source}/specs/domain-knowledge`
|
|
719
781
|
- Override `paths.business_dictionary` → `{spec_source}/specs/domain-knowledge/business-dictionary.md`
|
|
720
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).
|
|
721
814
|
|
|
722
815
|
---
|
|
723
816
|
|
|
@@ -811,6 +904,25 @@ These two variables (`active_module`, `platform_type`) are the canonical source
|
|
|
811
904
|
|
|
812
905
|
---
|
|
813
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
|
+
|
|
814
926
|
## Step 7 — [RECAP] Working Memory Recap (anti-lost-in-middle)
|
|
815
927
|
|
|
816
928
|
After loading all context, synthesize and output a compact summary block.
|
|
@@ -826,7 +938,9 @@ Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Ser
|
|
|
826
938
|
Ticket : {ticket_prefix}-
|
|
827
939
|
Dict : {loaded — N canonical terms, M banned terms | missing}
|
|
828
940
|
Entities : {loaded — EntityA, EntityB, EntityC | missing}
|
|
941
|
+
Lessons : {loaded — N guardrails | none yet}
|
|
829
942
|
Service : {active_service} ({active_service_module}) | single-service
|
|
943
|
+
Svc Root : {service_root} — conventions + trace_dir loaded from service config | —
|
|
830
944
|
Status : {FULL | PARTIAL — missing: CLAUDE.md / business-dict / core-entities | MINIMAL}
|
|
831
945
|
```
|
|
832
946
|
|
|
@@ -969,6 +1083,11 @@ Suggest the logical next command based on workflow phase:
|
|
|
969
1083
|
| /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
|
|
970
1084
|
| /fix-bug | Create PR and link to ticket |
|
|
971
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 |
|
|
972
1091
|
|
|
973
1092
|
Format the footer as:
|
|
974
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.`
|