@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,460 @@
|
|
|
1
|
+
[📚 Docs](../../README.md) › [Guides](../README.md) › [Developer](README.md) › Tình huống thực tế
|
|
2
|
+
|
|
3
|
+
# Tình Huống Thực Tế
|
|
4
|
+
|
|
5
|
+
- [1. Nhận PRD + BDD mới và bắt đầu work](#tình-huống-1-nhận-prd--bdd-mới-và-bắt-đầu-work)
|
|
6
|
+
- [2. Đọc và hiểu System BDD (BE dev)](#tình-huống-2-đọc-và-hiểu-system-bdd-be-dev)
|
|
7
|
+
- [3. Đọc Web/App BDD (FE/App dev)](#tình-huống-3-đọc-webapp-bdd-feapp-dev)
|
|
8
|
+
- [4. PRD thay đổi mid-sprint](#tình-huống-4-prd-thay-đổi-mid-sprint)
|
|
9
|
+
- [4b. Chờ API design — BE + FE/App đồng thuận](#tình-huống-4b-chờ-api-design--be--feapp-đồng-thuận)
|
|
10
|
+
- [5. Nhận bug report từ Tester](#tình-huống-5-nhận-bug-report-từ-tester)
|
|
11
|
+
- [6. Nhận Design Spec + BDD từ PO (FE/App)](#tình-huống-6-nhận-design-spec--bdd-từ-po-feapp)
|
|
12
|
+
- [7b. Brownfield — API đã tồn tại](#tình-huống-7b-brownfield--api-đã-tồn-tại-trên-hệ-thống-cũ)
|
|
13
|
+
- [7. Setup service submodule (Umbrella)](#tình-huống-7-setup-service-submodule-umbrella-mode)
|
|
14
|
+
- [8. Validate traces trước khi tạo PR lớn](#tình-huống-8-validate-traces-trước-khi-tạo-pr-lớn)
|
|
15
|
+
|
|
16
|
+
## Tình huống 1: Nhận PRD + BDD mới và bắt đầu work
|
|
17
|
+
|
|
18
|
+
**Bối cảnh:** PO thông báo PRD `FT-042-checkout.md` và BDD đã approved, sẵn sàng implement.
|
|
19
|
+
```
|
|
20
|
+
1. git submodule update --remote my-project-specs
|
|
21
|
+
(lấy PRD + BDD mới nhất từ PO)
|
|
22
|
+
|
|
23
|
+
2. /review-context my-project-specs/specs/payment/checkout/prd.md
|
|
24
|
+
→ Kiểm tra @trace.status = approved (không code khi còn draft)
|
|
25
|
+
→ Đọc kỹ AC, UC, BR
|
|
26
|
+
|
|
27
|
+
3. Đọc BDD tương ứng theo platform của mình:
|
|
28
|
+
FE/Web: my-project-specs/specs/payment/checkout/bdd/web/FT-042-UC*.feature
|
|
29
|
+
App: my-project-specs/specs/payment/checkout/bdd/app/FT-042-UC*.feature
|
|
30
|
+
BE: my-project-specs/specs/payment/checkout/bdd/system/FT-042-UC*.feature
|
|
31
|
+
|
|
32
|
+
4. Nếu có thắc mắc về PRD hoặc BDD → hỏi PO ngay, không tự suy diễn
|
|
33
|
+
Ví dụ: "BR5 trong System BDD nói 'kiểm tra giới hạn thanh toán' — limit này
|
|
34
|
+
có khác nhau theo tier user không? BDD không chỉ rõ."
|
|
35
|
+
|
|
36
|
+
5. Bắt đầu: /generate-tech-docs dựa trên BDD
|
|
37
|
+
```
|
|
38
|
+
**Lưu ý:** Nếu `/review-context` báo P0 warning (domain không match config) → **dừng lại**, báo PO/DevOps fix config trước.
|
|
39
|
+
|
|
40
|
+
## Tình huống 2: Đọc và hiểu System BDD (BE dev)
|
|
41
|
+
|
|
42
|
+
**Bối cảnh:** BE dev nhận thông báo BDD đã sẵn sàng tại `specs/auth/login/bdd/system/`.
|
|
43
|
+
|
|
44
|
+
**System BDD tập trung vào:** API contracts được tổng hợp từ FE + App BDD · Business rule enforcement tại system level · Data contracts (request/response shape) · Cross-platform consistency.
|
|
45
|
+
```
|
|
46
|
+
# Đọc file BDD (không generate):
|
|
47
|
+
my-project-specs/specs/auth/login/bdd/system/FT-001-UC1-login-system.feature
|
|
48
|
+
```
|
|
49
|
+
```gherkin
|
|
50
|
+
# Ví dụ System BDD do PO gen (tổng hợp từ web + app BDD)
|
|
51
|
+
Feature: User Authentication — System Contract
|
|
52
|
+
# @trace.prd: FT-001
|
|
53
|
+
# @trace.platform: system
|
|
54
|
+
|
|
55
|
+
Scenario: Successful login returns token and profile
|
|
56
|
+
Given a registered user with valid credentials
|
|
57
|
+
When the system receives a login request
|
|
58
|
+
Then the system returns an auth token
|
|
59
|
+
And the system returns the user profile
|
|
60
|
+
And the session is valid for 3600 seconds
|
|
61
|
+
|
|
62
|
+
Scenario: Account locked after 5 failed attempts
|
|
63
|
+
Given a user with 4 failed login attempts
|
|
64
|
+
When the system receives a 5th failed login
|
|
65
|
+
Then the system locks the account for 30 minutes
|
|
66
|
+
And the system signals the locked state with remaining time
|
|
67
|
+
```
|
|
68
|
+
BE dev dùng System BDD để: thiết kế API endpoint + response schema (`/generate-tech-docs`) · generate code skeleton (`/generate-code`) · viết integration tests (`/dev-gen-test`).
|
|
69
|
+
|
|
70
|
+
> **Đọc annotation `@system.resolution:` ở header (nếu có).** Khi web & app kỳ vọng response khác nhau, PO đã chốt cách giải quyết lúc gen System BDD — build contract đúng kiểu đó, **đừng tự đổi**:
|
|
71
|
+
> - `union` → trả tất cả field cho mọi client (`{ token, redirect_url, user_profile }`).
|
|
72
|
+
> - `platform-hint` → đọc header `X-Platform: web|app`, tailor response (System BDD dùng `Scenario Outline` + Examples).
|
|
73
|
+
> - `separate-endpoints` → mỗi platform một endpoint (`/auth/login/web` · `/auth/login/app`).
|
|
74
|
+
>
|
|
75
|
+
> Thấy resolution bất hợp lý, hoặc cần field chưa có trong contract → phản hồi PO (contract decision), đừng sửa System BDD trực tiếp. Bối cảnh: [PO › Tình huống 12](../product-owner/scenarios.md#tình-huống-12--system-bdd-synthesis-outside-in--xử-lý-cross-platform-conflict).
|
|
76
|
+
|
|
77
|
+
## Tình huống 3: Đọc Web/App BDD (FE/App dev)
|
|
78
|
+
|
|
79
|
+
**Bối cảnh:** FE dev nhận thông báo BDD web đã sẵn sàng tại `specs/auth/login/bdd/web/`.
|
|
80
|
+
```
|
|
81
|
+
# Đọc file BDD (không generate):
|
|
82
|
+
my-project-specs/specs/auth/login/bdd/web/FT-001-UC1-login-web.feature
|
|
83
|
+
```
|
|
84
|
+
```gherkin
|
|
85
|
+
# Ví dụ Web BDD do PO gen (vocabulary: clicks, sees, navigates)
|
|
86
|
+
Scenario: User sees error after wrong password
|
|
87
|
+
Given user is on the Login screen
|
|
88
|
+
When user submits login with wrong password
|
|
89
|
+
Then user sees "Sai mật khẩu" error
|
|
90
|
+
And the password field is cleared
|
|
91
|
+
|
|
92
|
+
Scenario: Account locked — countdown shown
|
|
93
|
+
Given user has submitted wrong password 5 times
|
|
94
|
+
Then user sees "Tài khoản bị khoá. Thử lại sau 29:45"
|
|
95
|
+
And the countdown decrements every second
|
|
96
|
+
```
|
|
97
|
+
FE dev dùng Web BDD để:
|
|
98
|
+
1. Thiết kế component spec + API integration plan (`/generate-tech-docs`)
|
|
99
|
+
2. Gen UI + mock adapter (`/generate-code --phase=ui`) — mock **shape** từ BE contract nếu có, else System BDD + warn → Mock adapter trả về fixture data đúng với BDD `Then` clauses → Tester test toàn bộ FE flow ngay, không cần chờ BE
|
|
100
|
+
3. [Trong khi đó — tham gia review API contract, sign-off T7 gate]
|
|
101
|
+
4. Khi sign-off done → wire real API (`/generate-code --phase=integration`)
|
|
102
|
+
5. Viết E2E tests với Playwright/Cypress (`/dev-gen-test`)
|
|
103
|
+
|
|
104
|
+
## Tình huống 4: PRD thay đổi mid-sprint
|
|
105
|
+
|
|
106
|
+
**Bối cảnh:** PO update PRD `FT-042` từ v1.0 → v1.1 khi dev đang code.
|
|
107
|
+
```
|
|
108
|
+
PO notify: "FT-042 updated — BR7 thay đổi giới hạn từ 5tr → 10tr"
|
|
109
|
+
│
|
|
110
|
+
▼
|
|
111
|
+
Dev chạy:
|
|
112
|
+
/review-context specs/payment/checkout/prd.md
|
|
113
|
+
→ Xem diff từ v1.0 sang v1.1 (agent highlight thay đổi)
|
|
114
|
+
│
|
|
115
|
+
▼
|
|
116
|
+
Đánh giá impact:
|
|
117
|
+
- BDD bị ảnh hưởng? → thông báo PO để PO update BDD trong spec repo, rồi pull lại
|
|
118
|
+
- Tech Docs bị ảnh hưởng? → update API spec
|
|
119
|
+
- Code bị ảnh hưởng? → update logic + tests
|
|
120
|
+
│
|
|
121
|
+
▼
|
|
122
|
+
/validate-traces
|
|
123
|
+
→ Đảm bảo không có trace nào còn trỏ về spec cũ
|
|
124
|
+
```
|
|
125
|
+
**Nguyên tắc:** Không merge code khi traces broken. Fix traces trước.
|
|
126
|
+
|
|
127
|
+
## Tình huống 4b: Chờ API design — BE + FE/App đồng thuận
|
|
128
|
+
|
|
129
|
+
**Bối cảnh:** System BDD đã gen, BE dev bắt đầu `/generate-tech-docs` nhưng FE/App chưa confirm API contract. **Trạng thái tech docs trong thời gian này:** `@trace.status: in-review`.
|
|
130
|
+
```
|
|
131
|
+
BE dev: /generate-tech-docs auth/FT-001-UC1
|
|
132
|
+
# Umbrella mode (có spec_source): output nằm trong SPEC REPO chung
|
|
133
|
+
→ Output: free-trial-specs/specs/auth/login/tech-docs/FT-001-UC1-tech-design.md
|
|
134
|
+
# Single-service (không có spec_source): output nằm tại project root
|
|
135
|
+
→ Output: specs/auth/login/tech-docs/FT-001-UC1-tech-design.md
|
|
136
|
+
→ @trace.status: draft
|
|
137
|
+
→ @trace.sign_off: { be_team: done, fe_team: pending, app_team: pending, sa: pending }
|
|
138
|
+
→ Publish: commit + push file lên spec repo (2-layer) để FE/App `/sync` đọc được
|
|
139
|
+
|
|
140
|
+
BE dev: /review-tech-docs free-trial-specs/specs/auth/login/tech-docs/FT-001-UC1-tech-design.md
|
|
141
|
+
→ Chạy T1–T7 (bao gồm T7 cross-team contract check)
|
|
142
|
+
→ Report: "Sign-off gate: 🔒 BLOCKED — pending: fe_team, app_team, sa"
|
|
143
|
+
```
|
|
144
|
+
**FE dev review API contract:**
|
|
145
|
+
```
|
|
146
|
+
# FE dev mở tech-design file → xem API contract section
|
|
147
|
+
# Xác nhận: response fields có đủ cho web BDD expectations không?
|
|
148
|
+
# Nếu ok → thêm comment hoặc báo BE dev cập nhật sign_off
|
|
149
|
+
```
|
|
150
|
+
Khi FE/App confirm xong → BE dev update header:
|
|
151
|
+
```yaml
|
|
152
|
+
# @trace.sign_off:
|
|
153
|
+
# be_team: done
|
|
154
|
+
# fe_team: done ← FE đã confirm
|
|
155
|
+
# app_team: done ← App đã confirm
|
|
156
|
+
# sa: done ← SA đã approve
|
|
157
|
+
```
|
|
158
|
+
```
|
|
159
|
+
BE dev: /review-tech-docs --resume {tech-design-file}
|
|
160
|
+
→ Sign-off gate: ✅ READY
|
|
161
|
+
→ @trace.status: approved
|
|
162
|
+
→ BE có thể chạy /generate-code
|
|
163
|
+
→ FE chạy /generate-code --phase=integration để wire API thật
|
|
164
|
+
```
|
|
165
|
+
```
|
|
166
|
+
# FE — sau khi sign-off gate approved:
|
|
167
|
+
/generate-code --phase=integration auth/FT-001-UC1
|
|
168
|
+
→ Reads existing mock adapter interface ({UC-ID}ApiPort)
|
|
169
|
+
→ Generates real API adapter với calls đến endpoints trong tech-doc
|
|
170
|
+
→ Flips DI/env flag: service dùng real adapter thay mock
|
|
171
|
+
→ Mock adapter giữ lại cho unit test
|
|
172
|
+
```
|
|
173
|
+
**Nguyên tắc:**
|
|
174
|
+
- `/generate-code` (không phase flag) cho BE trả về warning nếu tech docs status là `in-review` hoặc `draft`.
|
|
175
|
+
- FE dùng `--phase=ui` được ngay sau khi đọc BDD — không cần chờ.
|
|
176
|
+
- FE dùng `--phase=integration` chỉ sau khi sign-off gate `approved`.
|
|
177
|
+
|
|
178
|
+
## Tình huống 5: Nhận bug report từ Tester
|
|
179
|
+
|
|
180
|
+
**Bối cảnh:** Tester gửi bug report theo đúng format spec-driven, có đầy đủ spec context.
|
|
181
|
+
```
|
|
182
|
+
Bug ID : BUG-20260605-003
|
|
183
|
+
Feature : FT-001 — User Login
|
|
184
|
+
Service : BE
|
|
185
|
+
Severity : Major
|
|
186
|
+
|
|
187
|
+
Spec context:
|
|
188
|
+
PRD : specs/auth/login/prd.md (v1.0)
|
|
189
|
+
BDD : free-trial-specs/specs/auth/login/bdd/system/FT-001-login.feature
|
|
190
|
+
→ Scenario: "Lock account after 5 failed attempts"
|
|
191
|
+
Tech Doc : free-trial-specs/specs/auth/login/tech-docs/FT-001-auth-api.md
|
|
192
|
+
|
|
193
|
+
AC bị vi phạm:
|
|
194
|
+
AC3: "Sai password 5 lần liên tiếp → khoá tài khoản 30 phút"
|
|
195
|
+
|
|
196
|
+
BDD Scenario bị fail:
|
|
197
|
+
Given : user has 0 failed attempts
|
|
198
|
+
When : login with wrong password 5 times
|
|
199
|
+
Then : 5th attempt returns 423 Locked AND retry_after = 1800
|
|
200
|
+
|
|
201
|
+
Actual: 5th attempt trả 401, không có retry_after, tài khoản không bị khoá
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
**Bước 1 — Tìm code implement scenario bị fail:**
|
|
205
|
+
```
|
|
206
|
+
Đọc theo thứ tự: PRD → BDD → Code
|
|
207
|
+
|
|
208
|
+
PRD AC3: "5 lần sai → khoá 30 phút" → rõ ràng ✅
|
|
209
|
+
BDD SC3: "Then 423 Locked, retry_after=1800" → đúng theo PRD ✅
|
|
210
|
+
Code: ??? → kiểm tra tiếp
|
|
211
|
+
```
|
|
212
|
+
Chạy:
|
|
213
|
+
```
|
|
214
|
+
/fix-bug "BUG-20260605-003: FT-001-UC2-BR3 — account not locked after 5 failures
|
|
215
|
+
PRD: specs/auth/login/prd.md
|
|
216
|
+
BDD: free-trial-specs/specs/auth/login/bdd/system/FT-001-login.feature"
|
|
217
|
+
```
|
|
218
|
+
Agent sẽ: đọc BDD scenario được chỉ định · tìm code implement scenario đó (theo `@trace.bdd`) · so sánh logic thực tế vs spec · propose fix có giải thích.
|
|
219
|
+
|
|
220
|
+
**Bước 2 — Xác định bug thuộc layer nào:** Đọc theo thứ tự PRD → BDD → Code để tìm chỗ lệch. Có 3 khả năng:
|
|
221
|
+
|
|
222
|
+
| PRD | BDD | Code | → Fix ở đâu |
|
|
223
|
+
|---|---|---|---|
|
|
224
|
+
| ✅ rõ | ✅ đúng | ❌ sai | Fix code |
|
|
225
|
+
| ✅ rõ | ❌ sai | ❌ sai | Fix BDD + code |
|
|
226
|
+
| ❌ mơ hồ | bất kỳ | bất kỳ | Hỏi PO trước, không tự fix |
|
|
227
|
+
|
|
228
|
+
> Flow đầy đủ cho cả 6 cases (bao gồm PRD change, Design Spec bug, env bug) và cách phối hợp với PO/Tester: xem [Operations › Bug Flow](../../04-operations/bug-flow.md).
|
|
229
|
+
|
|
230
|
+
**Bước 3 — Sau khi fix:**
|
|
231
|
+
```
|
|
232
|
+
/validate-traces
|
|
233
|
+
→ Đảm bảo @trace.bdd trong code vẫn trỏ đúng BDD scenario
|
|
234
|
+
→ Không có trace broken
|
|
235
|
+
|
|
236
|
+
/dev-run-test
|
|
237
|
+
→ BDD pass = fix đúng theo spec
|
|
238
|
+
|
|
239
|
+
Notify tester:
|
|
240
|
+
"BUG-20260605-003 fixed — deploy to staging [link commit/PR]
|
|
241
|
+
Root cause: Case A — code dùng > thay vì >=
|
|
242
|
+
BDD: không đổi (spec đã đúng)
|
|
243
|
+
Re-test: FT-001-UC2-SC3"
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
## Tình huống 6: Nhận Design Spec + BDD từ PO (FE/App)
|
|
247
|
+
|
|
248
|
+
**Bối cảnh:** PO tạo Design Spec + BDD web cho tính năng checkout — FE cần implement.
|
|
249
|
+
```
|
|
250
|
+
PO thông báo: "FT-042 Design Spec + BDD đã sẵn sàng"
|
|
251
|
+
│
|
|
252
|
+
▼
|
|
253
|
+
git submodule update --remote my-project-specs
|
|
254
|
+
|
|
255
|
+
FE dev đọc:
|
|
256
|
+
- my-project-specs/specs/payment/checkout/prd.md (business rules)
|
|
257
|
+
- my-project-specs/specs/payment/checkout/design-spec/FT-042-*.md (screens, components)
|
|
258
|
+
- my-project-specs/specs/payment/checkout/bdd/web/FT-042-UC*.feature (BDD đã gen sẵn)
|
|
259
|
+
│
|
|
260
|
+
▼
|
|
261
|
+
Bật Figma Dev Mode MCP (nếu dùng Figma — để FE codegen chính xác):
|
|
262
|
+
→ Mở Figma DESKTOP app + enable Dev Mode MCP server (local, http://127.0.0.1:3845)
|
|
263
|
+
→ `/generate-code` (FE/App UI) tự detect server local + prompt nếu chưa bật
|
|
264
|
+
→ Dùng real tokens, components, Code Connect thay vì web link → codegen sát design hơn
|
|
265
|
+
│
|
|
266
|
+
▼
|
|
267
|
+
/generate-tech-docs payment/FT-042-UC1
|
|
268
|
+
→ Gen component spec, API integration plan dựa trên Design Spec + BDD
|
|
269
|
+
│
|
|
270
|
+
▼
|
|
271
|
+
/generate-code payment/FT-042-UC1 --phase=ui
|
|
272
|
+
→ Gen UI components + mock API adapter (fixture từ System BDD Then clauses)
|
|
273
|
+
→ FE codegen đọc Figma Dev Mode MCP local nếu đang bật (tokens/components/Code Connect)
|
|
274
|
+
→ Tester có thể test FE ngay
|
|
275
|
+
│ [trong khi đó: tham gia review API contract — T7 sign-off gate]
|
|
276
|
+
▼
|
|
277
|
+
[Nhận thông báo: sign-off gate approved]
|
|
278
|
+
│
|
|
279
|
+
▼
|
|
280
|
+
/generate-code payment/FT-042-UC1 --phase=integration
|
|
281
|
+
→ Wire real API adapter thay thế mock
|
|
282
|
+
→ /dev-gen-test payment/FT-042-UC1
|
|
283
|
+
→ /review-code {files-changed}
|
|
284
|
+
→ /dev-run-test
|
|
285
|
+
```
|
|
286
|
+
**Lưu ý:** BE không cần đọc Design Spec — chỉ đọc System BDD tại `specs/{domain}/{prd-slug}/bdd/system/`.
|
|
287
|
+
|
|
288
|
+
## Tình huống 7b: Brownfield — API đã tồn tại trên hệ thống cũ
|
|
289
|
+
|
|
290
|
+
**Bối cảnh:** PO viết PRD cho feature mới nhưng BE API đã có sẵn trên hệ thống cũ, chưa có tài liệu. PO khai báo luôn trong PRD thay vì thiết kế lại.
|
|
291
|
+
|
|
292
|
+
**Dấu hiệu nhận ra:** PRD Metadata có `| **API Source** | existing |` · PRD có section "Existing API Contract" với bảng endpoint + response.
|
|
293
|
+
|
|
294
|
+
**Dev workflow (đơn giản hơn greenfield):**
|
|
295
|
+
```
|
|
296
|
+
git submodule update --remote my-project-specs
|
|
297
|
+
|
|
298
|
+
1. /review-context → đọc PRD + BDD
|
|
299
|
+
→ BDD system đã dùng contract sẵn có từ PRD (không synthesis)
|
|
300
|
+
→ @trace.api_source: existing trong BDD header
|
|
301
|
+
|
|
302
|
+
2. /generate-tech-docs {feature-file}
|
|
303
|
+
→ Mode: Reverse-document
|
|
304
|
+
→ §2 API Endpoints: mô tả lại API đã tồn tại từ bảng PRD
|
|
305
|
+
→ Ghi chú gaps nếu contract thực tế khác BDD expectations
|
|
306
|
+
|
|
307
|
+
3. /review-tech-docs {tech-design-file}
|
|
308
|
+
→ T7 sign-off gate: tự động SKIP (không có API design mới)
|
|
309
|
+
→ Chỉ review T1–T6 (architecture, entity, BDD traceability, ...)
|
|
310
|
+
→ Approved nhanh hơn
|
|
311
|
+
|
|
312
|
+
4. /generate-code {feature-file} ← không cần --phase
|
|
313
|
+
→ API đã live, gen real adapter trực tiếp
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
**Điểm khác biệt so với greenfield:**
|
|
317
|
+
|
|
318
|
+
| | Greenfield | Brownfield (API existing) |
|
|
319
|
+
|---|---|---|
|
|
320
|
+
| System BDD | Synthesize từ FE + App BDD | Dùng PRD contract trực tiếp |
|
|
321
|
+
| T7 gate | Bắt buộc | Tự động skip |
|
|
322
|
+
| `--phase=ui` | Cần nếu BE chưa ready | Không cần |
|
|
323
|
+
| `generate-tech-docs` | Design mới | Reverse-document |
|
|
324
|
+
|
|
325
|
+
## Tình huống 7: Setup service submodule (Umbrella mode)
|
|
326
|
+
|
|
327
|
+
**Bối cảnh:** Project dùng umbrella repo. Dev được assign vào service `mass-product-be`.
|
|
328
|
+
|
|
329
|
+
**Setup lần đầu:**
|
|
330
|
+
```bash
|
|
331
|
+
# 1. Clone umbrella repo
|
|
332
|
+
git clone {umbrella-repo-url} mass-product
|
|
333
|
+
cd mass-product
|
|
334
|
+
|
|
335
|
+
# 2. Mở Claude Code TẠI umbrella root (QUAN TRỌNG)
|
|
336
|
+
code . ← hoặc claude .
|
|
337
|
+
|
|
338
|
+
# 3. Chạy một lệnh duy nhất — setup toàn bộ
|
|
339
|
+
/sync
|
|
340
|
+
# → tự detect setup mode (submodule chưa init)
|
|
341
|
+
# → git pull + git submodule update --init --recursive --remote
|
|
342
|
+
# → validate service configs (cảnh báo nếu thiếu .agent/project-context.yaml)
|
|
343
|
+
# → sync Living Docs panel
|
|
344
|
+
|
|
345
|
+
# 4. Framework tự detect umbrella mode từ project-context.yaml
|
|
346
|
+
# Khi chạy /review-context với PRD có @trace.domain: be
|
|
347
|
+
# → CODE route tới mass-product-be/ · BDD đọc từ spec repo mass-product-spec/specs/{domain}/{prd-slug}/bdd/ (spec_source set)
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
**Update hằng ngày — cũng chỉ 1 lệnh:**
|
|
351
|
+
```bash
|
|
352
|
+
/sync
|
|
353
|
+
# → git pull + submodule update --remote
|
|
354
|
+
# → refresh Living Docs
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
**project-context.yaml của umbrella:**
|
|
358
|
+
```yaml
|
|
359
|
+
setup:
|
|
360
|
+
mode: umbrella
|
|
361
|
+
spec_source: "mass-product-spec"
|
|
362
|
+
services:
|
|
363
|
+
be:
|
|
364
|
+
path: "mass-product-be"
|
|
365
|
+
module: "NestJS"
|
|
366
|
+
# specs_dir KHÔNG khai khi spec_source set — BDD đọc từ spec repo, không per-service
|
|
367
|
+
web:
|
|
368
|
+
path: "mass-product-web"
|
|
369
|
+
module: "NextJS"
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
> **BDD (specs_dir):** không khai trong `services` khi có `spec_source`. Tất cả BDD (web/app/system) nằm ở `{spec_source}/specs/bdd` (vd `mass-product-spec/specs/bdd`) — context-loader tự route `specs_dir` về đó; mọi `specs_dir` per-service đều bị **bỏ qua**. Per-service `specs_dir` **chỉ** dùng khi KHÔNG có `spec_source`.
|
|
373
|
+
>
|
|
374
|
+
> **Tech-docs (API contract):** không khai trong `services`. Khi `setup.spec_source` được set, BE tech-design (API contract) **LUÔN** nằm tại `{spec_source}/specs/tech-docs` (vd `mass-product-spec/specs/tech-docs`) — context-loader tự route `tech_docs_dir` về đó. BE generate xong → commit + push lên spec repo; FE/App đọc qua `/sync` + `/generate-code --phase=integration`. Per-service tech-docs **chỉ** khi KHÔNG có `spec_source`.
|
|
375
|
+
>
|
|
376
|
+
> **Bắt buộc:** Mỗi service submodule cũng cần file `.agent/project-context.yaml` riêng. Framework đọc file này (context-loader Step 1.6) để lấy đúng `test_command` và `build_command` khi `/dev-run-test` hoặc `/dev-gen-test` chạy từ umbrella root.
|
|
377
|
+
|
|
378
|
+
**project-context.yaml của từng service submodule:**
|
|
379
|
+
```yaml
|
|
380
|
+
# mass-product-be/.agent/project-context.yaml
|
|
381
|
+
tech_stack:
|
|
382
|
+
language: "TypeScript"
|
|
383
|
+
framework: "NestJS"
|
|
384
|
+
module: "nestjs"
|
|
385
|
+
|
|
386
|
+
conventions:
|
|
387
|
+
test_command: "npm test"
|
|
388
|
+
build_command: "npm run build"
|
|
389
|
+
|
|
390
|
+
paths:
|
|
391
|
+
trace_dir: ".trace"
|
|
392
|
+
```
|
|
393
|
+
```yaml
|
|
394
|
+
# mass-product-web/.agent/project-context.yaml
|
|
395
|
+
tech_stack:
|
|
396
|
+
language: "TypeScript"
|
|
397
|
+
framework: "Next.js 14"
|
|
398
|
+
module: "nextjs"
|
|
399
|
+
|
|
400
|
+
conventions:
|
|
401
|
+
test_command: "npx vitest run"
|
|
402
|
+
build_command: "npm run build"
|
|
403
|
+
|
|
404
|
+
paths:
|
|
405
|
+
trace_dir: ".trace"
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
Khi `/dev-run-test` chạy từ umbrella root cho một UC thuộc domain `be`:
|
|
409
|
+
1. Step 1.5 detect `service_root = "mass-product-be"`
|
|
410
|
+
2. Step 1.6 load `mass-product-be/.agent/project-context.yaml` → `test_command = "npm test"`
|
|
411
|
+
3. Lệnh test chạy: `cd mass-product-be && npm test`
|
|
412
|
+
|
|
413
|
+
**BDD + trace ở spec repo (1 tầng); code ở service (2 tầng):**
|
|
414
|
+
```bash
|
|
415
|
+
# BDD (.feature) + trace (.tsv) → SPEC repo (1 tầng — khi spec_source set)
|
|
416
|
+
cd mass-product-specs
|
|
417
|
+
git add specs/auth/login/bdd/FT-001-login.feature .trace/auth/login/FT-001.tsv
|
|
418
|
+
git commit -m "feat(bdd): add login BDD scenarios — FT-001"
|
|
419
|
+
git push
|
|
420
|
+
|
|
421
|
+
# Code → service submodule (commit 2 lớp)
|
|
422
|
+
cd ../mass-product-be
|
|
423
|
+
git add src/
|
|
424
|
+
git commit -m "feat(FT-001): login implementation"
|
|
425
|
+
git push origin feature/ft-001-login
|
|
426
|
+
cd .. ← về umbrella root
|
|
427
|
+
git add mass-product-be
|
|
428
|
+
git commit -m "chore: update mass-product-be submodule pointer — FT-001"
|
|
429
|
+
git push
|
|
430
|
+
```
|
|
431
|
+
**Không commit lớp 2 (pointer) → umbrella repo vẫn trỏ về commit cũ của service.**
|
|
432
|
+
|
|
433
|
+
## Tình huống 8: Validate traces trước khi tạo PR lớn
|
|
434
|
+
|
|
435
|
+
**Bối cảnh:** Dev refactor module Auth — đổi tên `AuthService` → `IdentityService`.
|
|
436
|
+
```
|
|
437
|
+
Sau khi refactor xong:
|
|
438
|
+
|
|
439
|
+
/validate-traces
|
|
440
|
+
│
|
|
441
|
+
▼
|
|
442
|
+
Agent kiểm tra:
|
|
443
|
+
- BDD có @trace.module: AuthService → BROKEN (class không còn tồn tại)
|
|
444
|
+
- Code comments @trace.bdd: FT-001-UC1-SC1 → còn hợp lệ không?
|
|
445
|
+
- Tech Docs mention "AuthService" → stale reference
|
|
446
|
+
│
|
|
447
|
+
▼
|
|
448
|
+
Report:
|
|
449
|
+
❌ BROKEN specs/auth/login/bdd/FT-001-login.feature @trace.module: AuthService (not found)
|
|
450
|
+
❌ BROKEN specs/auth/login/tech-docs/FT-001-auth-api.md "AuthService" referenced 7 times
|
|
451
|
+
✅ OK src/identity/identity.service.ts @trace.bdd: FT-001-UC1-SC1
|
|
452
|
+
│
|
|
453
|
+
▼
|
|
454
|
+
Fix: Update @trace.module và references → re-run /validate-traces → all green → tạo PR
|
|
455
|
+
```
|
|
456
|
+
**Quy tắc:** PR không được merge khi còn broken traces.
|
|
457
|
+
|
|
458
|
+
---
|
|
459
|
+
|
|
460
|
+
← [Workflow](workflow.md) · Tiếp theo: [Checklist trước khi tạo PR](pr-checklist.md)
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
[📚 Docs](../../README.md) › [Guides](../README.md) › [Developer](README.md) › Workflow
|
|
2
|
+
|
|
3
|
+
# Workflow Cơ Bản
|
|
4
|
+
|
|
5
|
+
> Sơ đồ render thành flowchart trên GitHub (Mermaid). Bản text ASCII (mở mục bên dưới) là fallback cho viewer không hỗ trợ Mermaid.
|
|
6
|
+
|
|
7
|
+
```mermaid
|
|
8
|
+
flowchart TD
|
|
9
|
+
A([Nhận PRD + BDD mới từ PO]) --> B["/sync<br/>kéo specs + services · refresh Living Docs"]
|
|
10
|
+
B --> C["/review-context {prd}<br/>kiểm tra domain · status=approved<br/>đọc AC / UC / BR + BDD"]
|
|
11
|
+
C --> D["Đọc BDD web/app/system từ spec repo<br/>(dev KHÔNG tự generate BDD)"]
|
|
12
|
+
D --> TD
|
|
13
|
+
|
|
14
|
+
subgraph TD["TECH DESIGN + CODE — BE và FE làm SONG SONG"]
|
|
15
|
+
direction LR
|
|
16
|
+
subgraph BE["BE track (system) — làm trước để có contract"]
|
|
17
|
+
direction TB
|
|
18
|
+
BE1["/generate-tech-docs {system}<br/>API contract ← System BDD<br/>endpoint · data model · DB"] --> BE2["/review-tech-docs → approved<br/>chốt = BE contract<br/>(FE chờ cái này)"] --> BE3["/generate-code {system}<br/>code BE ← System BDD + contract"]
|
|
19
|
+
end
|
|
20
|
+
subgraph FE["FE/App track (web · app) — không chờ BE deploy"]
|
|
21
|
+
direction TB
|
|
22
|
+
FE1["① /generate-code {bdd} --phase=ui<br/>UI ← Web/App BDD + Design Spec<br/>mock ← BE contract (nếu có) · else System BDD<br/>emit test-id · Tester test ngay"] --> GATE{{"GATE — chỉ làm tiếp khi ĐÃ CÓ:<br/>System BDD + BE contract (approved)"}}
|
|
23
|
+
GATE --> FE2["② /generate-tech-docs {web|app}<br/>FE design ← Web/App BDD + BE contract<br/>§4 map API · §2b test-id"] --> FE2b["/review-tech-docs → approved<br/>(bump revision)"] --> FE3["③ /generate-code --phase=integration<br/>thay mock bằng API thật theo §4"]
|
|
24
|
+
end
|
|
25
|
+
BE2 -. "cấp BE contract" .-> GATE
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
TD --> E["/dev-gen-test → /dev-run-test<br/>dev tự kiểm (dev_selftest)<br/>ghi vào spec .trace"]
|
|
29
|
+
E --> F["/validate-traces<br/>cập nhật Living Docs (.living-docs)"]
|
|
30
|
+
F --> G["/review-code — 4 lens:<br/>Security · Performance · Architecture · Test"]
|
|
31
|
+
G --> H([Tạo PR → notify PO/SA review])
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
> **Full-stack / không tách mock:** chỉ cần BE track — chạy `/generate-code {bdd}` một lần (bỏ qua FE 2-phase).
|
|
35
|
+
|
|
36
|
+
<details>
|
|
37
|
+
<summary>Bản text (ASCII fallback — cho viewer không render Mermaid)</summary>
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
Nhận thông báo PRD + BDD mới từ PO
|
|
41
|
+
│
|
|
42
|
+
▼
|
|
43
|
+
/sync # pull specs + services + refresh Living Docs (1 lệnh, preferred)
|
|
44
|
+
(tương đương raw: git submodule update --remote my-project-specs — lấy spec mới nhất, gồm BDD PO đã gen)
|
|
45
|
+
│
|
|
46
|
+
▼
|
|
47
|
+
/review-context {prd-file}
|
|
48
|
+
→ Kiểm tra @trace.domain, @trace.status = approved
|
|
49
|
+
→ Đọc hiểu AC, UC, BR trong PRD
|
|
50
|
+
→ Đọc BDD tương ứng trong specs/{domain}/{prd-slug}/bdd/{platform}/
|
|
51
|
+
→ Nếu có gì không rõ: hỏi PO TRƯỚC khi tiếp tục
|
|
52
|
+
│
|
|
53
|
+
▼
|
|
54
|
+
(Đọc BDD từ spec submodule — KHÔNG tự generate BDD)
|
|
55
|
+
FE/Web: my-project-specs/specs/{domain}/{prd-slug}/bdd/web/{TICKET-ID}-UC*.feature
|
|
56
|
+
App: my-project-specs/specs/{domain}/{prd-slug}/bdd/app/{TICKET-ID}-UC*.feature
|
|
57
|
+
BE: my-project-specs/specs/{domain}/{prd-slug}/bdd/system/{TICKET-ID}-UC*.feature
|
|
58
|
+
│
|
|
59
|
+
▼
|
|
60
|
+
══════════ TECH DESIGN + CODE — BE track & FE track CHẠY SONG SONG ══════════
|
|
61
|
+
(/generate-tech-docs là platform-aware: đọc @trace.platform → BE = API contract · FE/App = client design)
|
|
62
|
+
|
|
63
|
+
BE track (system) ── làm trước, sinh ra "BE contract" ──
|
|
64
|
+
/generate-tech-docs {system} → API contract: endpoints · data model · DB · caching
|
|
65
|
+
/review-tech-docs → APPROVED → đây CHÍNH LÀ "BE contract" mà FE chờ
|
|
66
|
+
/generate-code {system} → code theo BDD (@trace.bdd)
|
|
67
|
+
(full-stack / không tách mock: chỉ cần track này — /generate-code {bdd} một lần)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
FE/App track (web|app) ── KHÔNG chặn chờ BE ──
|
|
71
|
+
|
|
72
|
+
① BẮT ĐẦU NGAY (song song với BE):
|
|
73
|
+
/generate-code {bdd} --phase=ui → UI + mock adapter
|
|
74
|
+
• UI ← Web/App BDD + Design Spec
|
|
75
|
+
• mock shape = BE contract nếu có, else System BDD (+warn)
|
|
76
|
+
• fixture values: LUÔN từ System BDD
|
|
77
|
+
• emit test-id (convention {uc}-{screen}-{element}-{type})
|
|
78
|
+
• Tester test FE NGAY (không cần BE deploy API)
|
|
79
|
+
│
|
|
80
|
+
╔═══════════════════▼═══════════ GATE ═══════════════════
|
|
81
|
+
║ Chỉ mở khi CÓ: System BDD + BE contract (approved, từ track BE)
|
|
82
|
+
╚═══════════════════╤════════════════════════════════════
|
|
83
|
+
▼
|
|
84
|
+
② /generate-tech-docs {web|app} → FE client design (GATED)
|
|
85
|
+
• components · state
|
|
86
|
+
• §4 API-integration map THEO BE contract
|
|
87
|
+
• §2b Test Selectors (test-id cho element có action)
|
|
88
|
+
/review-tech-docs → approved (bump revision)
|
|
89
|
+
▼
|
|
90
|
+
③ /generate-code {bdd} --phase=integration
|
|
91
|
+
→ wire real API theo §4 FE tech-design (thay mock)
|
|
92
|
+
│
|
|
93
|
+
▼
|
|
94
|
+
/dev-gen-test {bdd-file}
|
|
95
|
+
→ Gen unit test (dev self-check, không phải coverage chính thức)
|
|
96
|
+
→ /dev-run-test để verify → ghi dev_selftest (pass/fail) + dev_selftest_at vào TSV authoritative {spec_source}/.trace (commit 1 tầng ở spec repo)
|
|
97
|
+
→ /validate-traces (hoặc /sync) → regenerate report Living Docs {spec_source}/.living-docs/ (gitignored)
|
|
98
|
+
│
|
|
99
|
+
▼
|
|
100
|
+
/review-code {files}
|
|
101
|
+
→ 4 lens: Security / Performance / Architecture / Test Coverage
|
|
102
|
+
→ Fix issues trước khi tạo PR
|
|
103
|
+
│
|
|
104
|
+
▼
|
|
105
|
+
Tạo PR → notify PO/SA review
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
</details>
|
|
109
|
+
|
|
110
|
+
> **Vì sao đúng thứ tự này? — Chuỗi outside-in.** Toàn bộ pipeline đi từ ngoài (client) vào trong (hệ thống):
|
|
111
|
+
> 1. **PO gen BDD: web → app → System** — System BDD (BE) được **tổng hợp từ web+app BDD** (hành vi client định nghĩa trước, BE/system suy ra để phục vụ các flow đó). *(Project chỉ-BE: System BDD gen thẳng từ PRD.)*
|
|
112
|
+
> 2. **BE tech-docs trước** — API contract dẫn xuất từ **System BDD**.
|
|
113
|
+
> 3. **FE/App tech-docs sau (GATED)** — cần **System BDD + BE contract approved**; §4 map theo BE contract.
|
|
114
|
+
>
|
|
115
|
+
> FE **không** bị chặn chờ BE nhờ `--phase=ui` (mock shape: BE contract nếu có, else System BDD), rồi `--phase=integration` wire API thật khi contract đã có. Chi tiết flow: [Concepts › Pipeline](../../03-concepts/pipeline.md).
|
|
116
|
+
|
|
117
|
+
> **Commit ở đâu, push mấy tầng?** Code nằm trong service submodule → **commit 2 tầng** (service rồi umbrella pointer). Tech-docs + `.trace/` (dev_selftest/qc_status) đẩy lên **spec repo** (1 tầng, cross-repo). Sơ đồ git đầy đủ theo từng role: [Sync & Update — Git flow theo role](../../04-operations/sync-and-update.md#ai-commit-vào-repo-nào-git-flow-theo-role).
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
← [BDD & Trace System](bdd-and-trace.md) · Tiếp theo: [Tình huống thực tế](scenarios.md)
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
[📚 Docs](../../README.md) › [Guides](../README.md) › Product Owner / BA
|
|
2
|
+
|
|
3
|
+
# Hướng Dẫn PO/BA — Spec-Driven Docs
|
|
4
|
+
|
|
5
|
+
Tài liệu dành cho **Product Owner (PO)** và **Business Analyst (BA)** — vai trò, commands, các tình huống thực tế, và quy tắc viết PRD.
|
|
6
|
+
|
|
7
|
+
## Mục Lục
|
|
8
|
+
|
|
9
|
+
| Trang | Nội dung |
|
|
10
|
+
|---|---|
|
|
11
|
+
| [Commands](commands.md) | Bảng lệnh cho PO/BA · project lessons · xử lý feedback tester |
|
|
12
|
+
| [Tình huống thực tế](scenarios.md) | 12 scenario: tính năng mới, design spec, BDD, PRD thay đổi, brownfield, **System BDD synthesis & cross-platform conflict**, ... |
|
|
13
|
+
| [Quy tắc viết PRD](prd-writing-rules.md) | Platform-agnostic · testable AC · negative path · BR numbering |
|
|
14
|
+
| [Checklist handoff](handoff-checklist.md) | Checklist verify trước khi thông báo dev team bắt đầu |
|
|
15
|
+
|
|
16
|
+
## Vai Trò PO/BA Trong Framework
|
|
17
|
+
|
|
18
|
+
PO/BA là người duy nhất viết và approve tài liệu đầu vào + BDD:
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
PO/BA Dev team
|
|
22
|
+
────────────────────── ──────────────────────────────
|
|
23
|
+
/define-product đọc product-definition + BDD
|
|
24
|
+
/generate-prd → /review-context (xác nhận PRD)
|
|
25
|
+
/refine-prd (SA review) /generate-tech-docs
|
|
26
|
+
/review-context /generate-code + tests
|
|
27
|
+
/generate-design-spec → /review-code / /dev-run-test
|
|
28
|
+
/generate-bdd (web)
|
|
29
|
+
/generate-bdd (app)
|
|
30
|
+
/generate-bdd (system)
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**PO/BA chịu trách nhiệm:**
|
|
34
|
+
- Đảm bảo PRD platform-agnostic (không chứa UI details hay API specs)
|
|
35
|
+
- Đặt `@trace.domain` đúng để dev team routing hoạt động
|
|
36
|
+
- Cập nhật `@trace.status: approved` trước khi handoff
|
|
37
|
+
- **Generate BDD cho tất cả platforms** theo thứ tự **outside-in: web → app → system** — System BDD được **tổng hợp từ web+app BDD** (project chỉ-BE thì system gen thẳng từ PRD). Xem [scenarios](scenarios.md).
|
|
38
|
+
- Thông báo dev team khi có PRD hoặc BDD mới/update
|
|
39
|
+
|
|
40
|
+
**PO/BA KHÔNG cần quan tâm:**
|
|
41
|
+
- Tech docs — dev team tự generate
|
|
42
|
+
- Source code — hoàn toàn dev team
|
|
43
|
+
|
|
44
|
+
### Tại sao BDD thuộc trách nhiệm của PO?
|
|
45
|
+
|
|
46
|
+
Đặt BDD trong spec repo giúp **tổng hợp toàn bộ tài liệu nghiệp vụ về một chỗ**.
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
PRD (WHAT + WHY) → BDD (HOW verified) → Code (HOW built)
|
|
50
|
+
↑ PO/BA ↑ PO/BA ↑ Dev
|
|
51
|
+
spec repo spec repo dev repo
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
> **Sau khi BDD approved → QC chạy pipeline tự động:** Khi BDD của một UC được approve, QC team chạy bộ lệnh native `/qc-analyze → /qc-plan → /qc-design-test → /qc-review → /qc-run-test → /qc-report` — đọc official `.feature`, generate + run Playwright/pytest, rồi ghi `qc_status` (official QC coverage) vào Living Docs. PO không chạy QC, nhưng nên biết bước này tồn tại ở downstream. Chi tiết: [chương QC Automation](../tester/qc-automation.md).
|
|
55
|
+
|
|
56
|
+
**3 lý do chính BDD thuộc PO:**
|
|
57
|
+
|
|
58
|
+
**1. Tổng hợp tài liệu nghiệp vụ tại một nơi** — Khi BDD nằm trong spec repo cùng PRD, mọi spec nghiệp vụ đều ở một chỗ — dễ review, audit, và generate báo cáo. Dev team đọc spec từ submodule, không cần tự suy ra scenarios.
|
|
59
|
+
|
|
60
|
+
**2. BDD viết ở mức nghiệp vụ — PO hiểu được** — BDD trong spec repo mô tả **hành vi hệ thống** bằng ngôn ngữ nghiệp vụ, không phải implementation detail:
|
|
61
|
+
|
|
62
|
+
| Platform | BDD trong spec repo (PO viết) | Test code (Dev viết) |
|
|
63
|
+
|---|---|---|
|
|
64
|
+
| Web | `When user submits login → sees dashboard` | `await page.click('#login-btn')` |
|
|
65
|
+
| App | `When user taps Login → navigates to Home` | `element(by.id('login')).tap()` |
|
|
66
|
+
| System | `When login request received → returns auth token` | `POST /api/auth/login assertions` |
|
|
67
|
+
|
|
68
|
+
**3. System BDD là nguồn sự thật cho BE** — tổng hợp từ FE + App BDD:
|
|
69
|
+
- FE BDD: "User expects auth token để truy cập tiếp"
|
|
70
|
+
- App BDD: "App expects user profile sau khi đăng nhập"
|
|
71
|
+
- System BDD: "BE phải trả `{ token, user_profile }` để thỏa mãn cả 2 platform"
|
|
72
|
+
|
|
73
|
+
> Khi web & app **kỳ vọng response khác nhau**, `/generate-bdd → system` dừng tại **CHECKPOINT** để PO chốt cách giải quyết (union / platform-hint / separate-endpoints) — quyết định ghi vào `@system.resolution:`. Quy trình + ví dụ đầy đủ: [scenarios › Tình huống 12](scenarios.md#tình-huống-12--system-bdd-synthesis-outside-in--xử-lý-cross-platform-conflict).
|
|
74
|
+
|
|
75
|
+
> Xem [Concepts › Traceability](../../03-concepts/traceability.md) để hiểu trace chain PRD → BDD → Code.
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
*Xem thêm:* [Developer Guide](../developer/README.md) · [Tester Guide](../tester/README.md) · [chương QC Automation](../tester/qc-automation.md) · [Reference › Commands](../../05-reference/commands.md)
|