@edupia-tutor/spec-driven-docs 0.14.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/bin/build.js +230 -0
- package/bin/index.js +598 -0
- package/commands/debug.md +830 -0
- package/commands/debug.tmpl +257 -0
- package/commands/define-product.md +652 -0
- package/commands/define-product.tmpl +158 -0
- package/commands/dev-gen-test.md +1010 -0
- package/commands/dev-gen-test.tmpl +490 -0
- package/commands/dev-run-test.md +744 -0
- package/commands/dev-run-test.tmpl +224 -0
- package/commands/dev-smoke-test.md +711 -0
- package/commands/dev-smoke-test.tmpl +217 -0
- package/commands/fix-bug.md +744 -0
- package/commands/fix-bug.tmpl +171 -0
- package/commands/generate-bdd.md +1054 -0
- package/commands/generate-bdd.tmpl +534 -0
- package/commands/generate-code.md +869 -0
- package/commands/generate-code.tmpl +349 -0
- package/commands/generate-design-spec.md +958 -0
- package/commands/generate-design-spec.tmpl +464 -0
- package/commands/generate-prd.md +748 -0
- package/commands/generate-prd.tmpl +254 -0
- package/commands/generate-spec-manifest.md +658 -0
- package/commands/generate-spec-manifest.tmpl +164 -0
- package/commands/generate-tech-docs.md +849 -0
- package/commands/generate-tech-docs.tmpl +355 -0
- package/commands/learn.md +636 -0
- package/commands/learn.tmpl +63 -0
- package/commands/map-testids.md +575 -0
- package/commands/map-testids.tmpl +81 -0
- package/commands/propose-scenario.md +623 -0
- package/commands/propose-scenario.tmpl +129 -0
- package/commands/qc-analyze.md +580 -0
- package/commands/qc-analyze.tmpl +86 -0
- package/commands/qc-design-test.md +562 -0
- package/commands/qc-design-test.tmpl +68 -0
- package/commands/qc-plan.md +543 -0
- package/commands/qc-plan.tmpl +49 -0
- package/commands/qc-report.md +554 -0
- package/commands/qc-report.tmpl +60 -0
- package/commands/qc-review.md +547 -0
- package/commands/qc-review.tmpl +53 -0
- package/commands/qc-run-test.md +604 -0
- package/commands/qc-run-test.tmpl +84 -0
- package/commands/refine-prd.md +772 -0
- package/commands/refine-prd.tmpl +140 -0
- package/commands/report-bug.md +639 -0
- package/commands/report-bug.tmpl +145 -0
- package/commands/review-code.md +677 -0
- package/commands/review-code.tmpl +104 -0
- package/commands/review-context.md +1047 -0
- package/commands/review-context.tmpl +415 -0
- package/commands/review-tech-docs.md +811 -0
- package/commands/review-tech-docs.tmpl +317 -0
- package/commands/setup-ai-first.md +545 -0
- package/commands/setup-ai-first.tmpl +358 -0
- package/commands/sync.md +451 -0
- package/commands/sync.tmpl +351 -0
- package/commands/update-framework.md +251 -0
- package/commands/update-framework.tmpl +151 -0
- package/commands/validate-traces.md +842 -0
- package/commands/validate-traces.tmpl +348 -0
- package/core/FRAMEWORK_VERSION +1 -0
- package/core/commands/debug.md +830 -0
- package/core/commands/define-product.md +652 -0
- package/core/commands/dev-gen-test.md +1010 -0
- package/core/commands/dev-run-test.md +744 -0
- package/core/commands/dev-smoke-test.md +711 -0
- package/core/commands/fix-bug.md +744 -0
- package/core/commands/generate-bdd.md +1054 -0
- package/core/commands/generate-code.md +869 -0
- package/core/commands/generate-design-spec.md +958 -0
- package/core/commands/generate-prd.md +748 -0
- package/core/commands/generate-spec-manifest.md +658 -0
- package/core/commands/generate-tech-docs.md +849 -0
- package/core/commands/learn.md +636 -0
- package/core/commands/map-testids.md +575 -0
- package/core/commands/propose-scenario.md +623 -0
- package/core/commands/qc-analyze.md +580 -0
- package/core/commands/qc-design-test.md +562 -0
- package/core/commands/qc-plan.md +543 -0
- package/core/commands/qc-report.md +554 -0
- package/core/commands/qc-review.md +547 -0
- package/core/commands/qc-run-test.md +604 -0
- package/core/commands/refine-prd.md +772 -0
- package/core/commands/report-bug.md +639 -0
- package/core/commands/review-code.md +677 -0
- package/core/commands/review-context.md +1047 -0
- package/core/commands/review-tech-docs.md +811 -0
- package/core/commands/setup-ai-first.md +545 -0
- package/core/commands/sync.md +451 -0
- package/core/commands/update-framework.md +251 -0
- package/core/commands/validate-traces.md +842 -0
- package/core/hooks/data-guard.js +141 -0
- package/core/hooks/settings.json +18 -0
- package/core/modules/android-compose/module.yaml +13 -0
- package/core/modules/android-compose/stack-profile.yaml +57 -0
- package/core/modules/angular/architecture-snippets/component-patterns.md +187 -0
- package/core/modules/angular/module.yaml +6 -0
- package/core/modules/angular/stack-profile.yaml +38 -0
- package/core/modules/context-engineering/architecture-snippets/context-design.md +119 -0
- package/core/modules/context-engineering/module.yaml +9 -0
- package/core/modules/context-engineering/stack-profile.yaml +61 -0
- package/core/modules/dotnet/architecture-snippets/clean-arch.md +160 -0
- package/core/modules/dotnet/module.yaml +6 -0
- package/core/modules/dotnet/stack-profile.yaml +50 -0
- package/core/modules/flutter/module.yaml +14 -0
- package/core/modules/flutter/stack-profile.yaml +59 -0
- package/core/modules/golang/architecture-snippets/domain-layout.md +283 -0
- package/core/modules/golang/module.yaml +6 -0
- package/core/modules/golang/stack-profile.yaml +40 -0
- package/core/modules/ios-swiftui/module.yaml +13 -0
- package/core/modules/ios-swiftui/stack-profile.yaml +55 -0
- package/core/modules/java-spring/architecture-snippets/layered-arch.md +201 -0
- package/core/modules/java-spring/module.yaml +15 -0
- package/core/modules/java-spring/stack-profile.yaml +28 -0
- package/core/modules/nextjs/architecture-snippets/app-router-patterns.md +269 -0
- package/core/modules/nextjs/module.yaml +14 -0
- package/core/modules/nextjs/stack-profile.yaml +74 -0
- package/core/modules/nuxt/module.yaml +14 -0
- package/core/modules/nuxt/stack-profile.yaml +58 -0
- package/core/modules/php-laravel/architecture-snippets/service-repository.md +302 -0
- package/core/modules/php-laravel/module.yaml +15 -0
- package/core/modules/php-laravel/stack-profile.yaml +56 -0
- package/core/modules/qc-playwright/stack-profile.yaml +66 -0
- package/core/modules/react/architecture-snippets/hooks-query-patterns.md +254 -0
- package/core/modules/react/module.yaml +14 -0
- package/core/modules/react/stack-profile.yaml +63 -0
- package/core/modules/react-native/module.yaml +14 -0
- package/core/modules/react-native/stack-profile.yaml +56 -0
- package/core/modules/vue/module.yaml +14 -0
- package/core/modules/vue/stack-profile.yaml +65 -0
- package/core/rules/data-protection.md +80 -0
- package/core/rules/workflow.md +44 -0
- package/core/skills/code/SKILL.md +770 -0
- package/core/skills/debug/SKILL.md +869 -0
- package/core/skills/design-spec/SKILL.md +589 -0
- package/core/skills/discovery/SKILL.md +554 -0
- package/core/skills/prd/SKILL.md +562 -0
- package/core/skills/qc/qa-analyst/DOC_GAPS.template.md +63 -0
- package/core/skills/qc/qa-analyst/acceptance-criteria.md +60 -0
- package/core/skills/qc/qa-analyst/business-rules.md +59 -0
- package/core/skills/qc/qa-analyst/data-flow.md +64 -0
- package/core/skills/qc/qa-analyst/spec-breakdown.md +61 -0
- package/core/skills/qc/qa-designer/e2e/journey.md +41 -0
- package/core/skills/qc/qa-designer/exploratory/charter.md +68 -0
- package/core/skills/qc/qa-designer/exploratory/explore-to-functional.md +43 -0
- package/core/skills/qc/qa-designer/functional/api.md +45 -0
- package/core/skills/qc/qa-designer/functional/gui-feature.md +46 -0
- package/core/skills/qc/qa-designer/functional/gui-screen.md +52 -0
- package/core/skills/qc/qa-designer/integration/api.md +42 -0
- package/core/skills/qc/qa-designer/integration/db.md +39 -0
- package/core/skills/qc/qa-designer/integration/gui.md +40 -0
- package/core/skills/qc/qa-designer/integration/kafka.md +40 -0
- package/core/skills/qc/qa-designer/non-functional.md +40 -0
- package/core/skills/qc/qa-planner/test-plan.md +120 -0
- package/core/skills/qc/qa-reviewer/script/e2e.md +87 -0
- package/core/skills/qc/qa-reviewer/script/exploratory.md +45 -0
- package/core/skills/qc/qa-reviewer/script/functional.md +101 -0
- package/core/skills/qc/qa-reviewer/script/integration.md +91 -0
- package/core/skills/qc/qa-reviewer/script/non-functional.md +126 -0
- package/core/skills/qc/qa-reviewer/test-case/e2e.md +73 -0
- package/core/skills/qc/qa-reviewer/test-case/exploratory.md +43 -0
- package/core/skills/qc/qa-reviewer/test-case/functional.md +76 -0
- package/core/skills/qc/qa-reviewer/test-case/integration.md +69 -0
- package/core/skills/qc/qa-reviewer/test-case/non-functional.md +73 -0
- package/core/skills/qc/qa-runner/e2e.md +49 -0
- package/core/skills/qc/qa-runner/exploratory/session.md +36 -0
- package/core/skills/qc/qa-runner/functional/api.md +35 -0
- package/core/skills/qc/qa-runner/functional/gui-feature.md +51 -0
- package/core/skills/qc/qa-runner/functional/gui-screen.md +55 -0
- package/core/skills/qc/qa-runner/integration.md +47 -0
- package/core/skills/qc/qa-runner/non-functional.md +49 -0
- package/core/skills/qc/qa-runner/report/report.md +37 -0
- package/core/skills/setup-ai-first/SKILL.md +216 -0
- package/core/skills/spec/SKILL.md +461 -0
- package/core/skills/test/SKILL.md +1297 -0
- package/core/steps/capture-lesson.md +79 -0
- package/core/steps/context-loader.md +307 -0
- package/core/steps/gate.md +87 -0
- package/core/steps/report-footer.md +100 -0
- package/core/steps/review-fanout.md +138 -0
- package/core/steps/spawn-agent.md +124 -0
- package/core/steps/trace-mirror.md +26 -0
- package/core/templates/architecture.template.md +113 -0
- package/core/templates/design-spec.template.md +217 -0
- package/core/templates/feature.template +259 -0
- package/core/templates/platform-guide.template.md +145 -0
- package/core/templates/prd.template.md +327 -0
- package/core/templates/product-definition.template.md +168 -0
- package/core/templates/project-context.yaml +161 -0
- package/docs/01-getting-started/README.md +19 -0
- package/docs/01-getting-started/core-concepts.md +102 -0
- package/docs/01-getting-started/installation.md +156 -0
- package/docs/01-getting-started/quickstart.md +85 -0
- package/docs/02-guides/README.md +26 -0
- package/docs/02-guides/developer/README.md +46 -0
- package/docs/02-guides/developer/bdd-and-trace.md +125 -0
- package/docs/02-guides/developer/commands.md +76 -0
- package/docs/02-guides/developer/pr-checklist.md +15 -0
- package/docs/02-guides/developer/scenarios.md +460 -0
- package/docs/02-guides/developer/workflow.md +121 -0
- package/docs/02-guides/product-owner/README.md +79 -0
- package/docs/02-guides/product-owner/commands.md +30 -0
- package/docs/02-guides/product-owner/handoff-checklist.md +42 -0
- package/docs/02-guides/product-owner/prd-writing-rules.md +45 -0
- package/docs/02-guides/product-owner/scenarios.md +436 -0
- package/docs/02-guides/tester/README.md +75 -0
- package/docs/02-guides/tester/bug-reporting.md +117 -0
- package/docs/02-guides/tester/qc-automation.md +165 -0
- package/docs/02-guides/tester/reading-specs.md +79 -0
- package/docs/02-guides/tester/scenarios.md +186 -0
- package/docs/02-guides/tester/spec-manifest.md +130 -0
- package/docs/02-guides/tester/test-checklist.md +31 -0
- package/docs/02-guides/tester/workflow.md +77 -0
- package/docs/03-concepts/README.md +19 -0
- package/docs/03-concepts/architecture.md +248 -0
- package/docs/03-concepts/pipeline.md +274 -0
- package/docs/03-concepts/traceability.md +149 -0
- package/docs/04-operations/README.md +33 -0
- package/docs/04-operations/bug-flow.md +362 -0
- package/docs/04-operations/publishing.md +137 -0
- package/docs/04-operations/sync-and-update.md +522 -0
- package/docs/05-reference/README.md +32 -0
- package/docs/05-reference/command-cheatsheet.md +147 -0
- package/docs/05-reference/commands.md +232 -0
- package/docs/05-reference/modules.md +110 -0
- package/docs/05-reference/trace-schema.md +153 -0
- package/docs/README.md +49 -0
- package/hooks/data-guard.js +141 -0
- package/hooks/settings.json +18 -0
- package/modules/android-compose/module.yaml +13 -0
- package/modules/android-compose/stack-profile.yaml +57 -0
- package/modules/angular/architecture-snippets/component-patterns.md +187 -0
- package/modules/angular/module.yaml +6 -0
- package/modules/angular/stack-profile.yaml +38 -0
- package/modules/context-engineering/architecture-snippets/context-design.md +119 -0
- package/modules/context-engineering/module.yaml +9 -0
- package/modules/context-engineering/stack-profile.yaml +61 -0
- package/modules/dotnet/architecture-snippets/clean-arch.md +160 -0
- package/modules/dotnet/module.yaml +6 -0
- package/modules/dotnet/stack-profile.yaml +50 -0
- package/modules/flutter/module.yaml +14 -0
- package/modules/flutter/stack-profile.yaml +59 -0
- package/modules/golang/architecture-snippets/domain-layout.md +283 -0
- package/modules/golang/module.yaml +6 -0
- package/modules/golang/stack-profile.yaml +40 -0
- package/modules/ios-swiftui/module.yaml +13 -0
- package/modules/ios-swiftui/stack-profile.yaml +55 -0
- package/modules/java-spring/architecture-snippets/layered-arch.md +201 -0
- package/modules/java-spring/module.yaml +15 -0
- package/modules/java-spring/stack-profile.yaml +28 -0
- package/modules/nextjs/architecture-snippets/app-router-patterns.md +269 -0
- package/modules/nextjs/module.yaml +14 -0
- package/modules/nextjs/stack-profile.yaml +74 -0
- package/modules/nuxt/module.yaml +14 -0
- package/modules/nuxt/stack-profile.yaml +58 -0
- package/modules/php-laravel/architecture-snippets/service-repository.md +302 -0
- package/modules/php-laravel/module.yaml +15 -0
- package/modules/php-laravel/stack-profile.yaml +56 -0
- package/modules/qc-playwright/stack-profile.yaml +66 -0
- package/modules/react/architecture-snippets/hooks-query-patterns.md +254 -0
- package/modules/react/module.yaml +14 -0
- package/modules/react/stack-profile.yaml +63 -0
- package/modules/react-native/module.yaml +14 -0
- package/modules/react-native/stack-profile.yaml +56 -0
- package/modules/vue/module.yaml +14 -0
- package/modules/vue/stack-profile.yaml +65 -0
- package/package.json +49 -0
- package/rules/data-protection.md +80 -0
- package/rules/workflow.md +44 -0
- package/scripts/init.sh +49 -0
- package/scripts/migrate-specs.js +256 -0
- package/scripts/upgrade.sh +94 -0
- package/skills/code/SKILL.md +770 -0
- package/skills/code/SKILL.tmpl +176 -0
- package/skills/debug/SKILL.md +869 -0
- package/skills/debug/SKILL.tmpl +262 -0
- package/skills/design-spec/SKILL.md +589 -0
- package/skills/design-spec/SKILL.tmpl +95 -0
- package/skills/discovery/SKILL.md +554 -0
- package/skills/discovery/SKILL.tmpl +147 -0
- package/skills/prd/SKILL.md +562 -0
- package/skills/prd/SKILL.tmpl +188 -0
- package/skills/qc/qa-analyst/DOC_GAPS.template.md +63 -0
- package/skills/qc/qa-analyst/acceptance-criteria.md +60 -0
- package/skills/qc/qa-analyst/business-rules.md +59 -0
- package/skills/qc/qa-analyst/data-flow.md +64 -0
- package/skills/qc/qa-analyst/spec-breakdown.md +61 -0
- package/skills/qc/qa-designer/e2e/journey.md +41 -0
- package/skills/qc/qa-designer/exploratory/charter.md +68 -0
- package/skills/qc/qa-designer/exploratory/explore-to-functional.md +43 -0
- package/skills/qc/qa-designer/functional/api.md +45 -0
- package/skills/qc/qa-designer/functional/gui-feature.md +46 -0
- package/skills/qc/qa-designer/functional/gui-screen.md +52 -0
- package/skills/qc/qa-designer/integration/api.md +42 -0
- package/skills/qc/qa-designer/integration/db.md +39 -0
- package/skills/qc/qa-designer/integration/gui.md +40 -0
- package/skills/qc/qa-designer/integration/kafka.md +40 -0
- package/skills/qc/qa-designer/non-functional.md +40 -0
- package/skills/qc/qa-planner/test-plan.md +120 -0
- package/skills/qc/qa-reviewer/script/e2e.md +87 -0
- package/skills/qc/qa-reviewer/script/exploratory.md +45 -0
- package/skills/qc/qa-reviewer/script/functional.md +101 -0
- package/skills/qc/qa-reviewer/script/integration.md +91 -0
- package/skills/qc/qa-reviewer/script/non-functional.md +126 -0
- package/skills/qc/qa-reviewer/test-case/e2e.md +73 -0
- package/skills/qc/qa-reviewer/test-case/exploratory.md +43 -0
- package/skills/qc/qa-reviewer/test-case/functional.md +76 -0
- package/skills/qc/qa-reviewer/test-case/integration.md +69 -0
- package/skills/qc/qa-reviewer/test-case/non-functional.md +73 -0
- package/skills/qc/qa-runner/e2e.md +49 -0
- package/skills/qc/qa-runner/exploratory/session.md +36 -0
- package/skills/qc/qa-runner/functional/api.md +35 -0
- package/skills/qc/qa-runner/functional/gui-feature.md +51 -0
- package/skills/qc/qa-runner/functional/gui-screen.md +55 -0
- package/skills/qc/qa-runner/integration.md +47 -0
- package/skills/qc/qa-runner/non-functional.md +49 -0
- package/skills/qc/qa-runner/report/report.md +37 -0
- package/skills/setup-ai-first/SKILL.md +216 -0
- package/skills/setup-ai-first/SKILL.tmpl +116 -0
- package/skills/spec/SKILL.md +461 -0
- package/skills/spec/SKILL.tmpl +174 -0
- package/skills/test/SKILL.md +1297 -0
- package/skills/test/SKILL.tmpl +296 -0
- package/steps/capture-lesson.md +79 -0
- package/steps/context-loader.md +307 -0
- package/steps/gate.md +87 -0
- package/steps/report-footer.md +100 -0
- package/steps/review-fanout.md +138 -0
- package/steps/spawn-agent.md +124 -0
- package/steps/trace-mirror.md +26 -0
- package/templates/architecture.template.md +113 -0
- package/templates/design-spec.template.md +217 -0
- package/templates/feature.template +259 -0
- package/templates/platform-guide.template.md +145 -0
- package/templates/prd.template.md +327 -0
- package/templates/product-definition.template.md +168 -0
- package/templates/project-context.yaml +161 -0
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Generates unit and integration tests from BDD specs, runs the test suite and reports results, or dev-smoke-tests live API endpoints on a running service. Trigger when: "/dev-gen-test", "/dev-run-test", "/dev-smoke-test", "tạo test", "viết test", "chạy test", "generate tests", "run tests", "test kết quả", "smoke test", "test API", "kiểm tra endpoint đang chạy".
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Test Skills — Generate, Run & Smoke Test
|
|
6
|
+
|
|
7
|
+
This skill handles three commands: `/dev-gen-test`, `/dev-run-test`, and `/dev-smoke-test`.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## /dev-gen-test — Generate Unit & Integration Tests
|
|
12
|
+
|
|
13
|
+
### Gate
|
|
14
|
+
|
|
15
|
+
<!-- Directory: specs/*/*/bdd/*.feature — or pass UC-ID/class path as argument -->
|
|
16
|
+
{{include:steps/gate.md}}
|
|
17
|
+
|
|
18
|
+
Also read:
|
|
19
|
+
- `.feature` file to understand expected behaviors
|
|
20
|
+
- Find files to test: Controllers with `@trace.implements={UC-ID}`, Service implementations, Facade implementations (if applicable)
|
|
21
|
+
|
|
22
|
+
### CHECKPOINT — Test Plan
|
|
23
|
+
|
|
24
|
+
Before generating, present plan:
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
Test Plan — {UC-ID}:
|
|
28
|
+
|
|
29
|
+
Unit Tests ({unit test framework}):
|
|
30
|
+
- {ServiceName}ServiceImplTest
|
|
31
|
+
• {method}: {scenario} → {expected result}
|
|
32
|
+
- {FacadeName}FacadeImplTest (if applicable)
|
|
33
|
+
• {method}: {scenario} → {expected result}
|
|
34
|
+
|
|
35
|
+
Integration Tests:
|
|
36
|
+
- {ControllerName}ControllerTest
|
|
37
|
+
• {endpoint}: {scenario} → HTTP {status}
|
|
38
|
+
|
|
39
|
+
Total: {N} test classes, ~{M} test cases
|
|
40
|
+
Proceed? (Y/N)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Wait for confirmation.
|
|
44
|
+
|
|
45
|
+
### Generate
|
|
46
|
+
|
|
47
|
+
#### Unit Test Template
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
// @trace.verifies={UC-ID}
|
|
51
|
+
// @trace.test_type=unit
|
|
52
|
+
[Test class using your project's test framework]
|
|
53
|
+
|
|
54
|
+
class {Resource}ServiceImplTest {
|
|
55
|
+
|
|
56
|
+
// Mock dependencies
|
|
57
|
+
|
|
58
|
+
@Test
|
|
59
|
+
// "Should {expected outcome} when {condition}"
|
|
60
|
+
void methodName_whenValid_shouldReturnExpected() {
|
|
61
|
+
// Given — set up mocks and inputs
|
|
62
|
+
// When — call the method under test
|
|
63
|
+
// Then — assert results and verify interactions
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
@Test
|
|
67
|
+
// "Should throw {Exception} when {resource} not found"
|
|
68
|
+
void methodName_whenNotFound_shouldThrowException() {
|
|
69
|
+
// Given — mock returns empty/null
|
|
70
|
+
// When & Then — assert exception is thrown
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
#### Integration Test Template (Controller/HTTP layer)
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
// @trace.verifies={UC-ID}
|
|
79
|
+
// @trace.test_type=integration
|
|
80
|
+
[Integration test class for HTTP layer]
|
|
81
|
+
|
|
82
|
+
class {Resource}ControllerTest {
|
|
83
|
+
|
|
84
|
+
// Inject MockMvc or HTTP test client
|
|
85
|
+
// MockBean/stub the Facade/Service
|
|
86
|
+
|
|
87
|
+
@Test
|
|
88
|
+
// "GET /v1/{resource} - should return 200 with data"
|
|
89
|
+
void filter_shouldReturn200() {
|
|
90
|
+
// Given — stub facade/service
|
|
91
|
+
// When — perform HTTP GET
|
|
92
|
+
// Then — assert status 200 and response body
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
@Test
|
|
96
|
+
// "POST /v1/{resource} - should return 201 when valid"
|
|
97
|
+
void create_shouldReturn201() {
|
|
98
|
+
// Given — stub facade/service
|
|
99
|
+
// When — perform HTTP POST with valid body
|
|
100
|
+
// Then — assert status 201
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
@Test
|
|
104
|
+
// "POST /v1/{resource} - should return 400 when invalid"
|
|
105
|
+
void create_shouldReturn400WhenInvalid() {
|
|
106
|
+
// Given — no stub needed
|
|
107
|
+
// When — perform HTTP POST with missing required fields
|
|
108
|
+
// Then — assert status 400
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### File Placement
|
|
114
|
+
|
|
115
|
+
Follow project test structure from CLAUDE.md. Typical:
|
|
116
|
+
```
|
|
117
|
+
src/test/{language}/{package}/
|
|
118
|
+
├── service/impl/{Resource}ServiceImplTest.{ext}
|
|
119
|
+
├── facade/impl/{Resource}FacadeImplTest.{ext} (if applicable)
|
|
120
|
+
└── controller/{Resource}ControllerTest.{ext}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Self-Review Checklist
|
|
124
|
+
|
|
125
|
+
- [ ] `@trace.verifies` tag on every test class
|
|
126
|
+
- [ ] Every scenario in .feature has at least one test
|
|
127
|
+
- [ ] Mock only the correct layer (no repo mocks in controller tests)
|
|
128
|
+
- [ ] Test names follow `methodName_whenCondition_shouldOutcome` pattern
|
|
129
|
+
- [ ] No debug print statements in tests
|
|
130
|
+
|
|
131
|
+
### Output
|
|
132
|
+
|
|
133
|
+
```
|
|
134
|
+
/dev-gen-test Complete — {UC-ID}:
|
|
135
|
+
✅ service/{Service}Test.{ext} ({M} tests)
|
|
136
|
+
✅ facade/{Facade}Test.{ext} ({M} tests)
|
|
137
|
+
✅ controller/{Controller}Test.{ext} ({M} tests)
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
{{include:steps/report-footer.md}}
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## /dev-run-test — Run Tests & Report Results
|
|
145
|
+
|
|
146
|
+
### Gate
|
|
147
|
+
|
|
148
|
+
{{include:steps/context-loader.md}}
|
|
149
|
+
|
|
150
|
+
Identify service/module from argument (UC-ID or service name).
|
|
151
|
+
Read `conventions.test_command` from the loaded project context.
|
|
152
|
+
|
|
153
|
+
### Run
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
# Run all tests in module
|
|
157
|
+
{TEST_COMMAND}
|
|
158
|
+
|
|
159
|
+
# Run specific test class (faster)
|
|
160
|
+
{TEST_COMMAND_FOR_CLASS}
|
|
161
|
+
|
|
162
|
+
# Run by pattern
|
|
163
|
+
{TEST_COMMAND_BY_PATTERN}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Analyze Results
|
|
167
|
+
|
|
168
|
+
#### When tests PASS
|
|
169
|
+
|
|
170
|
+
```
|
|
171
|
+
✅ Tests passed
|
|
172
|
+
- Total: {N}
|
|
173
|
+
- Passed: {N}
|
|
174
|
+
- Duration: {X}s
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
#### When tests FAIL — Debug Mode
|
|
178
|
+
|
|
179
|
+
Read stack trace and analyze:
|
|
180
|
+
|
|
181
|
+
| Error Pattern | Common Cause | Suggested Fix |
|
|
182
|
+
|---|---|---|
|
|
183
|
+
| NullPointerException in test | Missing mock setup | Check `given(...)` setup for null dependency |
|
|
184
|
+
| Bean/dependency not found | Missing mock/stub declaration | Add mock for missing dependency |
|
|
185
|
+
| Expected 200 but got 403 | Missing auth setup in test | Add auth user/role to test context |
|
|
186
|
+
| Expected 200 but got 400 | Request body fails validation | Check required fields in request DTO |
|
|
187
|
+
| LazyInitializationException | Lazy collection accessed outside transaction | Add `@Transactional` on test or use eager fetch |
|
|
188
|
+
| Mapper/mapper implementation not found | Code generator (e.g. MapStruct) not run | Run compile step before tests |
|
|
189
|
+
|
|
190
|
+
### Output
|
|
191
|
+
|
|
192
|
+
```
|
|
193
|
+
/dev-run-test Report — {service}
|
|
194
|
+
Run at: {datetime}
|
|
195
|
+
|
|
196
|
+
## Summary
|
|
197
|
+
✅ Passed: {N} | ❌ Failed: {M} | ⏭️ Skipped: {K}
|
|
198
|
+
Duration: {X}s
|
|
199
|
+
|
|
200
|
+
## Failed Tests
|
|
201
|
+
| Test | Error | Root Cause |
|
|
202
|
+
|------|-------|-----------|
|
|
203
|
+
| {TestClass}.{method} | {exception} | {analysis} |
|
|
204
|
+
|
|
205
|
+
## Recommendations
|
|
206
|
+
{specific fix for each failure}
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
{{include:steps/report-footer.md}}
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## /dev-smoke-test — Test Live API Endpoints
|
|
214
|
+
|
|
215
|
+
Use when the service is **already running** to verify endpoints work correctly.
|
|
216
|
+
Different from `/dev-run-test` (which runs unit/integration tests without a live server).
|
|
217
|
+
|
|
218
|
+
### Phase 1 — Find Service URL
|
|
219
|
+
|
|
220
|
+
{{include:steps/context-loader.md}}
|
|
221
|
+
|
|
222
|
+
Read `conventions.service_run` from the loaded project context to find port.
|
|
223
|
+
Default: `http://localhost:8080`
|
|
224
|
+
|
|
225
|
+
Check if service is running:
|
|
226
|
+
```bash
|
|
227
|
+
curl -s http://localhost:{port}/health
|
|
228
|
+
# or /actuator/health for Spring Boot
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
If not running: "Service is not running. Start it with: `{RUN_COMMAND}` from your project root."
|
|
232
|
+
|
|
233
|
+
### Phase 2 — Identify Endpoints
|
|
234
|
+
|
|
235
|
+
From UC-ID → find Controller with `@trace.implements={UC-ID}`:
|
|
236
|
+
- List: method, path, required auth/role
|
|
237
|
+
|
|
238
|
+
### Phase 3 — Get Auth Token (if needed)
|
|
239
|
+
|
|
240
|
+
If endpoints require auth, ask:
|
|
241
|
+
```
|
|
242
|
+
This endpoint requires authentication. Options:
|
|
243
|
+
1. Paste your Bearer token (from Postman / browser DevTools / test login)
|
|
244
|
+
2. Use a test/dev token from your local config
|
|
245
|
+
3. Skip auth — only test public endpoints
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### Phase 4 — Run Smoke Test
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
# GET
|
|
252
|
+
curl -s -X GET "http://localhost:{port}/v1/{resource}?page=0&size=5" \
|
|
253
|
+
-H "Authorization: Bearer {token}" | {JSON_FORMATTER}
|
|
254
|
+
|
|
255
|
+
# POST
|
|
256
|
+
curl -s -X POST "http://localhost:{port}/v1/{resource}" \
|
|
257
|
+
-H "Authorization: Bearer {token}" \
|
|
258
|
+
-H "Content-Type: application/json" \
|
|
259
|
+
-d '{"field1": "test_value"}'
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
### Phase 5 — Interpret Results
|
|
263
|
+
|
|
264
|
+
| Result | Meaning |
|
|
265
|
+
|--------|---------|
|
|
266
|
+
| 200/201 + correct data | ✅ OK |
|
|
267
|
+
| 200 + wrong data | ⚠️ Logic bug → use `/debug` |
|
|
268
|
+
| 400 | Request body wrong → check required fields |
|
|
269
|
+
| 401 | Token expired or wrong realm |
|
|
270
|
+
| 403 | Wrong role → check auth config |
|
|
271
|
+
| 500 + stacktrace | Server error → paste into `/debug` |
|
|
272
|
+
| Connection refused | Service not running or wrong port |
|
|
273
|
+
|
|
274
|
+
If errors in logs:
|
|
275
|
+
```bash
|
|
276
|
+
tail -n 100 {LOG_FILE_PATH}
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### Output
|
|
280
|
+
|
|
281
|
+
```
|
|
282
|
+
/dev-smoke-test Report — {UC-ID}
|
|
283
|
+
Tested at: {datetime}
|
|
284
|
+
Base URL: http://localhost:{port}
|
|
285
|
+
|
|
286
|
+
## Endpoints Tested
|
|
287
|
+
| Method | Path | Status | Result |
|
|
288
|
+
|--------|------|--------|--------|
|
|
289
|
+
| GET | /v1/{resource} | 200 ✅ | 5 records returned |
|
|
290
|
+
| POST | /v1/{resource} | 201 ✅ | Created id=42 |
|
|
291
|
+
|
|
292
|
+
## Issues Found
|
|
293
|
+
{describe any failures}
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
{{include:steps/report-footer.md}}
|
|
@@ -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 | /dev-gen-test 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.`
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
# Context Loader — Load All Project Context
|
|
2
|
+
|
|
3
|
+
Execute these steps in order. Store everything in memory for the duration of the command session.
|
|
4
|
+
|
|
5
|
+
**Priority guide (anti-lost-in-middle):**
|
|
6
|
+
- Steps 1–2 are PROJECT-CONFIG — loaded first, resolve all paths and metadata.
|
|
7
|
+
- Step 3 is CRITICAL — architecture + coding standards, the highest-priority facts for generation.
|
|
8
|
+
- Step 4 is SAFETY — data protection rules, enforced silently for the entire session.
|
|
9
|
+
- Steps 5–6 are DOMAIN KNOWLEDGE — terminology and entity definitions.
|
|
10
|
+
- Step 7 is the WORKING MEMORY RECAP — locks critical facts into the top of working memory.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Step 1 — [PROJECT-CONFIG] Load project-context.yaml
|
|
15
|
+
|
|
16
|
+
Read `.agent/project-context.yaml`. Extract and store:
|
|
17
|
+
|
|
18
|
+
**Tech Stack:**
|
|
19
|
+
- `tech_stack.language` → active language (e.g., Java 17, TypeScript, C#, Go)
|
|
20
|
+
- `tech_stack.framework` → active framework (e.g., Spring Boot 3.2, Angular 17, .NET 8)
|
|
21
|
+
- `tech_stack.build_tool` → build tool (e.g., Maven, npm, dotnet, go)
|
|
22
|
+
- `tech_stack.test_framework` → test framework (e.g., JUnit 5 + Mockito, Jest, xUnit)
|
|
23
|
+
- `tech_stack.database` → database (e.g., PostgreSQL, MySQL, MongoDB)
|
|
24
|
+
- `tech_stack.module` → active module profile (e.g., java-spring, angular, dotnet, golang, context-engineering)
|
|
25
|
+
|
|
26
|
+
**Conventions:**
|
|
27
|
+
- `conventions.build_command` → how to compile/build
|
|
28
|
+
- `conventions.test_command` → how to run tests
|
|
29
|
+
- `conventions.service_run` → how to start the service
|
|
30
|
+
- `conventions.ticket_prefix` → ticket ID prefix (e.g., PROJ, FEAT, UC)
|
|
31
|
+
|
|
32
|
+
**Domains:**
|
|
33
|
+
- `domains` → list of active business domains
|
|
34
|
+
|
|
35
|
+
**Paths (if present):**
|
|
36
|
+
- `paths.specs_dir` → spec artifacts root — PRD, BDD, tech-docs, design-spec. Structure: `{specs_dir}/{domain}/{prd-slug}/{prd.md | bdd/ | tech-docs/ | design-spec/}`
|
|
37
|
+
- `paths.refinement_dir` → findings/review output dir
|
|
38
|
+
- `paths.qc_dir` → QC automation artifacts root (visible top-level, one subfolder per UC: `{qc_dir}/{UC-ID}/`)
|
|
39
|
+
- `paths.qc_skills_dir` → where qc-* commands load QC skills from (default bundled `.agent/skills/qc`; override to the QC team's own repo/submodule so framework upgrade won't overwrite them)
|
|
40
|
+
- `paths.product_definitions_dir` → product definitions root
|
|
41
|
+
- `paths.domain_knowledge_dir` → domain knowledge root
|
|
42
|
+
- `paths.business_dictionary` → path to business-dictionary.md
|
|
43
|
+
- `paths.core_entities` → path to core-entities.md
|
|
44
|
+
- `paths.tech_docs_dir` → technical documentation root (merged with specs_dir in feature-package layout — tech-docs live under `{specs_dir}/{domain}/{prd-slug}/tech-docs/`)
|
|
45
|
+
- `paths.trace_dir` → trace state directory; structure: `.trace/{domain}/{prd-slug}/{UC-ID}.tsv`
|
|
46
|
+
|
|
47
|
+
If `paths` section is absent, use these defaults:
|
|
48
|
+
- `specs_dir` = `specs`
|
|
49
|
+
- `refinement_dir` = `.agent/review`
|
|
50
|
+
- `qc_dir` = `docs`
|
|
51
|
+
- `qc_skills_dir` = `.agent/skills/qc`
|
|
52
|
+
- `product_definitions_dir` = `specs/product-definition`
|
|
53
|
+
- `domain_knowledge_dir` = `specs/domain-knowledge`
|
|
54
|
+
- `business_dictionary` = `specs/domain-knowledge/business-dictionary.md`
|
|
55
|
+
- `core_entities` = `specs/domain-knowledge/core-entities.md`
|
|
56
|
+
- `tech_docs_dir` = `specs`
|
|
57
|
+
- `trace_dir` = `.trace`
|
|
58
|
+
|
|
59
|
+
Note: In the feature-package layout, `specs_dir` is the unified root. All spec artifact types (PRD, BDD, tech-docs, design-spec) live under `{specs_dir}/{domain}/{prd-slug}/`. The `prd-slug` is the feature-package folder name, not a separate config variable.
|
|
60
|
+
|
|
61
|
+
**How to extract `prd_slug` (works for ANY target file, regardless of nesting depth):** given a target path of the form `{specs_dir}/{domain}/{prd-slug}/...`, take the **first path segment after `{specs_dir}/{domain}/`** — i.e. the `{prd-slug}` position. Do NOT use the file's immediate parent folder, because BDD/tech-docs/design-spec artifacts are nested one or two levels deeper inside the package. Examples:
|
|
62
|
+
- `specs/payment/create-invoice/prd.md` → `prd_slug = create-invoice`
|
|
63
|
+
- `specs/payment/create-invoice/bdd/system/PAY-UC1.feature` → `prd_slug = create-invoice` *(NOT `system`)*
|
|
64
|
+
- `specs/payment/create-invoice/bdd/web/PAY-UC1.feature` → `prd_slug = create-invoice` *(NOT `web`)*
|
|
65
|
+
- `specs/payment/create-invoice/tech-docs/PAY-UC1-tech-design.md` → `prd_slug = create-invoice` *(NOT `tech-docs`)*
|
|
66
|
+
- `specs/payment/create-invoice/design-spec/PAY-design-spec-web.md` → `prd_slug = create-invoice`
|
|
67
|
+
|
|
68
|
+
All sibling artifacts of one feature (PRD, every platform's BDD, the BE + FE tech-docs, the design-spec, and the trace TSV) therefore resolve to the **same `prd_slug`** — so a synthesized **system** BDD or **system/BE** tech-doc lands in the same `{specs_dir}/{domain}/{prd-slug}/` package as the web/app artifacts it was derived from.
|
|
69
|
+
|
|
70
|
+
If `tech_stack.module` is set, also load `.agent/modules/{module}/stack-profile.yaml` if it exists.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Step 1.5 — [SERVICE ROUTING] Resolve service paths (umbrella mode)
|
|
75
|
+
|
|
76
|
+
*Skip this step entirely if `setup.mode` is not `"umbrella"` and `services` section is absent from project-context.yaml.*
|
|
77
|
+
|
|
78
|
+
If `services` section is present:
|
|
79
|
+
|
|
80
|
+
**1. Detect active domain** (in priority order):
|
|
81
|
+
- Read `@trace.domain` from target file frontmatter (if Gate loaded a target file)
|
|
82
|
+
- Extract from target file path: `domain` = the first segment after the `specs_dir` base path; `prd_slug` = the next segment (the feature-package folder). This holds for any target depth — see the `prd_slug` extraction rule in Step 1.
|
|
83
|
+
*(e.g., `specs/user/create-account/prd.md` **and** `specs/user/create-account/bdd/system/UC1.feature` both → domain = `user`, prd_slug = `create-account`)*
|
|
84
|
+
- If `$ARGUMENTS` contains a path, extract the domain segment after `specs_dir`
|
|
85
|
+
|
|
86
|
+
**2. Route to service** — if active domain matches a key in `services`:
|
|
87
|
+
- Override `paths.specs_dir` → `services.{domain}.specs_dir` — **only if `setup.spec_source` is NOT set.** When `spec_source` IS set, ALL BDD (web/app/**system**) is a shared cross-team artifact → leave `specs_dir` for step 4 to route to the spec repo; do NOT pin it per-service here.
|
|
88
|
+
- Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir` — **only if `setup.spec_source` is NOT set.** When `spec_source` IS set, the tech-design (API contract) is a cross-team artifact and must live in the shared spec repo (handled in step 4), so leave `tech_docs_dir` for step 4 to route — do NOT pin it per-service here.
|
|
89
|
+
- Store `active_service` = `services.{domain}.path`
|
|
90
|
+
- Store `active_service_module` = `services.{domain}.module`
|
|
91
|
+
- If service has its own `module` → use it as `active_module` (overrides `tech_stack.module`)
|
|
92
|
+
|
|
93
|
+
**3. Fallback** — if domain not detected or no matching service key:
|
|
94
|
+
- Keep default paths from Step 1
|
|
95
|
+
- Set `active_service = unresolved`
|
|
96
|
+
|
|
97
|
+
**4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
|
|
98
|
+
- Override `paths.specs_dir` → `{spec_source}/specs` — **always when `spec_source` is set.** All spec artifacts (PRD, BDD, tech-docs, design-spec) live under the unified spec root in the shared spec repo using the feature-package layout: `{spec_source}/specs/{domain}/{prd-slug}/`. Every umbrella (FE/App/BE) reads from here. *(Per-service `specs/` only when there is no `spec_source`.)*
|
|
99
|
+
- Override `paths.tech_docs_dir` → `{spec_source}/specs` — **always when `spec_source` is set** (step 2 no longer pins tech-docs per-service in this case). Tech-docs live at `{spec_source}/specs/{domain}/{prd-slug}/tech-docs/`. The tech-design IS the cross-team API contract: BE authors it here, and FE/App read it from the same spec submodule at `/generate-code --phase=integration`. *(Per-service tech-docs only happen when there is no `spec_source` — a pure multi-service BE repo with no shared spec module.)*
|
|
100
|
+
- Override `paths.domain_knowledge_dir` → `{spec_source}/specs/domain-knowledge`
|
|
101
|
+
- Override `paths.business_dictionary` → `{spec_source}/specs/domain-knowledge/business-dictionary.md`
|
|
102
|
+
- Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
|
|
103
|
+
- Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
|
|
104
|
+
- Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
|
|
105
|
+
- Override `paths.prd_change_requests_dir` → `{spec_source}/feedback/prd-change-requests`
|
|
106
|
+
- Override `paths.trace_dir` → `{spec_source}/.trace` — **always when `spec_source` is set.** Trace TSVs are consolidated in the spec repo (single authoritative location, no per-service split) so the PM/PO has one place to manage status. Internal structure: `.trace/{domain}/{prd-slug}/{UC-ID}.tsv`. Code-side commands (`/generate-code`, `/dev-run-test`, `/qc-run-test`) run from `service_root` but **write their trace row into `{spec_source}/.trace/{domain}/{prd-slug}/`** — like they already push `feedback/` there. *(Per-service `.trace` only when there is no `spec_source`.)*
|
|
107
|
+
|
|
108
|
+
> **Why under `spec_source`:** PRD, BDD, tech-docs, design-spec, domain knowledge, tester feedback, **and the `.trace/` coverage state** are all **cross-team artifacts** — they live in the **shared spec repo** using the feature-package layout so every umbrella (FE/App/BE) and the PM read one source via `/sync`. In the feature-package layout, a single `specs/{domain}/{prd-slug}/` folder groups all artifact types for one PRD, making the spec repo self-contained and navigable by feature. The service submodule holds only **code** (+ build/test tooling). `.trace/` and `feedback/` are the dev/QC **write areas** in the spec repo. In single-service mode (no `spec_source`), everything defaults under the repo root — still one repo.
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Step 1.6 — [SERVICE CONVENTIONS] Load service-specific conventions (umbrella mode)
|
|
113
|
+
|
|
114
|
+
*Skip this step entirely if `active_service` is `"unresolved"` or context is single-service mode.*
|
|
115
|
+
|
|
116
|
+
When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-service/`):
|
|
117
|
+
|
|
118
|
+
**1. Locate service config** — try in priority order:
|
|
119
|
+
- `{active_service}/.agent/project-context.yaml`
|
|
120
|
+
- `{active_service}/project-context.yaml`
|
|
121
|
+
|
|
122
|
+
**2. If found, override with service-specific values:**
|
|
123
|
+
|
|
124
|
+
| Variable | Source |
|
|
125
|
+
|----------|--------|
|
|
126
|
+
| `conventions.test_command` | service's `conventions.test_command` |
|
|
127
|
+
| `conventions.build_command` | service's `conventions.build_command` |
|
|
128
|
+
| `paths.trace_dir` | **If `spec_source` is set → keep the Step 4 spec-repo route (`{spec_source}/.trace`); ignore any service-level `trace_dir`.** Only when there is no `spec_source`: `{active_service}/{service paths.trace_dir}` (default `{active_service}/.trace`). |
|
|
129
|
+
| `paths.specs_dir` | **If `spec_source` is set → keep the Step 4 spec-repo route (`{spec_source}/specs`); ignore any service-level `specs_dir`** (all spec artifacts are cross-team, never per-service in this mode). Only when there is no `spec_source`: `{active_service}/{service paths.specs_dir}` if set, else the Step 1.5 override. |
|
|
130
|
+
|
|
131
|
+
**3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
|
|
132
|
+
- Shell commands (`/dev-run-test`, `/dev-gen-test`) run **from within** `service_root`
|
|
133
|
+
- **Source/test files** are written relative to `service_root`; **trace TSVs** are written to `{paths.trace_dir}` (the spec repo when `spec_source` is set — a cross-repo write, committed/pushed to the spec submodule like `feedback/`).
|
|
134
|
+
|
|
135
|
+
**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).
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Step 2 — [PROJECT-CONFIG] Load module stack profile (conditional)
|
|
140
|
+
|
|
141
|
+
If `tech_stack.module` is set, read `.agent/modules/{module}/stack-profile.yaml`.
|
|
142
|
+
Merge framework-specific conventions (layer patterns, test patterns, naming rules) into the loaded context.
|
|
143
|
+
If the file does not exist → skip silently.
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## Step 3 — [CRITICAL] Load CLAUDE.md (layered: root + service overlay)
|
|
148
|
+
|
|
149
|
+
*This is the highest-priority context — it defines HOW to write code and documents for this project.*
|
|
150
|
+
|
|
151
|
+
CLAUDE.md is loaded in **two layers** so umbrella-wide rules and service-specific
|
|
152
|
+
architecture/coding standards compose correctly. The agent always sits at the umbrella
|
|
153
|
+
root, but the implementation code lives in a service submodule with its OWN stack,
|
|
154
|
+
architecture, and conventions — so the service's CLAUDE.md must win for code generation.
|
|
155
|
+
|
|
156
|
+
**Layer 1 — [BASE] Root CLAUDE.md (umbrella-wide).**
|
|
157
|
+
Read `CLAUDE.md` at the repo root. Treat its contents as the **shared baseline** for the
|
|
158
|
+
whole umbrella — git conventions, data-protection posture, cross-cutting rules, and (in
|
|
159
|
+
single-service mode) the project's only architecture + coding standards.
|
|
160
|
+
|
|
161
|
+
**Layer 2 — [OVERLAY] Service CLAUDE.md (umbrella mode only).**
|
|
162
|
+
*Run only if `service_root` was set in Step 1.6 (i.e. a real service was routed to).*
|
|
163
|
+
Read `{service_root}/CLAUDE.md`. This file defines the architecture + coding standards of
|
|
164
|
+
the **actual stack being implemented** (e.g. `user-service` = java-spring, `web` = nextjs).
|
|
165
|
+
Overlay it on top of Layer 1: **on any conflict, the service value WINS** for architecture,
|
|
166
|
+
coding standards, and error handling. Layer-1 values that the service does not redefine
|
|
167
|
+
(e.g. git conventions, banned patterns shared org-wide) remain in effect.
|
|
168
|
+
|
|
169
|
+
From the **merged** result, extract and store:
|
|
170
|
+
|
|
171
|
+
- **§1 Project Overview** → project name, language, framework, build/test commands, domains
|
|
172
|
+
- **§2 Architecture** → layer order (e.g., Controller → Facade → Service → Repository), architectural rules — *service overlay wins*
|
|
173
|
+
- **§3 Coding Standards** → naming conventions (classes, methods), response wrapper type, forbidden patterns — *service overlay wins*
|
|
174
|
+
- **§5 Error Handling** → exception types, HTTP status code mapping, not-found exception class name — *service overlay wins*
|
|
175
|
+
- **§7 Git Conventions** → branch naming pattern, commit message format — *root baseline unless service redefines*
|
|
176
|
+
|
|
177
|
+
**Resolution rules:**
|
|
178
|
+
- If both layers exist → merge as above; record `claude_md_source = root + {service_root}`.
|
|
179
|
+
- If only the service overlay exists (no root CLAUDE.md) → use the service file alone; `claude_md_source = {service_root}`.
|
|
180
|
+
- If `service_root` is set but `{service_root}/CLAUDE.md` is **missing** → fall back to root CLAUDE.md and flag ⚠️ in the Step 7 recap (the service has no architecture/coding-standards definition — code generation will use umbrella defaults, which may be the wrong stack).
|
|
181
|
+
- If neither exists → note CLAUDE.md as missing and continue with project-context.yaml data only.
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## Step 4 — [SAFETY] Load Data Protection Rules
|
|
186
|
+
|
|
187
|
+
Read `.agent/rules/data-protection.md` (or `rules/data-protection.md` from the framework installation).
|
|
188
|
+
|
|
189
|
+
Store the sensitive file patterns — you must **never** read, write, display, or reference content from files matching those patterns for the entire session.
|
|
190
|
+
|
|
191
|
+
If neither file exists → apply built-in defaults: never access `.env*`, `*.key`, `*.pem`, `*secret*`, `*password*`, `*credential*`.
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## Step 5 — [DOMAIN] Load Business Dictionary (conditional)
|
|
196
|
+
|
|
197
|
+
Check if the business dictionary file exists (use `paths.business_dictionary` resolved in Step 1).
|
|
198
|
+
|
|
199
|
+
If it exists, read it and extract:
|
|
200
|
+
- **Canonical Terms** → complete list of approved terms and their definitions
|
|
201
|
+
- **Banned Terms** → complete list of banned terms and their canonical replacements
|
|
202
|
+
- **Status / Enum Registry** → allowed enum values per entity
|
|
203
|
+
|
|
204
|
+
Store the banned terms list for **active enforcement** throughout the command session:
|
|
205
|
+
- When generating any text (PRD, BDD, code comments, tech docs), verify no banned terms appear
|
|
206
|
+
- Replace banned terms with their canonical equivalents automatically
|
|
207
|
+
|
|
208
|
+
If the file does not exist → skip silently. Do not warn or block.
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## Step 6 — [DOMAIN] Load Core Entities (conditional)
|
|
213
|
+
|
|
214
|
+
Check if the core entities file exists at `paths.core_entities` (resolved in Step 1).
|
|
215
|
+
Default path: `specs/domain-knowledge/core-entities.md`.
|
|
216
|
+
|
|
217
|
+
If it exists, read it and store:
|
|
218
|
+
- **Entity catalog** → for each entity: its name, purpose, owner service, key fields (name + type), business invariants, and relationships
|
|
219
|
+
- **Field name registry** → canonical field names to use in generated code and documents
|
|
220
|
+
- **Relationship map** → how entities relate to each other (1:N, N:N, embedded, etc.)
|
|
221
|
+
|
|
222
|
+
**How to use this catalog:**
|
|
223
|
+
- When generating code: use the field names, types, and relationships defined here — do NOT infer from existing code
|
|
224
|
+
- When generating PRD/BDD: reference entity names from this catalog for consistency
|
|
225
|
+
- When generating tech-docs: use this catalog as the source-of-truth for entity definitions
|
|
226
|
+
|
|
227
|
+
If the file does not exist → skip silently.
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
## Step 6.5 — [PLATFORM] Derive active_module and platform_type
|
|
232
|
+
|
|
233
|
+
Using `tech_stack.module` loaded in Step 1, derive and store two variables for use by all downstream commands:
|
|
234
|
+
|
|
235
|
+
```
|
|
236
|
+
active_module = tech_stack.module (e.g. "java-spring", "react", "flutter")
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
| `platform_type` | Modules |
|
|
240
|
+
|---|---|
|
|
241
|
+
| `backend` | `java-spring`, `golang`, `dotnet`, `php-laravel`, `context-engineering` |
|
|
242
|
+
| `web-frontend` | `react`, `nextjs`, `vue`, `nuxt`, `angular` |
|
|
243
|
+
| `mobile` | `flutter`, `react-native`, `ios-swiftui`, `android-compose` |
|
|
244
|
+
|
|
245
|
+
If `tech_stack.module` is blank or not recognized → set `platform_type = "unknown"` and flag as ⚠️ in the Step 7 recap.
|
|
246
|
+
|
|
247
|
+
These two variables (`active_module`, `platform_type`) are the canonical source for all branching logic in commands that need platform-specific behavior (dev-gen-test, debug, fix-bug, dev-smoke-test).
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
## Step 6.7 — [GUARDRAILS] Load Project Lessons (conditional)
|
|
252
|
+
|
|
253
|
+
*Accumulated mistakes the AI must not repeat in this project. These are added over time via `/learn`
|
|
254
|
+
or accepted during `/review-code`, `/fix-bug`, `/debug`.*
|
|
255
|
+
|
|
256
|
+
Resolve the lessons file path:
|
|
257
|
+
- Use `paths.lessons_file` if set (may be service-overridden in umbrella mode, Step 1.6)
|
|
258
|
+
- Else default `specs/domain-knowledge/lessons-learned.md`
|
|
259
|
+
- In umbrella/service mode (when `service_root` is set), if `paths.lessons_file` is unset, default to `{service_root}/.agent/project-lessons.md`
|
|
260
|
+
|
|
261
|
+
If the file exists, read it and store ALL lessons as **ACTIVE GUARDRAILS** for the session:
|
|
262
|
+
- Treat each lesson's **Rule** as a hard constraint — same priority as CLAUDE.md coding standards (Step 3).
|
|
263
|
+
- 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).
|
|
264
|
+
- If a generated output would violate a lesson → correct it **before** presenting, and note which lesson (`L-NNN`) was applied.
|
|
265
|
+
|
|
266
|
+
If the file does not exist → skip silently (no lessons captured yet).
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## Step 7 — [RECAP] Working Memory Recap (anti-lost-in-middle)
|
|
271
|
+
|
|
272
|
+
After loading all context, synthesize and output a compact summary block.
|
|
273
|
+
This recap ensures the most critical facts are stated at the END of context loading
|
|
274
|
+
(recency effect — freshest in working memory when the task begins).
|
|
275
|
+
|
|
276
|
+
Output exactly this block:
|
|
277
|
+
```
|
|
278
|
+
[CTX LOADED]
|
|
279
|
+
Stack : {language} / {framework} / {database}
|
|
280
|
+
Platform : {active_module} ({platform_type})
|
|
281
|
+
Layers : {layer order from merged CLAUDE.md §2, e.g., Controller → Facade → Service → Repository}
|
|
282
|
+
CLAUDE.md : {root + {service_root} | {service_root} only | root only | ⚠️ service overlay MISSING — using root | missing}
|
|
283
|
+
Ticket : {ticket_prefix}-
|
|
284
|
+
Dict : {loaded — N canonical terms, M banned terms | missing}
|
|
285
|
+
Entities : {loaded — EntityA, EntityB, EntityC | missing}
|
|
286
|
+
Lessons : {loaded — N guardrails | none yet}
|
|
287
|
+
Service : {active_service} ({active_service_module}) | single-service
|
|
288
|
+
Svc Root : {service_root} — conventions + trace_dir loaded from service config | —
|
|
289
|
+
Status : {FULL | PARTIAL — missing: CLAUDE.md / business-dict / core-entities | MINIMAL}
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
If any CRITICAL file is missing (CLAUDE.md), flag it clearly so the user can decide whether to proceed.
|
|
293
|
+
|
|
294
|
+
---
|
|
295
|
+
|
|
296
|
+
## Context Load Complete
|
|
297
|
+
|
|
298
|
+
After completing all steps, you have loaded:
|
|
299
|
+
- Project identity, tech stack, module conventions
|
|
300
|
+
- Architecture rules and layer order ← **[CRITICAL — hold in working memory]**
|
|
301
|
+
- Coding standards and naming conventions ← **[CRITICAL — hold in working memory]**
|
|
302
|
+
- Data protection rules (sensitive file patterns to never access)
|
|
303
|
+
- Terminology rules with banned-term list ← **[DOMAIN — apply to every generated word]**
|
|
304
|
+
- Entity catalog (field names, types, invariants) ← **[DOMAIN — use for code generation]**
|
|
305
|
+
- All configured paths
|
|
306
|
+
|
|
307
|
+
Proceed to the next step of the calling command.
|