@educa-corp/sdd-framework 0.1.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 +609 -0
- package/commands/debug.md +835 -0
- package/commands/debug.tmpl +257 -0
- package/commands/define-product.md +746 -0
- package/commands/define-product.tmpl +191 -0
- package/commands/dev-gen-test.md +1015 -0
- package/commands/dev-gen-test.tmpl +490 -0
- package/commands/dev-run-test.md +749 -0
- package/commands/dev-run-test.tmpl +224 -0
- package/commands/dev-smoke-test.md +716 -0
- package/commands/dev-smoke-test.tmpl +217 -0
- package/commands/fix-bug.md +749 -0
- package/commands/fix-bug.tmpl +171 -0
- package/commands/generate-bdd.md +1144 -0
- package/commands/generate-bdd.tmpl +499 -0
- package/commands/generate-code.md +1038 -0
- package/commands/generate-code.tmpl +513 -0
- package/commands/generate-design-spec.md +1079 -0
- package/commands/generate-design-spec.tmpl +524 -0
- package/commands/generate-prd.md +945 -0
- package/commands/generate-prd.tmpl +166 -0
- package/commands/generate-spec-manifest.md +663 -0
- package/commands/generate-spec-manifest.tmpl +164 -0
- package/commands/generate-tech-docs.md +1249 -0
- package/commands/generate-tech-docs.tmpl +252 -0
- package/commands/learn.md +641 -0
- package/commands/learn.tmpl +63 -0
- package/commands/map-testids.md +580 -0
- package/commands/map-testids.tmpl +81 -0
- package/commands/propose-scenario.md +632 -0
- package/commands/propose-scenario.tmpl +133 -0
- package/commands/qc-analyze.md +611 -0
- package/commands/qc-analyze.tmpl +112 -0
- package/commands/qc-design-test.md +567 -0
- package/commands/qc-design-test.tmpl +68 -0
- package/commands/qc-plan.md +548 -0
- package/commands/qc-plan.tmpl +49 -0
- package/commands/qc-report.md +559 -0
- package/commands/qc-report.tmpl +60 -0
- package/commands/qc-review.md +552 -0
- package/commands/qc-review.tmpl +53 -0
- package/commands/qc-run-test.md +609 -0
- package/commands/qc-run-test.tmpl +84 -0
- package/commands/refine-prd.md +992 -0
- package/commands/refine-prd.tmpl +278 -0
- package/commands/report-bug.md +647 -0
- package/commands/report-bug.tmpl +148 -0
- package/commands/review-code.md +682 -0
- package/commands/review-code.tmpl +104 -0
- package/commands/review-context.md +1202 -0
- package/commands/review-context.tmpl +488 -0
- package/commands/review-tech-docs.md +871 -0
- package/commands/review-tech-docs.tmpl +372 -0
- package/commands/setup-ai-first.md +546 -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 +928 -0
- package/commands/validate-traces.tmpl +429 -0
- package/core/FRAMEWORK_VERSION +1 -0
- package/core/commands/debug.md +835 -0
- package/core/commands/define-product.md +746 -0
- package/core/commands/dev-gen-test.md +1015 -0
- package/core/commands/dev-run-test.md +749 -0
- package/core/commands/dev-smoke-test.md +716 -0
- package/core/commands/fix-bug.md +749 -0
- package/core/commands/generate-bdd.md +1144 -0
- package/core/commands/generate-code.md +1038 -0
- package/core/commands/generate-design-spec.md +1079 -0
- package/core/commands/generate-prd.md +945 -0
- package/core/commands/generate-spec-manifest.md +663 -0
- package/core/commands/generate-tech-docs.md +1249 -0
- package/core/commands/learn.md +641 -0
- package/core/commands/map-testids.md +580 -0
- package/core/commands/propose-scenario.md +632 -0
- package/core/commands/qc-analyze.md +611 -0
- package/core/commands/qc-design-test.md +567 -0
- package/core/commands/qc-plan.md +548 -0
- package/core/commands/qc-report.md +559 -0
- package/core/commands/qc-review.md +552 -0
- package/core/commands/qc-run-test.md +609 -0
- package/core/commands/refine-prd.md +992 -0
- package/core/commands/report-bug.md +647 -0
- package/core/commands/review-code.md +682 -0
- package/core/commands/review-context.md +1202 -0
- package/core/commands/review-tech-docs.md +871 -0
- package/core/commands/setup-ai-first.md +546 -0
- package/core/commands/sync.md +451 -0
- package/core/commands/update-framework.md +251 -0
- package/core/commands/validate-traces.md +928 -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 +19 -0
- package/core/skills/debug/SKILL.md +19 -0
- package/core/skills/design-spec/SKILL.md +11 -0
- package/core/skills/discovery/SKILL.md +14 -0
- package/core/skills/prd/SKILL.md +19 -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 +11 -0
- package/core/skills/spec/SKILL.md +19 -0
- package/core/skills/test/SKILL.md +18 -0
- package/core/steps/business-language.md +56 -0
- package/core/steps/capture-lesson.md +79 -0
- package/core/steps/context-loader.md +311 -0
- package/core/steps/gate.md +88 -0
- package/core/steps/report-footer.md +100 -0
- package/core/steps/review-fanout.md +159 -0
- package/core/steps/spawn-agent.md +129 -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 +120 -0
- package/core/templates/platform-guide.template.md +145 -0
- package/core/templates/prd.template.md +224 -0
- package/core/templates/product-definition.template.md +188 -0
- package/core/templates/project-context.yaml +161 -0
- package/core/templates/tech-design.template.md +498 -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 +86 -0
- package/docs/02-guides/README.md +26 -0
- package/docs/02-guides/bdd-input-checklist.md +68 -0
- package/docs/02-guides/developer/README.md +49 -0
- package/docs/02-guides/developer/bdd-and-trace.md +126 -0
- package/docs/02-guides/developer/commands.md +76 -0
- package/docs/02-guides/developer/pr-checklist.md +16 -0
- package/docs/02-guides/developer/scenarios.md +460 -0
- package/docs/02-guides/developer/workflow.md +121 -0
- package/docs/02-guides/prd-input-checklist.md +94 -0
- package/docs/02-guides/product-owner/README.md +81 -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 +438 -0
- package/docs/02-guides/tech-docs-input-checklist.md +109 -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 +20 -0
- package/docs/03-concepts/architecture.md +248 -0
- package/docs/03-concepts/mechanisms-explained.md +124 -0
- package/docs/03-concepts/pipeline.md +278 -0
- package/docs/03-concepts/traceability.md +152 -0
- package/docs/04-operations/README.md +33 -0
- package/docs/04-operations/bug-flow.md +364 -0
- package/docs/04-operations/publishing.md +154 -0
- package/docs/04-operations/sync-and-update.md +522 -0
- package/docs/05-reference/README.md +34 -0
- package/docs/05-reference/command-cheatsheet.md +147 -0
- package/docs/05-reference/commands.md +234 -0
- package/docs/05-reference/model-selection.md +74 -0
- package/docs/05-reference/modules.md +110 -0
- package/docs/05-reference/trace-schema.md +154 -0
- package/docs/06-commands/README.md +75 -0
- package/docs/06-commands/explain-debug.md +32 -0
- package/docs/06-commands/explain-define-product.md +43 -0
- package/docs/06-commands/explain-dev-gen-test.md +28 -0
- package/docs/06-commands/explain-dev-run-test.md +24 -0
- package/docs/06-commands/explain-dev-smoke-test.md +25 -0
- package/docs/06-commands/explain-fix-bug.md +28 -0
- package/docs/06-commands/explain-generate-bdd.md +45 -0
- package/docs/06-commands/explain-generate-code.md +53 -0
- package/docs/06-commands/explain-generate-design-spec.md +54 -0
- package/docs/06-commands/explain-generate-prd.md +45 -0
- package/docs/06-commands/explain-generate-spec-manifest.md +20 -0
- package/docs/06-commands/explain-generate-tech-docs.md +56 -0
- package/docs/06-commands/explain-learn.md +21 -0
- package/docs/06-commands/explain-map-testids.md +28 -0
- package/docs/06-commands/explain-propose-scenario.md +24 -0
- package/docs/06-commands/explain-qc-analyze.md +22 -0
- package/docs/06-commands/explain-qc-design-test.md +20 -0
- package/docs/06-commands/explain-qc-plan.md +21 -0
- package/docs/06-commands/explain-qc-report.md +23 -0
- package/docs/06-commands/explain-qc-review.md +24 -0
- package/docs/06-commands/explain-qc-run-test.md +27 -0
- package/docs/06-commands/explain-refine-prd.md +51 -0
- package/docs/06-commands/explain-report-bug.md +24 -0
- package/docs/06-commands/explain-review-code.md +45 -0
- package/docs/06-commands/explain-review-context.md +68 -0
- package/docs/06-commands/explain-review-tech-docs.md +45 -0
- package/docs/06-commands/explain-setup-ai-first.md +25 -0
- package/docs/06-commands/explain-sync.md +24 -0
- package/docs/06-commands/explain-update-framework.md +22 -0
- package/docs/06-commands/explain-validate-traces.md +25 -0
- package/docs/README.md +53 -0
- package/docs/t-sample.md +826 -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/readme.txt +1 -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 +258 -0
- package/scripts/rename-prd-files.js +174 -0
- package/scripts/upgrade.sh +94 -0
- package/skills/code/SKILL.md +19 -0
- package/skills/code/SKILL.tmpl +19 -0
- package/skills/debug/SKILL.md +19 -0
- package/skills/debug/SKILL.tmpl +19 -0
- package/skills/design-spec/SKILL.md +11 -0
- package/skills/design-spec/SKILL.tmpl +11 -0
- package/skills/discovery/SKILL.md +14 -0
- package/skills/discovery/SKILL.tmpl +14 -0
- package/skills/prd/SKILL.md +19 -0
- package/skills/prd/SKILL.tmpl +19 -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 +11 -0
- package/skills/setup-ai-first/SKILL.tmpl +11 -0
- package/skills/spec/SKILL.md +19 -0
- package/skills/spec/SKILL.tmpl +19 -0
- package/skills/test/SKILL.md +18 -0
- package/skills/test/SKILL.tmpl +18 -0
- package/steps/business-language.md +56 -0
- package/steps/capture-lesson.md +79 -0
- package/steps/context-loader.md +311 -0
- package/steps/gate.md +88 -0
- package/steps/report-footer.md +100 -0
- package/steps/review-fanout.md +159 -0
- package/steps/spawn-agent.md +129 -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 +120 -0
- package/templates/platform-guide.template.md +145 -0
- package/templates/prd.template.md +224 -0
- package/templates/product-definition.template.md +188 -0
- package/templates/project-context.yaml +161 -0
- package/templates/tech-design.template.md +498 -0
|
@@ -0,0 +1,1144 @@
|
|
|
1
|
+
# /generate-bdd — Sinh BDD Feature Files
|
|
2
|
+
|
|
3
|
+
## Gate
|
|
4
|
+
# Gate — Quy trình vào chuẩn cho mọi lệnh
|
|
5
|
+
|
|
6
|
+
Mọi lệnh PHẢI chạy gate này trước khi thực thi phần logic riêng của nó.
|
|
7
|
+
|
|
8
|
+
## Bước 0 — Kiểm tra chế độ Sub-Agent
|
|
9
|
+
|
|
10
|
+
Trước tiên, kiểm tra xem `$ARGUMENTS` có phải là payload JSON từ một orchestrator hay không:
|
|
11
|
+
|
|
12
|
+
1. Thử parse `$ARGUMENTS` dưới dạng JSON.
|
|
13
|
+
2. Nếu parse thành công **và** chứa `"_agent_mode": true`:
|
|
14
|
+
- **Bỏ qua hoàn toàn Bước 1, 2 và 3 của Gate này.**
|
|
15
|
+
- Đặt target file = `payload.target_file`
|
|
16
|
+
- Đặt loaded context = `payload.context` (KHÔNG chạy context-loader.md)
|
|
17
|
+
- Đặt phạm vi UC = `payload.uc_id` (chỉ xử lý UC này)
|
|
18
|
+
- Đặt line range = `payload.uc_section` (chỉ đọc đúng section đó của PRD)
|
|
19
|
+
- Đặt dimension = `payload.dimension` nếu có (lệnh review per-UC: chỉ review đúng lăng kính này)
|
|
20
|
+
- Đi thẳng tới phần logic riêng của lệnh.
|
|
21
|
+
3. Nếu `$ARGUMENTS` không phải JSON hoặc không có `_agent_mode` → tiếp tục sang Bước 1 (chế độ thường).
|
|
22
|
+
|
|
23
|
+
## Bước 0-B — Kiểm tra Model
|
|
24
|
+
|
|
25
|
+
*Bỏ qua bước này nếu `_agent_mode: true` (sub-agent — orchestrator đã kiểm tra rồi).*
|
|
26
|
+
|
|
27
|
+
Các lệnh sinh nội dung và review phức tạp đòi hỏi khả năng suy luận mạnh.
|
|
28
|
+
Dùng model nhỏ hơn sẽ rủi ro: bỏ sót edge case, phân tích spec thiếu sót, vi phạm kiến trúc.
|
|
29
|
+
|
|
30
|
+
Hiển thị và chờ phản hồi:
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
⚙️ MODEL CHECK
|
|
34
|
+
──────────────────────────────────────────────────────────────────
|
|
35
|
+
Recommended : claude-opus-4 (hoặc model Opus mới nhất)
|
|
36
|
+
Why needed : Phân tích spec, review kiến trúc, sinh code đòi hỏi
|
|
37
|
+
suy luận sâu. Model nhỏ hơn dễ bỏ sót edge case.
|
|
38
|
+
|
|
39
|
+
Cách đổi trong Claude Code:
|
|
40
|
+
• Settings → Model → chọn "claude-opus"
|
|
41
|
+
• hoặc: /model → chọn claude-opus
|
|
42
|
+
|
|
43
|
+
Đang chạy claude-opus?
|
|
44
|
+
Y — đúng, đang dùng claude-opus → tiếp tục
|
|
45
|
+
S — bỏ qua kiểm tra (tôi chấp nhận rủi ro chất lượng thấp hơn với model hiện tại)
|
|
46
|
+
──────────────────────────────────────────────────────────────────
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
- "Y" → tiếp tục sang Bước 1.
|
|
50
|
+
- "S" → tiếp tục sang Bước 1 (người dùng chấp nhận rủi ro, thêm ⚠️ vào report cuối).
|
|
51
|
+
- "N" hoặc bất kỳ giá trị nào khác → **DỪNG.** Xuất: "Vui lòng chuyển sang claude-opus rồi chạy lại lệnh này."
|
|
52
|
+
|
|
53
|
+
## Bước 1 — Xác định Target File
|
|
54
|
+
|
|
55
|
+
1. Nếu `$ARGUMENTS` được cung cấp và trỏ tới một file tồn tại → dùng trực tiếp làm target.
|
|
56
|
+
2. Nếu `$ARGUMENTS` là một **UC-ID / ticket ID / tên rút gọn** (không có path) → phân giải thành file bằng cách glob theo bố cục feature-package. `{prd-slug}` lúc này **chưa biết**, nên dùng wildcard `*` cho segment đó, và `**` đệ quy dưới `bdd/` để phủ hết các thư mục con theo platform (`bdd/web/`, `bdd/app/`, `bdd/system/`):
|
|
57
|
+
- **Lệnh BDD** (target là `.feature`): `{specs_dir}/{domain}/*/bdd/**/{UC-ID}*.feature` — hoặc `{specs_dir}/*/*/bdd/**/{UC-ID}*.feature` nếu domain cũng chưa biết. Nếu lệnh ngụ ý một platform/scope cụ thể (vd: system tech-doc cần BDD `system/`), ưu tiên kết quả trong thư mục con platform đó.
|
|
58
|
+
- **Lệnh PRD** (target là file PRD `{TICKET-ID}-{prd-slug}.md` — file `.md` duy nhất ở gốc feature folder, cạnh `bdd/`): `{specs_dir}/{domain}/*/{TICKET-ID}*.md` nếu biết TICKET-ID; nếu không, `{specs_dir}/{domain}/*/*.md` (khớp feature folder có id tương ứng), hoặc `{specs_dir}/*/*/*.md` nếu domain cũng chưa biết. *(Glob `*/*.md` ở cấp gốc folder chỉ khớp PRD — tech-docs/design-spec `.md` nằm sâu hơn trong thư mục con.)*
|
|
59
|
+
- **Lệnh tech-docs**: `{specs_dir}/{domain}/*/tech-docs/{UC-ID}*-tech-design*.md`.
|
|
60
|
+
- **Lệnh design-spec**: `{specs_dir}/{domain}/*/design-spec/{TICKET-ID}*.md`.
|
|
61
|
+
|
|
62
|
+
Khi một file khớp: đặt nó làm target **và** ghi lại `domain` + `prd_slug` từ path của nó (theo quy tắc trích xuất trong `context-loader.md` Bước 1 — `prd_slug` = segment đầu tiên sau `{specs_dir}/{domain}/`). Mọi path mà lệnh đọc/ghi về sau (BDD/tech-docs/design-spec/trace cùng cấp) đều dùng **`prd_slug` đã phân giải đó**, nên tất cả artifact nằm chung một feature package. Nếu nhiều file khớp (vd: nhiều platform), chọn theo platform/scope của lệnh hoặc liệt kê ra và hỏi.
|
|
63
|
+
3. Nếu `$ARGUMENTS` rỗng hoặc không tìm thấy file khớp:
|
|
64
|
+
- Liệt kê các file trong thư mục liên quan của lệnh này (vd: `specs/*/*/*.md` — file PRD ở gốc mỗi feature folder — cho lệnh PRD, `specs/*/*/bdd/**/*.feature` cho lệnh BDD).
|
|
65
|
+
- Hiển thị danh sách cho người dùng và hỏi: "Bạn muốn làm việc với file nào? (Nhập số thứ tự hoặc tên file)"
|
|
66
|
+
- Chờ người dùng chọn rồi mới tiếp tục.
|
|
67
|
+
|
|
68
|
+
## Bước 2 — Chạy Context Loader
|
|
69
|
+
|
|
70
|
+
Nạp toàn bộ context của dự án bằng cách làm theo quy trình trong `steps/context-loader.md`.
|
|
71
|
+
Lưu toàn bộ context đã nạp vào bộ nhớ để dùng xuyên suốt phiên làm việc của lệnh.
|
|
72
|
+
|
|
73
|
+
## Bước 3 — CHECKPOINT
|
|
74
|
+
|
|
75
|
+
Sau khi hoàn thành Bước 1 và 2, hiển thị bản tóm tắt và chờ xác nhận:
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
CHECKPOINT
|
|
79
|
+
-----------
|
|
80
|
+
Target : {resolved file path}
|
|
81
|
+
Project : {project.name từ project-context.yaml}
|
|
82
|
+
Tech stack : {language} / {framework}
|
|
83
|
+
Module : {module nếu có, else "not configured"}
|
|
84
|
+
Domains : {danh sách domain, ngăn cách bởi dấu phẩy}
|
|
85
|
+
|
|
86
|
+
Tiếp tục? (Y/N)
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Chờ người dùng trả lời rõ ràng "Y" hoặc "N" rồi mới tiếp tục.
|
|
90
|
+
- "Y" → tiếp tục sang các bước riêng của lệnh bên dưới.
|
|
91
|
+
- "N" → dừng lại và hỏi người dùng muốn thay đổi gì.
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
## Context
|
|
95
|
+
# Context Loader — Nạp toàn bộ context dự án
|
|
96
|
+
|
|
97
|
+
Thực hiện các bước theo đúng thứ tự. Lưu mọi thứ vào bộ nhớ trong suốt phiên làm việc của lệnh.
|
|
98
|
+
|
|
99
|
+
**Hướng dẫn ưu tiên (chống lost-in-middle):**
|
|
100
|
+
- Bước 1–2 là PROJECT-CONFIG — nạp trước, phân giải mọi path và metadata.
|
|
101
|
+
- Bước 3 là CRITICAL — kiến trúc + coding standards, là các sự thật ưu tiên cao nhất khi sinh nội dung.
|
|
102
|
+
- Bước 4 là SAFETY — quy tắc bảo vệ dữ liệu, thực thi ngầm suốt cả phiên.
|
|
103
|
+
- Bước 5–6 là DOMAIN KNOWLEDGE — thuật ngữ và định nghĩa entity.
|
|
104
|
+
- Bước 7 là WORKING MEMORY RECAP — chốt các sự thật quan trọng lên đầu bộ nhớ làm việc.
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## Bước 1 — [PROJECT-CONFIG] Nạp project-context.yaml
|
|
109
|
+
|
|
110
|
+
Đọc `.agent/project-context.yaml`. Trích xuất và lưu:
|
|
111
|
+
|
|
112
|
+
**Tech Stack:**
|
|
113
|
+
- `tech_stack.language` → ngôn ngữ đang dùng (vd: Java 17, TypeScript, C#, Go)
|
|
114
|
+
- `tech_stack.framework` → framework đang dùng (vd: Spring Boot 3.2, Angular 17, .NET 8)
|
|
115
|
+
- `tech_stack.build_tool` → build tool (vd: Maven, npm, dotnet, go)
|
|
116
|
+
- `tech_stack.test_framework` → test framework (vd: JUnit 5 + Mockito, Jest, xUnit)
|
|
117
|
+
- `tech_stack.database` → database (vd: PostgreSQL, MySQL, MongoDB)
|
|
118
|
+
- `tech_stack.module` → module profile đang dùng (vd: java-spring, angular, dotnet, golang, context-engineering)
|
|
119
|
+
|
|
120
|
+
**Conventions:**
|
|
121
|
+
- `conventions.build_command` → cách compile/build
|
|
122
|
+
- `conventions.test_command` → cách chạy test
|
|
123
|
+
- `conventions.service_run` → cách khởi động service
|
|
124
|
+
- `conventions.ticket_prefix` → tiền tố ticket ID (vd: PROJ, FEAT, UC)
|
|
125
|
+
|
|
126
|
+
**Domains:**
|
|
127
|
+
- `domains` → danh sách các business domain đang hoạt động
|
|
128
|
+
|
|
129
|
+
**Paths (nếu có):**
|
|
130
|
+
- `paths.specs_dir` → gốc của spec artifact — PRD, BDD, tech-docs, design-spec. Cấu trúc: `{specs_dir}/{domain}/{prd-slug}/{ {TICKET-ID}-{prd-slug}.md | bdd/ | tech-docs/ | design-spec/}` (file PRD đặt tên `{TICKET-ID}-{prd-slug}.md`, là file `.md` duy nhất ở gốc feature folder)
|
|
131
|
+
- `paths.refinement_dir` → thư mục output cho findings/review
|
|
132
|
+
- `paths.qc_dir` → gốc artifact QC automation (hiện ở top-level, mỗi UC một thư mục con: `{qc_dir}/{UC-ID}/`)
|
|
133
|
+
- `paths.qc_skills_dir` → nơi các lệnh qc-* nạp QC skill (mặc định bundled `.agent/skills/qc`; override sang repo/submodule riêng của team QC để bản nâng cấp framework không ghi đè)
|
|
134
|
+
- `paths.product_definitions_dir` → gốc product definition
|
|
135
|
+
- `paths.domain_knowledge_dir` → gốc domain knowledge
|
|
136
|
+
- `paths.business_dictionary` → path tới business-dictionary.md
|
|
137
|
+
- `paths.core_entities` → path tới core-entities.md
|
|
138
|
+
- `paths.tech_docs_dir` → gốc tài liệu kỹ thuật (gộp với specs_dir trong bố cục feature-package — tech-docs nằm dưới `{specs_dir}/{domain}/{prd-slug}/tech-docs/`)
|
|
139
|
+
- `paths.trace_dir` → thư mục trạng thái trace; cấu trúc: `.trace/{domain}/{prd-slug}/{UC-ID}-{platform}.tsv` (mỗi UC × platform một sổ)
|
|
140
|
+
|
|
141
|
+
Nếu không có section `paths`, dùng các giá trị mặc định:
|
|
142
|
+
- `specs_dir` = `specs`
|
|
143
|
+
- `refinement_dir` = `.agent/review`
|
|
144
|
+
- `qc_dir` = `docs`
|
|
145
|
+
- `qc_skills_dir` = `.agent/skills/qc`
|
|
146
|
+
- `product_definitions_dir` = `specs/product-definition`
|
|
147
|
+
- `domain_knowledge_dir` = `specs/domain-knowledge`
|
|
148
|
+
- `business_dictionary` = `specs/domain-knowledge/business-dictionary.md`
|
|
149
|
+
- `core_entities` = `specs/domain-knowledge/core-entities.md`
|
|
150
|
+
- `tech_docs_dir` = `specs`
|
|
151
|
+
- `trace_dir` = `.trace`
|
|
152
|
+
|
|
153
|
+
Lưu ý: Trong bố cục feature-package, `specs_dir` là gốc thống nhất. Mọi loại spec artifact (PRD, BDD, tech-docs, design-spec) đều nằm dưới `{specs_dir}/{domain}/{prd-slug}/`. `prd-slug` là tên folder feature-package, không phải một biến config riêng.
|
|
154
|
+
|
|
155
|
+
**Cách trích xuất `prd_slug` (đúng cho MỌI target file, bất kể độ sâu lồng nhau):** với một path target dạng `{specs_dir}/{domain}/{prd-slug}/...`, lấy **segment path đầu tiên sau `{specs_dir}/{domain}/`** — tức vị trí `{prd-slug}`. KHÔNG dùng folder cha trực tiếp của file, vì artifact BDD/tech-docs/design-spec lồng sâu hơn một hoặc hai cấp bên trong package. Ví dụ:
|
|
156
|
+
- `specs/payment/create-invoice/PAY01-create-invoice.md` → `prd_slug = create-invoice`
|
|
157
|
+
- `specs/payment/create-invoice/bdd/system/PAY-UC1.feature` → `prd_slug = create-invoice` *(KHÔNG phải `system`)*
|
|
158
|
+
- `specs/payment/create-invoice/bdd/web/PAY-UC1.feature` → `prd_slug = create-invoice` *(KHÔNG phải `web`)*
|
|
159
|
+
- `specs/payment/create-invoice/tech-docs/PAY01-tech-design.md` → `prd_slug = create-invoice` *(KHÔNG phải `tech-docs`)*
|
|
160
|
+
- `specs/payment/create-invoice/design-spec/PAY-design-spec-web.md` → `prd_slug = create-invoice`
|
|
161
|
+
|
|
162
|
+
Mọi artifact cùng cấp của một feature (PRD, BDD của từng platform, tech-docs BE + FE, design-spec, và trace TSV) đều phân giải về **cùng một `prd_slug`** — nên một BDD **system** hay tech-doc **system/BE** được tổng hợp sẽ nằm chung package `{specs_dir}/{domain}/{prd-slug}/` với các artifact web/app mà nó được suy ra từ đó.
|
|
163
|
+
|
|
164
|
+
Nếu `tech_stack.module` được đặt, đồng thời nạp `.agent/modules/{module}/stack-profile.yaml` nếu file tồn tại.
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## Bước 1.5 — [SERVICE ROUTING] Phân giải path service (chế độ umbrella)
|
|
169
|
+
|
|
170
|
+
*Bỏ qua hoàn toàn bước này nếu `setup.mode` không phải `"umbrella"` và không có section `services` trong project-context.yaml.*
|
|
171
|
+
|
|
172
|
+
Nếu có section `services`:
|
|
173
|
+
|
|
174
|
+
**1. Phát hiện active domain** (theo thứ tự ưu tiên):
|
|
175
|
+
- Đọc `@trace.domain` từ frontmatter của target file (nếu Gate đã nạp một target file)
|
|
176
|
+
- Trích xuất từ path target file: `domain` = segment đầu tiên sau base path `specs_dir`; `prd_slug` = segment kế tiếp (folder feature-package). Điều này đúng ở mọi độ sâu target — xem quy tắc trích xuất `prd_slug` ở Bước 1.
|
|
177
|
+
*(vd: `specs/user/create-account/USR01-create-account.md` **và** `specs/user/create-account/bdd/system/UC1.feature` đều → domain = `user`, prd_slug = `create-account`)*
|
|
178
|
+
- Nếu `$ARGUMENTS` chứa một path, trích xuất segment domain sau `specs_dir`
|
|
179
|
+
|
|
180
|
+
**2. Route tới service** — nếu active domain khớp với một key trong `services`:
|
|
181
|
+
- Override `paths.specs_dir` → `services.{domain}.specs_dir` — **chỉ khi `setup.spec_source` KHÔNG được đặt.** Khi `spec_source` ĐƯỢC đặt, MỌI BDD (web/app/**system**) là artifact dùng chung liên team → để bước 4 route sang spec repo; KHÔNG pin theo service ở đây.
|
|
182
|
+
- Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir` — **chỉ khi `setup.spec_source` KHÔNG được đặt.** Khi `spec_source` ĐƯỢC đặt, tech-design (API contract) là artifact liên team và phải nằm trong spec repo dùng chung (xử lý ở bước 4), nên để bước 4 route `tech_docs_dir` — KHÔNG pin theo service ở đây.
|
|
183
|
+
- Lưu `active_service` = `services.{domain}.path`
|
|
184
|
+
- Lưu `active_service_module` = `services.{domain}.module`
|
|
185
|
+
- Nếu service có `module` riêng → dùng nó làm `active_module` (override `tech_stack.module`)
|
|
186
|
+
|
|
187
|
+
**3. Fallback** — nếu không phát hiện được domain hoặc không có service key khớp:
|
|
188
|
+
- Giữ path mặc định từ Bước 1
|
|
189
|
+
- Đặt `active_service = unresolved`
|
|
190
|
+
|
|
191
|
+
**4. Tự động override theo spec source** — nếu `setup.spec_source` được đặt VÀ path tương ứng chưa được set tường minh trong `paths:`:
|
|
192
|
+
- Override `paths.specs_dir` → `{spec_source}/specs` — **luôn khi `spec_source` được đặt.** Mọi spec artifact (PRD, BDD, tech-docs, design-spec) nằm dưới gốc spec thống nhất trong spec repo dùng chung theo bố cục feature-package: `{spec_source}/specs/{domain}/{prd-slug}/`. Mọi umbrella (FE/App/BE) đều đọc từ đây. *(`specs/` theo service chỉ khi không có `spec_source`.)*
|
|
193
|
+
- Override `paths.tech_docs_dir` → `{spec_source}/specs` — **luôn khi `spec_source` được đặt** (bước 2 không còn pin tech-docs theo service trong trường hợp này). Tech-docs nằm tại `{spec_source}/specs/{domain}/{prd-slug}/tech-docs/`. Tech-design CHÍNH LÀ API contract liên team: BE viết ở đây, FE/App đọc nó từ cùng spec submodule tại `/generate-code --phase=integration`. *(tech-docs theo service chỉ xảy ra khi không có `spec_source` — repo BE thuần đa-service không có spec module dùng chung.)*
|
|
194
|
+
- Override `paths.domain_knowledge_dir` → `{spec_source}/specs/domain-knowledge`
|
|
195
|
+
- Override `paths.business_dictionary` → `{spec_source}/specs/domain-knowledge/business-dictionary.md`
|
|
196
|
+
- Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
|
|
197
|
+
- Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
|
|
198
|
+
- Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
|
|
199
|
+
- Override `paths.prd_change_requests_dir` → `{spec_source}/feedback/prd-change-requests`
|
|
200
|
+
- Override `paths.trace_dir` → `{spec_source}/.trace` — **luôn khi `spec_source` được đặt.** Trace TSV được gộp vào spec repo (một nơi authoritative duy nhất, không tách theo service) để PM/PO có một chỗ duy nhất quản lý trạng thái. Cấu trúc bên trong: `.trace/{domain}/{prd-slug}/{UC-ID}-{platform}.tsv`. Các lệnh phía code (`/generate-code`, `/dev-run-test`, `/qc-run-test`) chạy từ `service_root` nhưng **ghi trace row của chúng vào `{spec_source}/.trace/{domain}/{prd-slug}/`** — giống như chúng đã push `feedback/` vào đó. *(`.trace` theo service chỉ khi không có `spec_source`.)*
|
|
201
|
+
- Override `paths.refinement_dir` → `{spec_source}/.agent/review` — **luôn khi `spec_source` được đặt.** Findings review (`/refine-prd`, `/review-context`, `/review-tech-docs`) là artifact liên-team *về* tài liệu trong spec repo (PRD/BDD/tech-design) — thuộc cùng khu vực ghi với `.trace/` và `feedback/`. Các lệnh review chạy từ working dir của service (BE repo) nhưng **ghi findings vào `{spec_source}/.agent/review/`**, KHÔNG phải `.agent/review` của service repo. Bên trong flat, phân biệt bằng tên file đã prefix `{prd-slug}`/`{UC-ID}`/`{TICKET-ID}`. *(`.agent/review` theo service chỉ khi không có `spec_source`.)*
|
|
202
|
+
|
|
203
|
+
> **Vì sao đặt dưới `spec_source`:** PRD, BDD, tech-docs, design-spec, domain knowledge, feedback của tester, **trạng thái coverage `.trace/`**, **và findings review `.agent/review/`** đều là **artifact liên team** — chúng nằm trong **spec repo dùng chung** theo bố cục feature-package để mọi umbrella (FE/App/BE) và PM đọc từ một nguồn qua `/sync`. Trong bố cục feature-package, một folder `specs/{domain}/{prd-slug}/` gom tất cả loại artifact của một PRD, giúp spec repo tự đủ và dễ điều hướng theo feature. Service submodule chỉ chứa **code** (+ tooling build/test). `.trace/`, `.agent/review/` và `feedback/` là khu vực **ghi** của dev/QC/reviewer trong spec repo. Ở chế độ single-service (không có `spec_source`), mọi thứ mặc định dưới gốc repo — vẫn là một repo.
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## Bước 1.6 — [SERVICE CONVENTIONS] Nạp convention riêng của service (chế độ umbrella)
|
|
208
|
+
|
|
209
|
+
*Bỏ qua hoàn toàn bước này nếu `active_service` là `"unresolved"` hoặc context ở chế độ single-service.*
|
|
210
|
+
|
|
211
|
+
Khi `active_service` đã được phân giải thành một path thật ở Bước 1.5 (vd: `user-service/`):
|
|
212
|
+
|
|
213
|
+
**1. Định vị config của service** — thử theo thứ tự ưu tiên:
|
|
214
|
+
- `{active_service}/.agent/project-context.yaml`
|
|
215
|
+
- `{active_service}/project-context.yaml`
|
|
216
|
+
|
|
217
|
+
**2. Nếu tìm thấy, override bằng giá trị riêng của service:**
|
|
218
|
+
|
|
219
|
+
| Biến | Nguồn |
|
|
220
|
+
|----------|--------|
|
|
221
|
+
| `conventions.test_command` | `conventions.test_command` của service |
|
|
222
|
+
| `conventions.build_command` | `conventions.build_command` của service |
|
|
223
|
+
| `paths.trace_dir` | **Nếu `spec_source` được đặt → giữ route spec-repo của bước 4 (`{spec_source}/.trace`); bỏ qua mọi `trace_dir` cấp service.** Chỉ khi không có `spec_source`: `{active_service}/{service paths.trace_dir}` (mặc định `{active_service}/.trace`). |
|
|
224
|
+
| `paths.specs_dir` | **Nếu `spec_source` được đặt → giữ route spec-repo của bước 4 (`{spec_source}/specs`); bỏ qua mọi `specs_dir` cấp service** (mọi spec artifact đều liên team, không bao giờ theo service ở chế độ này). Chỉ khi không có `spec_source`: `{active_service}/{service paths.specs_dir}` nếu được set, else dùng override ở Bước 1.5. |
|
|
225
|
+
| `paths.refinement_dir` | **Nếu `spec_source` được đặt → giữ route spec-repo của bước 4 (`{spec_source}/.agent/review`); bỏ qua mọi `refinement_dir` cấp service** (findings review là artifact liên team). Chỉ khi không có `spec_source`: `{active_service}/.agent/review`. |
|
|
226
|
+
|
|
227
|
+
**3. Lưu** `service_root = {active_service}` làm mốc thư mục làm việc cho mọi lệnh phía sau:
|
|
228
|
+
- Các lệnh shell (`/dev-run-test`, `/dev-gen-test`) chạy **bên trong** `service_root`
|
|
229
|
+
- **File source/test** được ghi tương đối với `service_root`; **trace TSV** được ghi vào `{paths.trace_dir}` (là spec repo khi `spec_source` được đặt — một thao tác ghi liên-repo, commit/push vào spec submodule giống như `feedback/`).
|
|
230
|
+
|
|
231
|
+
**4. Nếu không tìm thấy config của service** — giữ mặc định umbrella, vẫn set `service_root = {active_service}` (luôn cần mốc path kể cả khi không có config override).
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## Bước 2 — [PROJECT-CONFIG] Nạp module stack profile (có điều kiện)
|
|
236
|
+
|
|
237
|
+
Nếu `tech_stack.module` được đặt, đọc `.agent/modules/{module}/stack-profile.yaml`.
|
|
238
|
+
Merge các convention riêng của framework (layer pattern, test pattern, quy tắc đặt tên) vào context đã nạp.
|
|
239
|
+
Nếu file không tồn tại → bỏ qua âm thầm.
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
## Bước 3 — [CRITICAL] Nạp CLAUDE.md (phân tầng: root + service overlay)
|
|
244
|
+
|
|
245
|
+
*Đây là context ưu tiên cao nhất — nó định nghĩa CÁCH viết code và tài liệu cho dự án này.*
|
|
246
|
+
|
|
247
|
+
CLAUDE.md được nạp theo **hai tầng** để các quy tắc toàn-umbrella và kiến trúc/coding standards
|
|
248
|
+
riêng của service kết hợp đúng cách. Agent luôn đứng ở gốc umbrella, nhưng code triển khai nằm
|
|
249
|
+
trong một service submodule với stack, kiến trúc, và convention RIÊNG của nó — nên CLAUDE.md của
|
|
250
|
+
service phải thắng khi sinh code.
|
|
251
|
+
|
|
252
|
+
**Tầng 1 — [BASE] Root CLAUDE.md (toàn umbrella).**
|
|
253
|
+
Đọc `CLAUDE.md` ở gốc repo. Coi nội dung của nó là **nền tảng dùng chung** cho cả umbrella —
|
|
254
|
+
git convention, tư thế bảo vệ dữ liệu, quy tắc xuyên suốt, và (ở chế độ single-service) là
|
|
255
|
+
kiến trúc + coding standards duy nhất của dự án.
|
|
256
|
+
|
|
257
|
+
**Tầng 2 — [OVERLAY] Service CLAUDE.md (chỉ chế độ umbrella).**
|
|
258
|
+
*Chỉ chạy nếu `service_root` đã được set ở Bước 1.6 (tức đã route tới một service thật).*
|
|
259
|
+
Đọc `{service_root}/CLAUDE.md`. File này định nghĩa kiến trúc + coding standards của **stack
|
|
260
|
+
thực sự đang được triển khai** (vd: `user-service` = java-spring, `web` = nextjs).
|
|
261
|
+
Overlay nó lên trên Tầng 1: **khi có xung đột, giá trị của service THẮNG** cho kiến trúc,
|
|
262
|
+
coding standards, và error handling. Các giá trị Tầng 1 mà service không định nghĩa lại
|
|
263
|
+
(vd: git convention, banned pattern dùng chung toàn tổ chức) vẫn có hiệu lực.
|
|
264
|
+
|
|
265
|
+
Từ kết quả **đã merge**, trích xuất và lưu:
|
|
266
|
+
|
|
267
|
+
- **§1 Project Overview** → tên dự án, ngôn ngữ, framework, lệnh build/test, domains
|
|
268
|
+
- **§2 Architecture** → thứ tự layer (vd: Controller → Facade → Service → Repository), quy tắc kiến trúc — *service overlay thắng*
|
|
269
|
+
- **§2 Package Layout** → **base package** (vd `vn.edupia.{service}`) + **chiến lược đặt package** (by-layer / by-feature) + nơi code một domain sống. Đây là **quy ước đặt code trên đĩa**, PHẢI enforce khi sinh code. Nếu §2 chỉ nêu base package + thứ tự layer mà **không** nói tới sub-package theo feature → hiểu là **by-layer**: các layer đặt **TRỰC TIẾP** dưới base package (vd `vn.edupia.{service}.service`, `.repository`); feature/UC/prd-slug **KHÔNG** thành sub-package, chỉ phân biệt ở **tên class**. Lưu `code_base_package` + `package_strategy` — *service overlay thắng*.
|
|
270
|
+
- **§3 Coding Standards** → quy tắc đặt tên (class, method), kiểu response wrapper, pattern bị cấm — *service overlay thắng*
|
|
271
|
+
- **§5 Error Handling** → kiểu exception, mapping HTTP status code, tên class not-found exception — *service overlay thắng*
|
|
272
|
+
- **§7 Git Conventions** → pattern đặt tên branch, format commit message — *lấy theo root trừ khi service định nghĩa lại*
|
|
273
|
+
|
|
274
|
+
**Quy tắc phân giải:**
|
|
275
|
+
- Nếu cả hai tầng tồn tại → merge như trên; ghi `claude_md_source = root + {service_root}`.
|
|
276
|
+
- Nếu chỉ có service overlay (không có root CLAUDE.md) → dùng file service một mình; `claude_md_source = {service_root}`.
|
|
277
|
+
- Nếu `service_root` được set nhưng `{service_root}/CLAUDE.md` **thiếu** → fallback về root CLAUDE.md và gắn cờ ⚠️ trong recap Bước 7 (service không có định nghĩa kiến trúc/coding-standards — việc sinh code sẽ dùng mặc định umbrella, có thể sai stack).
|
|
278
|
+
- Nếu cả hai đều không tồn tại → ghi nhận CLAUDE.md thiếu và tiếp tục chỉ với dữ liệu từ project-context.yaml.
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
## Bước 4 — [SAFETY] Nạp quy tắc bảo vệ dữ liệu
|
|
283
|
+
|
|
284
|
+
Đọc `.agent/rules/data-protection.md` (hoặc `rules/data-protection.md` từ bản cài đặt framework).
|
|
285
|
+
|
|
286
|
+
Lưu các pattern file nhạy cảm — bạn **tuyệt đối không** đọc, ghi, hiển thị, hay tham chiếu nội dung từ các file khớp những pattern đó trong suốt cả phiên.
|
|
287
|
+
|
|
288
|
+
Nếu cả hai file đều không tồn tại → áp dụng mặc định built-in: không bao giờ truy cập `.env*`, `*.key`, `*.pem`, `*secret*`, `*password*`, `*credential*`.
|
|
289
|
+
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
## Bước 5 — [DOMAIN] Nạp Business Dictionary (có điều kiện)
|
|
293
|
+
|
|
294
|
+
Kiểm tra file business dictionary có tồn tại không (dùng `paths.business_dictionary` đã phân giải ở Bước 1).
|
|
295
|
+
|
|
296
|
+
Nếu tồn tại, đọc và trích xuất:
|
|
297
|
+
- **Canonical Terms** → danh sách đầy đủ các thuật ngữ chuẩn và định nghĩa
|
|
298
|
+
- **Banned Terms** → danh sách đầy đủ các thuật ngữ bị cấm và bản thay thế chuẩn
|
|
299
|
+
- **Status / Enum Registry** → các giá trị enum được phép theo từng entity
|
|
300
|
+
|
|
301
|
+
Lưu danh sách banned term để **thực thi chủ động** suốt phiên làm việc của lệnh:
|
|
302
|
+
- Khi sinh bất kỳ văn bản nào (PRD, BDD, comment code, tech docs), kiểm tra không có banned term nào xuất hiện
|
|
303
|
+
- Tự động thay banned term bằng bản chuẩn tương đương
|
|
304
|
+
|
|
305
|
+
Nếu file không tồn tại → bỏ qua âm thầm. Không cảnh báo hay chặn.
|
|
306
|
+
|
|
307
|
+
---
|
|
308
|
+
|
|
309
|
+
## Bước 6 — [DOMAIN] Nạp Core Entities (có điều kiện)
|
|
310
|
+
|
|
311
|
+
Kiểm tra file core entities có tồn tại tại `paths.core_entities` không (đã phân giải ở Bước 1).
|
|
312
|
+
Path mặc định: `specs/domain-knowledge/core-entities.md`.
|
|
313
|
+
|
|
314
|
+
Nếu tồn tại, đọc và lưu:
|
|
315
|
+
- **Entity catalog** → với mỗi entity: tên, mục đích, service sở hữu, các field chính (tên + kiểu), business invariant, và quan hệ
|
|
316
|
+
- **Field name registry** → tên field chuẩn dùng trong code và tài liệu được sinh ra
|
|
317
|
+
- **Relationship map** → cách các entity liên hệ với nhau (1:N, N:N, embedded, v.v.)
|
|
318
|
+
|
|
319
|
+
**Cách dùng catalog này:**
|
|
320
|
+
- Khi sinh code: dùng tên field, kiểu, và quan hệ định nghĩa ở đây — KHÔNG suy đoán từ code có sẵn
|
|
321
|
+
- Khi sinh PRD/BDD: tham chiếu tên entity từ catalog này để nhất quán
|
|
322
|
+
- Khi sinh tech-docs: dùng catalog này làm nguồn chân lý cho định nghĩa entity
|
|
323
|
+
|
|
324
|
+
Nếu file không tồn tại → bỏ qua âm thầm.
|
|
325
|
+
|
|
326
|
+
---
|
|
327
|
+
|
|
328
|
+
## Bước 6.5 — [PLATFORM] Suy ra active_module và platform_type
|
|
329
|
+
|
|
330
|
+
Dùng `tech_stack.module` đã nạp ở Bước 1, suy ra và lưu hai biến để mọi lệnh phía sau dùng:
|
|
331
|
+
|
|
332
|
+
```
|
|
333
|
+
active_module = tech_stack.module (vd: "java-spring", "react", "flutter")
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
| `platform_type` | Modules |
|
|
337
|
+
|---|---|
|
|
338
|
+
| `backend` | `java-spring`, `golang`, `dotnet`, `php-laravel`, `context-engineering` |
|
|
339
|
+
| `web-frontend` | `react`, `nextjs`, `vue`, `nuxt`, `angular` |
|
|
340
|
+
| `mobile` | `flutter`, `react-native`, `ios-swiftui`, `android-compose` |
|
|
341
|
+
|
|
342
|
+
Nếu `tech_stack.module` rỗng hoặc không nhận diện được → set `platform_type = "unknown"` và gắn cờ ⚠️ trong recap Bước 7.
|
|
343
|
+
|
|
344
|
+
Hai biến này (`active_module`, `platform_type`) là nguồn chuẩn cho mọi logic rẽ nhánh trong các lệnh cần hành vi riêng theo platform (dev-gen-test, debug, fix-bug, dev-smoke-test).
|
|
345
|
+
|
|
346
|
+
---
|
|
347
|
+
|
|
348
|
+
## Bước 6.7 — [GUARDRAILS] Nạp Project Lessons (có điều kiện)
|
|
349
|
+
|
|
350
|
+
*Các lỗi tích luỹ mà AI không được lặp lại trong dự án này. Chúng được bổ sung dần qua `/learn`
|
|
351
|
+
hoặc được chấp nhận trong `/review-code`, `/fix-bug`, `/debug`.*
|
|
352
|
+
|
|
353
|
+
Phân giải path file lessons:
|
|
354
|
+
- Dùng `paths.lessons_file` nếu được set (có thể bị service override ở chế độ umbrella, Bước 1.6)
|
|
355
|
+
- Else mặc định `specs/domain-knowledge/lessons-learned.md`
|
|
356
|
+
- Ở chế độ umbrella/service (khi `service_root` được set), nếu `paths.lessons_file` chưa set, mặc định `{service_root}/.agent/project-lessons.md`
|
|
357
|
+
|
|
358
|
+
Nếu file tồn tại, đọc và lưu TẤT CẢ lesson làm **GUARDRAIL ĐANG HOẠT ĐỘNG** cho phiên:
|
|
359
|
+
- Coi **Rule** của mỗi lesson là ràng buộc cứng — cùng mức ưu tiên với coding standards trong CLAUDE.md (Bước 3).
|
|
360
|
+
- Trước khi sinh hoặc sửa bất kỳ artifact nào (PRD, BDD, tech-doc, code, test), đối chiếu output với mọi lesson có `category` khớp lệnh hiện tại VÀ `scope` khớp target (domain / file).
|
|
361
|
+
- Nếu output sinh ra vi phạm một lesson → sửa **trước khi** trình bày, và ghi rõ lesson nào (`L-NNN`) đã được áp dụng.
|
|
362
|
+
|
|
363
|
+
Nếu file không tồn tại → bỏ qua âm thầm (chưa có lesson nào được ghi nhận).
|
|
364
|
+
|
|
365
|
+
---
|
|
366
|
+
|
|
367
|
+
## Bước 7 — [RECAP] Working Memory Recap (chống lost-in-middle)
|
|
368
|
+
|
|
369
|
+
Sau khi nạp toàn bộ context, tổng hợp và xuất một khối tóm tắt gọn.
|
|
370
|
+
Recap này đảm bảo các sự thật quan trọng nhất được nêu ở CUỐI quá trình nạp context
|
|
371
|
+
(hiệu ứng recency — tươi mới nhất trong bộ nhớ làm việc khi bắt đầu task).
|
|
372
|
+
|
|
373
|
+
Xuất đúng khối này:
|
|
374
|
+
```
|
|
375
|
+
[CTX LOADED]
|
|
376
|
+
Stack : {language} / {framework} / {database}
|
|
377
|
+
Platform : {active_module} ({platform_type})
|
|
378
|
+
Layers : {thứ tự layer từ CLAUDE.md §2 đã merge, vd: Controller → Facade → Service → Repository}
|
|
379
|
+
Package : {code_base_package}.{layer} · {by-layer | by-feature} ← feature/UC → tên class, KHÔNG thành package (nếu by-layer)
|
|
380
|
+
CLAUDE.md : {root + {service_root} | chỉ {service_root} | chỉ root | ⚠️ service overlay THIẾU — dùng root | missing}
|
|
381
|
+
Ticket : {ticket_prefix}-
|
|
382
|
+
Dict : {loaded — N canonical terms, M banned terms | missing}
|
|
383
|
+
Entities : {loaded — EntityA, EntityB, EntityC | missing}
|
|
384
|
+
Lessons : {loaded — N guardrails | chưa có}
|
|
385
|
+
Service : {active_service} ({active_service_module}) | single-service
|
|
386
|
+
Svc Root : {service_root} — đã nạp conventions + trace_dir từ config service | —
|
|
387
|
+
Status : {FULL | PARTIAL — thiếu: CLAUDE.md / business-dict / core-entities | MINIMAL}
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
Nếu bất kỳ file CRITICAL nào thiếu (CLAUDE.md), gắn cờ rõ ràng để người dùng quyết định có tiếp tục hay không.
|
|
391
|
+
|
|
392
|
+
---
|
|
393
|
+
|
|
394
|
+
## Hoàn tất nạp Context
|
|
395
|
+
|
|
396
|
+
Sau khi hoàn thành tất cả các bước, bạn đã nạp:
|
|
397
|
+
- Định danh dự án, tech stack, convention module
|
|
398
|
+
- Quy tắc kiến trúc và thứ tự layer ← **[CRITICAL — giữ trong bộ nhớ làm việc]**
|
|
399
|
+
- Coding standards và quy tắc đặt tên ← **[CRITICAL — giữ trong bộ nhớ làm việc]**
|
|
400
|
+
- Quy tắc bảo vệ dữ liệu (pattern file nhạy cảm không bao giờ truy cập)
|
|
401
|
+
- Quy tắc thuật ngữ kèm danh sách banned term ← **[DOMAIN — áp dụng cho mọi từ được sinh ra]**
|
|
402
|
+
- Entity catalog (tên field, kiểu, invariant) ← **[DOMAIN — dùng khi sinh code]**
|
|
403
|
+
- Toàn bộ path đã cấu hình
|
|
404
|
+
|
|
405
|
+
Tiếp tục sang bước kế tiếp của lệnh đang gọi.
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
> **Proposal của tester (input tuỳ chọn):** trước khi sinh, quét `{paths.bdd_proposals_dir}/` (mặc định `{spec_source}/feedback/bdd-proposals/`) tìm `{UC-ID}-*.md`. Với mỗi proposal:
|
|
409
|
+
> - `Status: accepted` (PO/Dev đã duyệt) → chèn scenario vào `.feature` của UC (giữ `@trace`), rồi **lưu trữ**: chuyển file sang `{paths.bdd_proposals_dir}/archived/` + đặt `Status: incorporated`, và **commit + push** spec repo để gỡ khỏi feedback chung.
|
|
410
|
+
> - `Status: proposed`/`rejected` (hoặc thiếu `Status`) → **bỏ qua**, để nguyên cho PO/Dev xử lý (KHÔNG tự đoán, KHÔNG tự đưa vào).
|
|
411
|
+
> Bỏ qua sạch nếu folder rỗng.
|
|
412
|
+
|
|
413
|
+
---
|
|
414
|
+
|
|
415
|
+
## Sub-Agent Mode — dùng state từ payload *(nếu `_agent_mode`)*
|
|
416
|
+
|
|
417
|
+
*Chỉ khi Gate Step 0 phát hiện `_agent_mode: true` (đang chạy như sub-agent do orchestration spawn).* Orchestrator (session chính) đã chạy các Guard + chọn platform + nạp design-spec **một lần**; sub-agent KHÔNG lặp lại:
|
|
418
|
+
- `active_platform` = `payload.active_platform` → **bỏ qua** Platform Selection / Service Detection.
|
|
419
|
+
- `design_coverage` = `payload.design_coverage` → **bỏ qua** "Design Spec — Gate & Load"; nếu rỗng thì chỉ phủ Wireframe PRD.
|
|
420
|
+
- **Bỏ qua** Guard "PRD đã duyệt" + Guard Design-Spec bên dưới (orchestrator đã kiểm).
|
|
421
|
+
- Đi thẳng tới UC Decomposition + Generate cho `payload.uc_id`, dùng `design_coverage` để phủ Screen States + AC-UI.
|
|
422
|
+
|
|
423
|
+
---
|
|
424
|
+
|
|
425
|
+
## Guard — PRD đã duyệt chưa
|
|
426
|
+
|
|
427
|
+
Đọc `| **Status** |` từ bảng Metadata của PRD nguồn:
|
|
428
|
+
- `Status: approved` → tiếp tục bình thường.
|
|
429
|
+
- `Status: draft` (hoặc khác `approved`) → **CHECKPOINT cảnh báo mềm** (không chặn cứng — cho phép prototype):
|
|
430
|
+
```
|
|
431
|
+
⚠️ PRD đang ở Status: {status} (chưa duyệt). BDD sinh từ PRD chưa chốt có thể phải làm lại.
|
|
432
|
+
Khuyến nghị: PO review xong đặt `| **Status** | approved |` rồi mới sinh BDD.
|
|
433
|
+
Vẫn sinh BDD bây giờ? (Y/N)
|
|
434
|
+
```
|
|
435
|
+
Chỉ tiếp tục khi người dùng chọn Y.
|
|
436
|
+
|
|
437
|
+
---
|
|
438
|
+
|
|
439
|
+
## Phát hiện Repo Mode
|
|
440
|
+
|
|
441
|
+
Sau khi nạp context, xác định chế độ hoạt động:
|
|
442
|
+
|
|
443
|
+
- **Spec repo mode**: `project-context.yaml` KHÔNG có section `services` HOẶC `setup.mode: spec`
|
|
444
|
+
- **Umbrella mode**: `project-context.yaml` CÓ section `services` VÀ `setup.mode: umbrella`
|
|
445
|
+
|
|
446
|
+
→ Spec repo mode → tới **Platform Selection** bên dưới (bỏ qua Service Detection)
|
|
447
|
+
→ Umbrella mode → tới **Service Detection** bên dưới (bỏ qua Platform Selection)
|
|
448
|
+
|
|
449
|
+
---
|
|
450
|
+
|
|
451
|
+
## Platform Selection (chỉ Spec Repo Mode)
|
|
452
|
+
|
|
453
|
+
*Bỏ qua section này nếu đang chạy umbrella mode.*
|
|
454
|
+
|
|
455
|
+
Hỏi người dùng chọn platform target:
|
|
456
|
+
|
|
457
|
+
```
|
|
458
|
+
BDD này dành cho platform nào?
|
|
459
|
+
1. web — FE/Web (React, Next.js, Angular, Vue, Nuxt)
|
|
460
|
+
2. app — Mobile (Flutter, React Native, iOS, Android)
|
|
461
|
+
3. system — System/BE BDD (tổng hợp từ web + app BDD có sẵn)
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
Chờ người dùng chọn. Set `active_platform` = giá trị đã chọn.
|
|
465
|
+
|
|
466
|
+
**Output path (spec repo mode):**
|
|
467
|
+
`{paths.specs_dir}/{domain}/{prd-slug}/bdd/{active_platform}/{TICKET-ID}-UC{N}-{slug}.feature`
|
|
468
|
+
|
|
469
|
+
**Từ vựng theo platform:**
|
|
470
|
+
|
|
471
|
+
| Platform | "user action" | "type/input" | "observe" | "navigate" |
|
|
472
|
+
|---|---|---|---|---|
|
|
473
|
+
| web | "clicks" | "types into" / "enters" | "sees" / "the page shows" | "navigates to" / "goes to" |
|
|
474
|
+
| app | "taps" | "enters" / "inputs" | "sees" / "the screen shows" | "navigates to" / "opens" |
|
|
475
|
+
| system | N/A — dùng business event | — | "the system returns" / "receives response" | — |
|
|
476
|
+
|
|
477
|
+
---
|
|
478
|
+
|
|
479
|
+
## System BDD Synthesis (active_platform = system)
|
|
480
|
+
|
|
481
|
+
*Chỉ áp dụng khi platform = system. Bỏ qua với web và app.*
|
|
482
|
+
|
|
483
|
+
### Step S0 — Brownfield Check
|
|
484
|
+
|
|
485
|
+
Kiểm tra bảng Metadata của PRD nguồn tìm `| **API Source** | existing |`.
|
|
486
|
+
|
|
487
|
+
**Nếu `API Source: existing`:**
|
|
488
|
+
- API contract đã được PO ghi trong phần "Existing API Contract" của PRD.
|
|
489
|
+
- **Skip Steps S1–S3** — không cần scan FE/App BDD, không cần conflict resolution.
|
|
490
|
+
- Dùng bảng "Existing API Contract" trong PRD làm contract input cho Step S4.
|
|
491
|
+
- Set `# @trace.api_source: existing` trong header của file system BDD được gen.
|
|
492
|
+
|
|
493
|
+
**Nếu `API Source` không có hoặc không phải `existing`:**
|
|
494
|
+
- Tiếp tục Steps S1–S3 (normal synthesis flow).
|
|
495
|
+
|
|
496
|
+
---
|
|
497
|
+
|
|
498
|
+
### Step S1 — Scan các BDD FE/App có sẵn
|
|
499
|
+
|
|
500
|
+
Tìm các BDD có sẵn cho TICKET-ID này:
|
|
501
|
+
- Web BDD: `{paths.specs_dir}/{domain}/{prd-slug}/bdd/web/{TICKET-ID}-*.feature`
|
|
502
|
+
- App BDD: `{paths.specs_dir}/{domain}/{prd-slug}/bdd/app/{TICKET-ID}-*.feature`
|
|
503
|
+
|
|
504
|
+
Phân loại feature:
|
|
505
|
+
|
|
506
|
+
| Điều kiện | Mode |
|
|
507
|
+
|---|---|
|
|
508
|
+
| Tìm thấy cả web + app BDD | **Multi-platform** — tổng hợp từ cả hai |
|
|
509
|
+
| Chỉ tìm thấy web BDD | **Web-only** — tổng hợp từ web |
|
|
510
|
+
| Chỉ tìm thấy app BDD | **App-only** — tổng hợp từ app |
|
|
511
|
+
| Không tìm thấy FE/App BDD | **Backend-only** — gen trực tiếp từ PRD |
|
|
512
|
+
|
|
513
|
+
---
|
|
514
|
+
|
|
515
|
+
### Step S2 — Trích contract kỳ vọng theo từng platform
|
|
516
|
+
|
|
517
|
+
Với mỗi file BDD tìm thấy, trích:
|
|
518
|
+
- **Triggers**: hành động người dùng nào gọi backend? (map sang event "request" logic)
|
|
519
|
+
- **Expected response data**: mỗi mệnh đề `Then` cần field/shape gì từ hệ thống?
|
|
520
|
+
- **Error signals**: backend phải báo hiệu các trạng thái lỗi nào?
|
|
521
|
+
- **Business rules**: mỗi platform giả định hệ thống thực thi các invariant nào?
|
|
522
|
+
|
|
523
|
+
---
|
|
524
|
+
|
|
525
|
+
### Step S3 — Cross-Platform Conflict Check (chỉ multi-platform mode)
|
|
526
|
+
|
|
527
|
+
*Bỏ qua nếu web-only, app-only, hoặc backend-only.*
|
|
528
|
+
|
|
529
|
+
So sánh các contract đã trích giữa các platform. Gắn cờ conflict nếu bất kỳ cái nào khác nhau:
|
|
530
|
+
|
|
531
|
+
| Loại conflict | Ví dụ |
|
|
532
|
+
|---|---|
|
|
533
|
+
| **Response shape mismatch** | Web mong `{ token, redirect_url }`, App mong `{ token, user_profile }` |
|
|
534
|
+
| **Error semantics mismatch** | Web mong HTTP 423 cho lock, App mong custom error code `ACC_LOCKED` |
|
|
535
|
+
| **Business rule contradiction** | Web BDD nói "lock sau 5 lần", App BDD nói "lock sau 3 lần" |
|
|
536
|
+
| **Data field conflict** | Web mong `expires_in: seconds`, App mong `expires_at: ISO timestamp` |
|
|
537
|
+
|
|
538
|
+
**Nếu phát hiện conflict → CHECKPOINT (bắt buộc, không bỏ qua được):**
|
|
539
|
+
|
|
540
|
+
```
|
|
541
|
+
⚠️ CROSS-PLATFORM CONTRACT CONFLICT
|
|
542
|
+
──────────────────────────────────────────────────────────────────
|
|
543
|
+
Feature : {TICKET-ID} — {UC name}
|
|
544
|
+
|
|
545
|
+
Conflict 1: Response shape mismatch
|
|
546
|
+
Web BDD (Then): user sees dashboard → implies { token, redirect_url }
|
|
547
|
+
App BDD (Then): app navigates to HomeScreen → implies { token, user_profile }
|
|
548
|
+
|
|
549
|
+
Resolution options:
|
|
550
|
+
A — Union response
|
|
551
|
+
BE trả về tất cả field: { token, redirect_url, user_profile }
|
|
552
|
+
Client bỏ qua field không dùng. Đơn giản, hơi over-fetch.
|
|
553
|
+
B — Platform hint trong request
|
|
554
|
+
Client gửi X-Platform: web|app trong header, BE tuỳ biến response.
|
|
555
|
+
Response gọn hơn, nhiều BE logic hơn.
|
|
556
|
+
C — Endpoint riêng
|
|
557
|
+
POST /auth/login/web và POST /auth/login/app
|
|
558
|
+
Linh hoạt tối đa, nhiều endpoint phải bảo trì hơn.
|
|
559
|
+
D — Custom: mô tả cách của bạn
|
|
560
|
+
──────────────────────────────────────────────────────────────────
|
|
561
|
+
Chọn resolution cho mỗi conflict (A/B/C/D):
|
|
562
|
+
```
|
|
563
|
+
|
|
564
|
+
Chờ PO giải quyết từng conflict. Ghi mỗi quyết định thành annotation `# @system.resolution:` trong file system BDD được gen.
|
|
565
|
+
|
|
566
|
+
**Nếu không có conflict → tới Step S4 trực tiếp.**
|
|
567
|
+
|
|
568
|
+
---
|
|
569
|
+
|
|
570
|
+
### Step S4 — Sinh các scenario System BDD
|
|
571
|
+
|
|
572
|
+
Sinh scenario dựa trên mode và các conflict đã giải quyết:
|
|
573
|
+
|
|
574
|
+
- **Multi-platform**: tổng hợp từ cả contract web + app, áp dụng các resolution đã chọn
|
|
575
|
+
- **Web-only / App-only**: suy ra từ contract của một platform
|
|
576
|
+
- **Backend-only**: suy ra trực tiếp từ AC/BR của PRD dùng ngôn ngữ business event (không phải HTTP)
|
|
577
|
+
|
|
578
|
+
Từ vựng step của System BDD (luôn dùng — bất kể từ vựng FE/App):
|
|
579
|
+
- Triggers: "the system receives {event}" / "a {actor} submits {action}"
|
|
580
|
+
- Assertions: "the system returns {data}" / "the system signals {error}" / "the system stores {state}"
|
|
581
|
+
- KHÔNG dùng từ UI (click, tap, see, navigate) trong system BDD
|
|
582
|
+
|
|
583
|
+
**Nếu multi-platform với resolution A (union):**
|
|
584
|
+
- System BDD thể hiện contract response đầy đủ: tất cả field từ mọi platform
|
|
585
|
+
- Thêm comment: `# @system.resolution: union — clients receive all fields`
|
|
586
|
+
|
|
587
|
+
**Nếu resolution B (platform hint):**
|
|
588
|
+
- Viết `Scenario Outline` riêng dùng Examples table cho biến thể response `web` vs `app`
|
|
589
|
+
- Thêm comment: `# @system.resolution: platform-hint — X-Platform header determines response shape`
|
|
590
|
+
|
|
591
|
+
**Nếu resolution C (endpoint riêng):**
|
|
592
|
+
- Viết Scenario riêng cho mỗi endpoint
|
|
593
|
+
- Ghi rõ việc tách endpoint trong phần SCOPE
|
|
594
|
+
|
|
595
|
+
---
|
|
596
|
+
|
|
597
|
+
## Service Detection (chỉ Umbrella Mode)
|
|
598
|
+
|
|
599
|
+
*Bỏ qua section này nếu đang chạy spec repo mode.*
|
|
600
|
+
|
|
601
|
+
Routing service là **domain-keyed** và **context-loader (Bước 1.5) đã phân giải sẵn** từ `@trace.domain`/Domain của PRD — KHÔNG re-resolve ở đây, chỉ dùng lại các biến đã set:
|
|
602
|
+
- `active_service` = `services.{domain}.path` (path submodule, vd `user-service/`) — hoặc `"unresolved"` nếu domain không khớp entry nào, hoặc bỏ trống ở single-service.
|
|
603
|
+
- `active_module` = module của service (`services.{domain}.module`, đã override `tech_stack.module` ở Bước 1.5) — dùng cho từ vựng bên dưới.
|
|
604
|
+
|
|
605
|
+
Chỉ cần kiểm tra trạng thái đã phân giải:
|
|
606
|
+
|
|
607
|
+
| Trạng thái (từ context-loader) | Hành động |
|
|
608
|
+
|---|---|
|
|
609
|
+
| `active_service` đã phân giải thành path service | Tiếp tục với `active_module` đã set. |
|
|
610
|
+
| `active_service = "unresolved"` (có section `services` nhưng domain PRD không khớp entry nào) | **DỪNG**, báo: "Domain `{domain}` của PRD không khớp service nào trong `services:` của project-context.yaml — bổ sung mapping rồi chạy lại." (Không đoán/hỏi tay — domain là khoá định danh, lệch là lỗi cấu hình cần sửa ở SoT.) |
|
|
611
|
+
| Single-service (không có section `services`) | `active_module = tech_stack.module` (đã set ở Bước 6.5). Tiếp tục. |
|
|
612
|
+
|
|
613
|
+
**Output path (umbrella mode):** `{paths.specs_dir}/{domain}/{prd-slug}/bdd/{TICKET-ID}-UC{N}-{slug}.feature`
|
|
614
|
+
|
|
615
|
+
*(Không thêm subfolder theo service: feature-package đã domain-scoped sẵn ở `{domain}/`, mà service route 1-1 theo domain — nên thêm subfolder service sẽ chỉ lặp lại domain. `active_service` chỉ dùng cho `service_root`/từ vựng, KHÔNG vào path spec.)*
|
|
616
|
+
|
|
617
|
+
**Từ vựng theo platform** — điều chỉnh cách viết step BDD theo `active_module`:
|
|
618
|
+
|
|
619
|
+
| Platform type | Modules | "click" | "type" | "see" | "navigate" |
|
|
620
|
+
|---|---|---|---|---|---|
|
|
621
|
+
| Web | react, nextjs, vue, nuxt, angular | "clicks" | "types into" / "enters" | "sees" / "the page shows" | "navigates to" / "goes to" |
|
|
622
|
+
| Mobile | flutter, react-native, ios-swiftui, android-compose | "taps" | "enters" / "inputs" | "sees" / "the screen shows" | "navigates to" / "opens" |
|
|
623
|
+
| Backend / API | java-spring, golang, dotnet, php-laravel | *(không có UI step — dùng)* "submits a request" / "calls the API" | — | "receives response" / "the system returns" | — |
|
|
624
|
+
|
|
625
|
+
Áp dụng từ vựng này âm thầm khi viết step Gherkin. KHÔNG trộn từ web và mobile trong cùng một file feature.
|
|
626
|
+
|
|
627
|
+
---
|
|
628
|
+
|
|
629
|
+
## Design Spec — Gate & Load (chỉ FE/App)
|
|
630
|
+
|
|
631
|
+
*Chỉ chạy khi target platform là FE/App — spec mode: `active_platform ∈ {web, app, app-ios, app-android}`; umbrella mode: `active_module` là module FE/App (react/nextjs/vue/nuxt/angular/flutter/react-native/ios-swiftui/android-compose). Bỏ qua HOÀN TOÀN với `system` và backend/brownfield.*
|
|
632
|
+
|
|
633
|
+
**1. Định vị design-spec của platform:**
|
|
634
|
+
`{paths.specs_dir}/{domain}/{prd-slug}/design-spec/{TICKET-ID}-design-spec-{active_platform}-{slug}.md`
|
|
635
|
+
- `app-ios`/`app-android` không có bản riêng → fallback bản `-app-`.
|
|
636
|
+
|
|
637
|
+
**2. Guard — sign-off & độ tươi (cảnh báo MỀM, đồng bộ Guard PRD — không chặn cứng):**
|
|
638
|
+
Đọc `| **Status** |` và `| **Built from PRD** |` từ Metadata design-spec.
|
|
639
|
+
- Không tìm thấy file, HOẶC `Status ≠ approved`, HOẶC design-spec còn màn ❌ Missing, HOẶC `Built from PRD` ≠ `| **Version** |` của PRD hiện tại (design-spec **lỗi thời** so với PRD) → CHECKPOINT:
|
|
640
|
+
```
|
|
641
|
+
⚠️ Design Spec cho {active_platform} chưa sẵn sàng (Status: {status} / không có / còn màn thiếu Figma / lỗi thời: dựng từ PRD v{old}, PRD giờ v{new}).
|
|
642
|
+
BDD FE/App nên sinh từ design-spec đã approved & cập nhật để phủ đúng Screen States + AC-UI.
|
|
643
|
+
Khuyến nghị: hoàn tất / cập nhật design-spec (chạy lại /generate-design-spec nếu PRD đã đổi) rồi mới sinh BDD.
|
|
644
|
+
Vẫn sinh BDD bây giờ? (Y/N)
|
|
645
|
+
```
|
|
646
|
+
Chỉ tiếp khi chọn Y. Nếu Y mà KHÔNG có design-spec → bỏ qua bước 3 (chỉ phủ Wireframe PRD §4b).
|
|
647
|
+
- `Status: approved` VÀ `Built from PRD` khớp PRD hiện tại → nạp design-spec, sang bước 2.5.
|
|
648
|
+
|
|
649
|
+
**2.5. Sanity-scan nội dung design-spec** (lớp soi độc lập — D1; soi nhanh ngay tại chỗ đã mở file, trước khi dùng):
|
|
650
|
+
Quét tìm cờ đỏ; nếu có → **cảnh báo mềm** (liệt kê + hỏi "Vẫn dùng design-spec này? (Y/N)"):
|
|
651
|
+
- Màn nào thiếu state `loading`/`error`/`empty`.
|
|
652
|
+
- AC-UI nào mơ hồ, không testable ("looks good" / "đẹp" / không pass-fail rõ).
|
|
653
|
+
- Component còn `[NEW]` / `[TODO]` (chưa chốt với designer).
|
|
654
|
+
- Còn `❌ Missing` frame (lẽ ra Status đã `draft` — approved mà vẫn Missing là bất thường).
|
|
655
|
+
Bắt lỗi design-spec **ngay trước khi nó lan xuống BDD**. Chọn N → quay lại hoàn thiện design-spec; chọn Y → sang bước 3.
|
|
656
|
+
|
|
657
|
+
**3. Trích coverage từ design-spec** (lưu thành `design_coverage`, dùng ở UC Decomposition + Coverage Matrix):
|
|
658
|
+
- **Screen States** ≠ `default` cho mỗi màn: `loading`, `error`, `empty`, `success` (cái nào có).
|
|
659
|
+
- **AC-UI behavioral**: giữ AC-UI mà cột `Verified by` là **PO/QA** và mô tả outcome quan sát được (lỗi + đường khôi phục, empty state + CTA, gesture điều hướng, có loading state). **LOẠI AC-UI visual thuần** (khớp Figma trong dung sai, tương phản WCAG, màu/pixel/animation — thường `Verified by: Designer`): Designer/QA review riêng, KHÔNG đưa vào Gherkin (giữ R3/R5/R6).
|
|
660
|
+
- **Dedup**: nếu một Screen State / AC-UI đã trùng một AC nghiệp vụ của PRD → không tạo SC mới, chỉ ghi nhận đã phủ.
|
|
661
|
+
|
|
662
|
+
---
|
|
663
|
+
|
|
664
|
+
## Orchestration Check
|
|
665
|
+
|
|
666
|
+
*Bỏ qua section này nếu đã ở sub-agent mode (Step 0 của Gate đã kích hoạt).*
|
|
667
|
+
|
|
668
|
+
Sau khi nạp context, kiểm tra PRD target có đủ lớn để cần sub-agent không:
|
|
669
|
+
|
|
670
|
+
1. Đếm các heading `#### {TICKET-ID}-UC` trong PRD → **UC count**.
|
|
671
|
+
2. Đếm tổng số dòng trong PRD → **line count**.
|
|
672
|
+
3. Nếu **UC count > 3** HOẶC **line count > 300**:
|
|
673
|
+
- Chuyển sang orchestration mode — theo `steps/spawn-agent.md`.
|
|
674
|
+
- Session chính trở thành orchestrator: spawn 1 sub-agent cho mỗi UC.
|
|
675
|
+
- Mỗi sub-agent chạy `/generate-bdd` với payload `_agent_mode: true`.
|
|
676
|
+
- Thu thập kết quả và hiện report đã merge.
|
|
677
|
+
- **KHÔNG tiếp tục các bước bên dưới.**
|
|
678
|
+
4. Nếu UC count ≤ 3 VÀ line count ≤ 300 → tiếp tục Version Check bên dưới (single-session mode).
|
|
679
|
+
|
|
680
|
+
---
|
|
681
|
+
|
|
682
|
+
## Sub-Agent Return Format
|
|
683
|
+
|
|
684
|
+
*Section này áp dụng khi chạy như sub-agent (Gate Step 0 phát hiện `_agent_mode: true`).*
|
|
685
|
+
|
|
686
|
+
Sau khi sinh tất cả file `.feature` và `.tsv` cho UC được giao, trả về JSON kết quả có cấu trúc (theo `steps/spawn-agent.md` Step E):
|
|
687
|
+
|
|
688
|
+
```json
|
|
689
|
+
{ "uc_id": "{TICKET-ID}-UC{N}", "files_created": ["path/to/file1", "path/to/file2"], "status": "success | error", "errors": [] }
|
|
690
|
+
```
|
|
691
|
+
|
|
692
|
+
---
|
|
693
|
+
|
|
694
|
+
## Version Check
|
|
695
|
+
|
|
696
|
+
Trước khi sinh, kiểm tra các file `.feature` có sẵn cho PRD này:
|
|
697
|
+
|
|
698
|
+
1. Phân giải search path theo mode:
|
|
699
|
+
- **Spec repo mode**: `{paths.specs_dir}/{domain}/{prd-slug}/bdd/{active_platform}/{TICKET-ID}-UC*.feature`
|
|
700
|
+
- **Umbrella mode**: `{paths.specs_dir}/{domain}/{prd-slug}/bdd/{TICKET-ID}-UC*.feature`
|
|
701
|
+
2. Đọc `| **Version** |` hiện tại của PRD từ metadata (vd: `1.2`).
|
|
702
|
+
|
|
703
|
+
**Nếu không có file feature nào** → gen mới, tiếp tục bình thường. Dùng version PRD làm `@trace.prd_version`.
|
|
704
|
+
|
|
705
|
+
**Nếu tìm thấy file feature có sẵn**:
|
|
706
|
+
- Đọc `# @trace.prd_version:` từ header file feature có sẵn.
|
|
707
|
+
- So với version PRD hiện tại.
|
|
708
|
+
- Nếu **giống** → hỏi: "BDD đã sinh từ PRD v{version}. Gen lại? (Y/N)"
|
|
709
|
+
- Nếu **khác** (PRD đã cập nhật):
|
|
710
|
+
1. Đọc `# Change Log` từ PRD — trích tất cả row mới hơn `@trace.prd_version` của BDD hiện có. **Nếu `@trace.prd_version` của BDD CŨ HƠN row cũ nhất còn trong bảng** (lịch sử đã bị cắt sang `changelog/`) → không thấy đủ diff → **khuyến nghị F** (gen lại toàn bộ), đừng tin Y một phần.
|
|
711
|
+
2. Hiện CHECKPOINT:
|
|
712
|
+
```
|
|
713
|
+
⚠️ Phát hiện PRD version drift
|
|
714
|
+
BDD được sinh từ PRD v{old}
|
|
715
|
+
PRD giờ ở v{new}
|
|
716
|
+
|
|
717
|
+
Thay đổi kể từ v{old}:
|
|
718
|
+
{changelog rows}
|
|
719
|
+
|
|
720
|
+
Options:
|
|
721
|
+
Y — chỉ cập nhật các scenario bị ảnh hưởng
|
|
722
|
+
F — gen lại toàn bộ scenario
|
|
723
|
+
N — huỷ
|
|
724
|
+
```
|
|
725
|
+
3. Tiếp tục theo lựa chọn của người dùng. **Nếu changelog row không nêu rõ UC/AC/BR bị đổi (mơ hồ) → khuyến nghị F** (gen lại toàn bộ) thay vì Y, để khỏi sót scenario bị ảnh hưởng (lưới an toàn — không chắc đổi ở đâu thì quét rộng).
|
|
726
|
+
|
|
727
|
+
---
|
|
728
|
+
|
|
729
|
+
## BDD Writing Rules (R1-R10 — enforce nghiêm)
|
|
730
|
+
|
|
731
|
+
| Rule | Name | Yêu cầu |
|
|
732
|
+
|------|------|-------------|
|
|
733
|
+
| R1 | Given/When/Then Semantics | Given=state, When=action, Then=outcome. Mỗi SC cần đủ G/W/T. |
|
|
734
|
+
| R2 | One Behavior Per Scenario | 1 SC = 1 behavior. KHÔNG chain When→Then→When→Then. |
|
|
735
|
+
| R3 | Ubiquitous Language | KHÔNG dùng UI selector / tên API / tech term trong step. |
|
|
736
|
+
| R4 | Outside-in Naming | Tên SC mô tả business outcome. Không "click" / "(Case X)" / tên component. |
|
|
737
|
+
| R5 | Declarative over Imperative | Mô tả WHAT (ý định nghiệp vụ), KHÔNG phải HOW (cơ chế UI). |
|
|
738
|
+
| R6 | Observable Outcomes Only | Then khẳng định outcome quan sát được. Không phải trạng thái UI trung gian / internal state. |
|
|
739
|
+
| R7 | Key Examples / Concrete | Dùng giá trị cụ thể. Không "valid data" mơ hồ. |
|
|
740
|
+
| R8 | Independence | SC chạy độc lập. Không phụ thuộc state từ SC khác. |
|
|
741
|
+
| R9 | Test Data Completeness | Data table có đủ field để suy ra Then kỳ vọng. |
|
|
742
|
+
| R10 | Scope Boundary Explicit | Cross-UC reference dùng cách diễn đạt navigation + comment Note. |
|
|
743
|
+
|
|
744
|
+
## Project Compliance (fail review nếu thiếu — C.1-C.5)
|
|
745
|
+
|
|
746
|
+
| Check | Rule |
|
|
747
|
+
|-------|------|
|
|
748
|
+
| C.1 Wireframe Coverage | Mỗi component/action trong Wireframe (PRD §4b) có ≥1 SC. **FE/App: mỗi Screen State (≠default) và mỗi AC-UI behavioral của design-spec (`design_coverage`) cũng phải có ≥1 SC** — dedup với AC nghiệp vụ PRD; bỏ AC-UI visual thuần. |
|
|
749
|
+
| C.2 PRD Traceability | Mỗi AC và mỗi BR (gồm từng bullet logic) map tới ≥1 SC. |
|
|
750
|
+
| C.3 Business Dictionary | Dùng đúng canonical term từ business-dictionary.md. |
|
|
751
|
+
| C.4 Banned Terms | 0 banned term trong file — grep trước khi gen. |
|
|
752
|
+
| C.5 NHÓM Grouping | Feature ≥3 SC → PHẢI có NHÓM grouping theo business theme. |
|
|
753
|
+
|
|
754
|
+
---
|
|
755
|
+
|
|
756
|
+
## NHÓM Grouping Convention (C.5 — bắt buộc cho ≥3 scenario)
|
|
757
|
+
|
|
758
|
+
Gom theo business theme, KHÔNG theo happy/negative/edge.
|
|
759
|
+
|
|
760
|
+
Format header (thụt 2 space, cùng cấp với Background):
|
|
761
|
+
```
|
|
762
|
+
# ==========================================================
|
|
763
|
+
# NHÓM N: <Business theme> (<BR refs nếu áp dụng>)
|
|
764
|
+
# ==========================================================
|
|
765
|
+
```
|
|
766
|
+
|
|
767
|
+
Rules:
|
|
768
|
+
- Đánh số tuần tự NHÓM 1 → N. SC ID tuần tự xuyên suốt lifecycle (không reset theo từng NHÓM).
|
|
769
|
+
- Mỗi NHÓM có thể chứa @happy + @edge + @negative cùng theme.
|
|
770
|
+
- SC trong NHÓM không cần theo thứ tự ID (NHÓM 2 có thể chứa SC4, SC8, SC11 nếu cùng theme).
|
|
771
|
+
|
|
772
|
+
Pattern gợi ý (điều chỉnh theo UC):
|
|
773
|
+
- `Init / Save success — valid data combinations`
|
|
774
|
+
- `Validation / Block when invalid`
|
|
775
|
+
- `Error handling — API fail / system error`
|
|
776
|
+
- `Cancel changes / Close modal without saving`
|
|
777
|
+
- `Cross-system / Downstream effects`
|
|
778
|
+
- `Idempotency & Concurrency`
|
|
779
|
+
|
|
780
|
+
---
|
|
781
|
+
|
|
782
|
+
## UC Decomposition
|
|
783
|
+
|
|
784
|
+
Với mỗi UC trong PRD, trình bày outline SC **trước khi sinh**:
|
|
785
|
+
```
|
|
786
|
+
{TICKET-ID}-UC1: {Use Case Name}
|
|
787
|
+
NHÓM 1: {Theme} (BR1, BR2)
|
|
788
|
+
SC1 [@happy]: {business outcome}
|
|
789
|
+
SC2 [@happy @alternative]: {variant outcome}
|
|
790
|
+
NHÓM 2: {Theme} (BR2, BR3)
|
|
791
|
+
SC3 [@edge]: {edge case}
|
|
792
|
+
SC4 [@negative]: {error handling}
|
|
793
|
+
ACs covered: AC1, AC2
|
|
794
|
+
BRs covered: {TICKET-ID}-UC1-BR1, BR2, BR3
|
|
795
|
+
```
|
|
796
|
+
|
|
797
|
+
*(FE/App: nếu đã nạp design-spec (xem "Design Spec — Gate & Load"), đưa Screen State ≠default (loading/error/empty) + AC-UI behavioral của `design_coverage` vào outline — dedup với AC nghiệp vụ, đừng tạo SC trùng.)*
|
|
798
|
+
|
|
799
|
+
CHECKPOINT: "Outline này đúng chưa? Bạn muốn thêm hay bớt SC nào không?" → **Chờ confirm trước khi sinh.**
|
|
800
|
+
|
|
801
|
+
---
|
|
802
|
+
|
|
803
|
+
## Generate
|
|
804
|
+
|
|
805
|
+
**Output path theo mode:**
|
|
806
|
+
- **Spec repo mode**: `{paths.specs_dir}/{domain}/{prd-slug}/bdd/{active_platform}/{TICKET-ID}-UC{N}-{slug}.feature`
|
|
807
|
+
- **Umbrella mode**: `{paths.specs_dir}/{domain}/{prd-slug}/bdd/{TICKET-ID}-UC{N}-{slug}.feature` *(service route 1-1 theo domain → không thêm subfolder service)*
|
|
808
|
+
|
|
809
|
+
Với mỗi UC, ghi vào path đã phân giải ở trên. Dùng từ vựng cho active platform (từ Platform Selection hoặc Service Detection).
|
|
810
|
+
|
|
811
|
+
```gherkin
|
|
812
|
+
# ============================================================
|
|
813
|
+
# @trace.id: {TICKET-ID}-UC{N}
|
|
814
|
+
# @trace.title: <Feature name>
|
|
815
|
+
# @trace.revision: 1 ← field tĩnh; dùng @trace.bdd_version để theo dõi version (tăng bởi /review-context --fix hoặc --resume)
|
|
816
|
+
# @trace.domain: <domain>
|
|
817
|
+
# @trace.platform: {active_platform — web | app | system | (bỏ trong umbrella mode)}
|
|
818
|
+
# @trace.service: {active_service — bỏ trong spec repo mode}
|
|
819
|
+
# @trace.module: {active_module trong umbrella mode; "unknown" trong spec repo mode}
|
|
820
|
+
# @trace.status: draft
|
|
821
|
+
# @trace.author: AI-generated
|
|
822
|
+
# @trace.created_at: {YYYY-MM-DD}
|
|
823
|
+
# @trace.prd: {TICKET-ID}
|
|
824
|
+
# @trace.prd_version: {đọc từ metadata PRD "| **Version** |"}
|
|
825
|
+
# @trace.bdd_version: {1.0 nếu gen mới; tăng 0.1 khi gen lại — vd 1.0 → 1.1}
|
|
826
|
+
# @trace.business_rules: {TICKET-ID}-UC{N}-BR1, {TICKET-ID}-UC{N}-BR2
|
|
827
|
+
# @trace.dataset: {domain}.testdata.yaml
|
|
828
|
+
# ============================================================
|
|
829
|
+
|
|
830
|
+
# === CONTEXT ===
|
|
831
|
+
# Actor: <vai trò thực hiện hành động, vd: Consumer, Staff, System>
|
|
832
|
+
# Screens: <các màn liên quan, vd: Cart → Confirm Order → Order Detail>
|
|
833
|
+
# Entities: <business entity, vd: Order, OrderItem, Consumer>
|
|
834
|
+
# Pre-state: <state dùng chung trước khi vào các scenario>
|
|
835
|
+
|
|
836
|
+
# === SCOPE ===
|
|
837
|
+
# In: <UC này phủ gì>
|
|
838
|
+
# Out: <cái gì KHÔNG thuộc UC này — link tới UC/feature khác (R10)>
|
|
839
|
+
|
|
840
|
+
# === BUSINESS DEFINITION ===
|
|
841
|
+
# Tham chiếu nhanh các term dùng trong feature này. Chi tiết SoT: business-dictionary.md
|
|
842
|
+
# <Term 1>: <định nghĩa ngắn>
|
|
843
|
+
# <Term 2>: <định nghĩa ngắn>
|
|
844
|
+
#
|
|
845
|
+
# --- Popup/Modal Lifecycle (tùy chọn — BẮT BUỘC nếu feature là popup/modal; Pre-merge yêu cầu) ---
|
|
846
|
+
# - Open trigger: <khi nào popup hiển thị, vd: click menu sidebar>
|
|
847
|
+
# - Close trigger: <khi nào popup đóng, vd: F5 / click X / ESC / navigate away>
|
|
848
|
+
# - Refresh model: <data refresh khi nào, vd: mỗi lần open (NO CACHE) / persisted / polling>
|
|
849
|
+
# - State reset: <state nào reset khi đóng/mở lại, vd: pagination, expand, dropdown selection>
|
|
850
|
+
#
|
|
851
|
+
# --- Display Logic Matrix (tùy chọn — BẮT BUỘC nếu display logic phụ thuộc ≥2 chiều; Pre-merge yêu cầu) ---
|
|
852
|
+
# Liệt kê đủ ma trận N×M case + map mỗi case → SC. Tên SC theo pattern `<cấu trúc>: <outcome>` (KHÔNG dùng "(Case X)").
|
|
853
|
+
# | # | Dim1 | Dim2 | Format hiển thị | SC |
|
|
854
|
+
# |---|------|------|------------------------|------|
|
|
855
|
+
# | 1 | 0 | 0 | `Tên hàng` | SC{} |
|
|
856
|
+
# | 2 | 0 | 1 | `Tên hàng (đơn vị)` | SC{} |
|
|
857
|
+
# | ... | ... | ... | ... | ... |
|
|
858
|
+
|
|
859
|
+
Feature: <Feature name>
|
|
860
|
+
As a <role>
|
|
861
|
+
I want to <action>
|
|
862
|
+
So that <business value>
|
|
863
|
+
|
|
864
|
+
Background:
|
|
865
|
+
Given <precondition dùng chung — dùng alias từ dataset, không phải ID kỹ thuật>
|
|
866
|
+
|
|
867
|
+
# ==========================================================
|
|
868
|
+
# NHÓM 1: <Business theme> (<BR refs>)
|
|
869
|
+
# ==========================================================
|
|
870
|
+
|
|
871
|
+
# Side-effects: <liệt kê ngắn các Then side-effect cần verify>
|
|
872
|
+
# @trace.scenario: {TICKET-ID}-UC{N}-SC1
|
|
873
|
+
# @trace.sc_version: 1.0
|
|
874
|
+
# @trace.business_rules: {TICKET-ID}-UC{N}-BR1
|
|
875
|
+
@happy
|
|
876
|
+
Scenario: <mô tả business outcome — dùng động từ chính xác: create/receive/assign/block>
|
|
877
|
+
Given <input state — alias từ dataset>
|
|
878
|
+
When <single action>
|
|
879
|
+
Then <main observable outcome>
|
|
880
|
+
And <side-effect 1 khai báo trong header>
|
|
881
|
+
|
|
882
|
+
# Side-effects: <...>
|
|
883
|
+
# @trace.scenario: {TICKET-ID}-UC{N}-SC2
|
|
884
|
+
# @trace.sc_version: 1.0
|
|
885
|
+
# @trace.business_rules: {TICKET-ID}-UC{N}-BR1
|
|
886
|
+
@happy @alternative
|
|
887
|
+
Scenario: <cùng theme NHÓM 1 nhưng path khác — vd: giá trị enum khác>
|
|
888
|
+
Given <state>
|
|
889
|
+
When <action>
|
|
890
|
+
Then <outcome>
|
|
891
|
+
|
|
892
|
+
# ==========================================================
|
|
893
|
+
# NHÓM 2: <Business theme 2> (<BR refs>)
|
|
894
|
+
# ==========================================================
|
|
895
|
+
|
|
896
|
+
# Side-effects: <...>
|
|
897
|
+
# @trace.scenario: {TICKET-ID}-UC{N}-SC3
|
|
898
|
+
# @trace.sc_version: 1.0
|
|
899
|
+
# @trace.business_rules: {TICKET-ID}-UC{N}-BR2
|
|
900
|
+
@edge
|
|
901
|
+
Scenario: <scenario boundary / error>
|
|
902
|
+
Given <state>
|
|
903
|
+
When <action>
|
|
904
|
+
Then <expected error handling>
|
|
905
|
+
|
|
906
|
+
# === PRD COVERAGE (C.1 + C.2) ===
|
|
907
|
+
# AC mapping:
|
|
908
|
+
# AC1 (...) → SC1, SC2
|
|
909
|
+
# AC2 (...) → SC3
|
|
910
|
+
# BR mapping (mỗi bullet PHẢI có ≥1 SC — C.2):
|
|
911
|
+
# {TICKET-ID}-UC{N}-BR1 (...) → SC1, SC2
|
|
912
|
+
# {TICKET-ID}-UC{N}-BR2 (...) → SC3
|
|
913
|
+
# Wireframe mapping (mỗi component/action ≥1 SC — C.1):
|
|
914
|
+
# Screen "<screen name>":
|
|
915
|
+
# [x] <action 1> → SC1
|
|
916
|
+
# [x] <action 2> → SC2
|
|
917
|
+
# [ ] <action 3> → MISSING ← BLOCK MERGE
|
|
918
|
+
# Design Spec coverage (chỉ FE/App — C.1 mở rộng; bỏ khối này nếu không nạp design-spec):
|
|
919
|
+
# Screen "<screen>": loading → SC?, error → SC?, empty → SC?
|
|
920
|
+
# AC-UI behavioral: AC-UI3 (lỗi+khôi phục) → SC?, AC-UI4 (empty CTA) → SC?
|
|
921
|
+
# (bỏ AC-UI visual thuần: AC-UI1 khớp Figma, AC-UI5 WCAG — Designer/QA review riêng)
|
|
922
|
+
|
|
923
|
+
# === PRE-MERGE CHECKLIST ===
|
|
924
|
+
# - [ ] Mỗi SC có Side-effects + @trace.scenario + @trace.sc_version + @trace.business_rules
|
|
925
|
+
# - [ ] Coverage Matrix: 0 dòng MISSING (C.1)
|
|
926
|
+
# - [ ] FE/App: mỗi Screen State (≠default) + AC-UI behavioral của design-spec có ≥1 SC (C.1 mở rộng)
|
|
927
|
+
# - [ ] Mỗi AC/BR map tới ≥1 SC (C.2)
|
|
928
|
+
# - [ ] 0 banned term (C.4) — grep file trước khi merge
|
|
929
|
+
# - [ ] Feature ≥3 SC có NHÓM grouping theo business theme (C.5)
|
|
930
|
+
# - [ ] Nếu popup/modal: khai báo Popup/Modal Lifecycle trong BUSINESS DEFINITION
|
|
931
|
+
# - [ ] Nếu display logic ≥2 chiều: Display Logic Matrix trong BUSINESS DEFINITION
|
|
932
|
+
|
|
933
|
+
```
|
|
934
|
+
|
|
935
|
+
*(Template `.feature` là **single-source** ở `templates/feature.template` — sửa file đó để đổi cấu trúc mọi `.feature` sinh ra. Coverage Matrix + Pre-merge Checklist nằm ở **cuối** template, thêm vào cuối mỗi file.)*
|
|
936
|
+
|
|
937
|
+
---
|
|
938
|
+
|
|
939
|
+
## Write Trace State
|
|
940
|
+
|
|
941
|
+
Sau khi sinh tất cả file `.feature`, tạo hoặc cập nhật **sổ trace theo platform** `{paths.trace_dir}/{domain}/{prd-slug}/{UC-ID}-{active_platform}.tsv` cho mỗi UC — một sổ riêng cho `system` / `web` / `app`. Vì `sc_id` = `{UC-ID}-SC{N}` chỉ độc nhất trong (UC × platform) (mỗi platform tự đánh số SC từ 1), **mỗi platform một file** để scenario platform này không đè/xoá platform khác. Lệnh luôn biết `active_platform` (từ Platform Selection / Service Detection) nên chỉ ghi đúng sổ của platform đang gen.
|
|
942
|
+
|
|
943
|
+
> **Umbrella + `spec_source`:** cả file `.feature` **và** trace `.tsv` đều ghi vào **spec repo** (`{spec_source}/specs/{domain}/{prd-slug}/bdd/…` và `{spec_source}/.trace/{domain}/{prd-slug}/…`, do context-loader phân giải) — một thao tác ghi **single-repo**, commit/push vào spec submodule. (Trace được gộp trong spec repo để PM quản lý mọi status ở một chỗ; các lệnh phía code cập nhật liên-repo sau.)
|
|
944
|
+
|
|
945
|
+
**Cột TSV (tab-separated, một header row + một data row cho mỗi scenario):**
|
|
946
|
+
```
|
|
947
|
+
sc_id\tsc_title\tspec_ver\tgen_ver\timplemented_by\ttest_count\ttest_classes\tdev_selftest\tdev_selftest_at\tqc_status\tqc_run_at\tqc_owner\tqc_blocked_by\tprd_version\tbdd_version\ttech_doc_revision\tfe_tech_doc_revision\tprd_status\tuc_status\tfe_phase\tstatus\tlast_updated
|
|
948
|
+
```
|
|
949
|
+
|
|
950
|
+
**Rules:**
|
|
951
|
+
- Nếu file chưa tồn tại → tạo với header row + tất cả scenario row.
|
|
952
|
+
- Nếu file tồn tại (gen lại) → với mỗi SC trong `.feature` mới:
|
|
953
|
+
- SC đã có trong `.tsv` VÀ `spec_ver` không đổi → chỉ cập nhật: `sc_title`, `prd_version`, `bdd_version`, `prd_status`, `uc_status`, `last_updated`. Giữ nguyên các cột khác.
|
|
954
|
+
- SC đã có trong `.tsv` VÀ `spec_ver` đổi (scenario bị sửa) → cập nhật: `sc_title`, `spec_ver`, `prd_version`, `bdd_version`, `prd_status`, `uc_status`, `last_updated` VÀ set `status = DRIFT` ngay (để TSV phản ánh drift mà không cần đợi `/validate-traces`). Giữ nguyên `gen_ver`, `implemented_by`, `test_count`, `test_classes`, `tech_doc_revision`, `fe_tech_doc_revision`.
|
|
955
|
+
- SC mới (thêm trong lần gen lại này) → append row mới với `gen_ver`, `implemented_by`, `test_count`, `test_classes`, `dev_selftest`, `dev_selftest_at`, `qc_status`, `qc_run_at`, `qc_owner`, `qc_blocked_by`, `tech_doc_revision`, `fe_tech_doc_revision` đều set `—`.
|
|
956
|
+
- SC không còn trong `.feature` (bị xoá) → xoá row của nó. *(An toàn: sổ này chỉ chứa scenario của `{active_platform}`, so với `.feature` của chính platform đó — không bao giờ đụng scenario platform khác.)*
|
|
957
|
+
|
|
958
|
+
**Giá trị ghi cho mỗi scenario:**
|
|
959
|
+
|
|
960
|
+
| Cột | Giá trị |
|
|
961
|
+
|--------|-------|
|
|
962
|
+
| `sc_id` | `{UC-ID}-SC{N}` |
|
|
963
|
+
| `sc_title` | text title của scenario |
|
|
964
|
+
| `spec_ver` | `@trace.sc_version` của scenario này |
|
|
965
|
+
| `gen_ver` | `—` (chưa gen) |
|
|
966
|
+
| `implemented_by` | `—` |
|
|
967
|
+
| `test_count` | `—` |
|
|
968
|
+
| `test_classes` | `—` |
|
|
969
|
+
| `dev_selftest` | `—` (chưa chạy test) |
|
|
970
|
+
| `dev_selftest_at` | `—` |
|
|
971
|
+
| `qc_status` | `—` (kết quả QC automation chính thức — set bởi `/qc-run-test`) |
|
|
972
|
+
| `qc_run_at` | `—` |
|
|
973
|
+
| `qc_owner` | `—` (SC chưa pass đang chờ ai: `dev` / `po` — set bởi `/qc-run-test` + `/report-bug`) |
|
|
974
|
+
| `qc_blocked_by` | `—` (`BUG-{id}` / `GAP-{id}` liên kết — set bởi `/qc-run-test` + `/report-bug`) |
|
|
975
|
+
| `prd_version` | `@trace.prd_version` từ header `.feature` |
|
|
976
|
+
| `bdd_version` | `@trace.bdd_version` từ header `.feature` |
|
|
977
|
+
| `tech_doc_revision` | `—` (revision tech-doc gộp `{TICKET-ID}-tech-design.md` — set bởi `/generate-code` + `/review-tech-docs`) |
|
|
978
|
+
| `fe_tech_doc_revision` | `—` (revision cùng tech-doc gộp, ghi khi FE `--phase=integration` wire theo §4.5.4 — set bởi `/generate-code`) |
|
|
979
|
+
| `prd_status` | đọc `\| **Status** \|` từ metadata PRD |
|
|
980
|
+
| `uc_status` | `draft` cho UC mới; giữ giá trị hiện có khi gen lại |
|
|
981
|
+
| `fe_phase` | `—` (set bởi `/generate-code --phase` khi FE implement) |
|
|
982
|
+
| `status` | `UNTRACKED` |
|
|
983
|
+
| `last_updated` | hôm nay `YYYY-MM-DD` |
|
|
984
|
+
|
|
985
|
+
## Refresh Panel Mirror
|
|
986
|
+
# Làm mới panel mirror của Living Docs *(local, chế độ umbrella)*
|
|
987
|
+
|
|
988
|
+
*Bỏ qua hoàn toàn ở chế độ single-service (không có `services` và không có `setup.spec_source`) — ở đó
|
|
989
|
+
`.trace/` của chính repo CHÍNH LÀ vị trí panel, nên không có gì để mirror.*
|
|
990
|
+
|
|
991
|
+
Sau khi cập nhật TSV authoritative tại `{paths.trace_dir}`:
|
|
992
|
+
|
|
993
|
+
**Khi `setup.spec_source` được đặt (trace gộp — trường hợp phổ biến):**
|
|
994
|
+
`{paths.trace_dir}` phân giải về `{spec_source}/.trace` — vị trí authoritative duy nhất.
|
|
995
|
+
Lệnh này chạy từ `service_root`, nên thao tác ghi là **liên-repo vào spec submodule**;
|
|
996
|
+
commit/push spec submodule cho lần cập nhật trace (giống như `feedback/`).
|
|
997
|
+
1. Phân giải `panel_mirror = ./.trace` tại **gốc workspace hiện tại**.
|
|
998
|
+
2. Nếu `panel_mirror` phân giải ra path khác với `{paths.trace_dir}`, copy mỗi
|
|
999
|
+
`{UC-ID}-{platform}.tsv` vừa cập nhật → `{panel_mirror}/{UC-ID}-{platform}.tsv` (tạo thư mục; ghi đè).
|
|
1000
|
+
Không namespace theo service — chỉ có một bộ trace; service sở hữu được mang trong
|
|
1001
|
+
`@trace.service` của từng row.
|
|
1002
|
+
|
|
1003
|
+
**Legacy (không có `spec_source` — trace theo service):**
|
|
1004
|
+
Copy mỗi `{UC-ID}-{platform}.tsv` vừa cập nhật → `{panel_mirror}/{service-name}/{UC-ID}-{platform}.tsv`
|
|
1005
|
+
(namespace theo `active_service`).
|
|
1006
|
+
|
|
1007
|
+
Cách này giữ panel Living Docs của workspace đang mở luôn mới **giữa các lần sync** — nó chỉ là
|
|
1008
|
+
một **mirror tiện lợi cục bộ**. File `trace-report.json` đã merge (canonical, trong
|
|
1009
|
+
`{spec_source}/.living-docs/`) được build lại bởi `/sync` hoặc `/validate-traces`. Với các lệnh
|
|
1010
|
+
được orchestrate, làm việc này một lần trong orchestrator sau khi tất cả sub-agent trả về — không phải
|
|
1011
|
+
bên trong từng sub-agent.
|
|
1012
|
+
|
|
1013
|
+
|
|
1014
|
+
## Output
|
|
1015
|
+
|
|
1016
|
+
# Report Footer — Định dạng output chuẩn cho mọi lệnh
|
|
1017
|
+
|
|
1018
|
+
Mọi report của lệnh phải kết thúc bằng section footer chuẩn này.
|
|
1019
|
+
|
|
1020
|
+
## Status Badge
|
|
1021
|
+
|
|
1022
|
+
Chọn một theo kết quả:
|
|
1023
|
+
- `✅ Complete` — mọi bước thành công, không có vấn đề
|
|
1024
|
+
- `❌ Failed` — lệnh không hoàn thành được do lỗi chặn
|
|
1025
|
+
- `⚠️ Warnings` — hoàn thành nhưng có vấn đề không chặn, nên review lại
|
|
1026
|
+
|
|
1027
|
+
## Output Artifacts
|
|
1028
|
+
|
|
1029
|
+
Liệt kê mọi file được tạo hoặc sửa bởi lệnh này:
|
|
1030
|
+
```
|
|
1031
|
+
Output Artifacts:
|
|
1032
|
+
{created|updated} {file-path} ({mô tả ngắn})
|
|
1033
|
+
{created|updated} {file-path} ({mô tả ngắn})
|
|
1034
|
+
```
|
|
1035
|
+
|
|
1036
|
+
Nếu không ghi file nào (vd: lệnh review hoặc phân tích) → ghi `Output Artifacts: none (read-only)`.
|
|
1037
|
+
|
|
1038
|
+
## Pipeline Position
|
|
1039
|
+
|
|
1040
|
+
In một sơ đồ pipeline một dòng, đánh dấu phase của lệnh HIỆN TẠI bằng `◀ bạn ở đây`,
|
|
1041
|
+
để người dùng luôn thấy lệnh này nằm ở đâu trong luồng end-to-end:
|
|
1042
|
+
|
|
1043
|
+
```
|
|
1044
|
+
Discovery → PRD → [Design Spec] → BDD → Tech Design → Code → Dev Self-Check → QC → Trace Audit
|
|
1045
|
+
```
|
|
1046
|
+
|
|
1047
|
+
Tìm lệnh hiện tại trong bảng phase dưới đây và đánh dấu **phase của nó** trong sơ đồ trên:
|
|
1048
|
+
|
|
1049
|
+
| Phase | Commands |
|
|
1050
|
+
|-------|----------|
|
|
1051
|
+
| Discovery | `/define-product` |
|
|
1052
|
+
| PRD | `/generate-prd` · `/refine-prd` · `/review-context` (PRD) |
|
|
1053
|
+
| Design Spec | `/generate-design-spec` |
|
|
1054
|
+
| BDD | `/generate-bdd` · `/review-context` (BDD) |
|
|
1055
|
+
| Tech Design | `/generate-tech-docs` · `/map-testids` · `/review-tech-docs` |
|
|
1056
|
+
| Code | `/generate-code` · `/review-code` |
|
|
1057
|
+
| Dev Self-Check | `/dev-gen-test` · `/dev-run-test` · `/dev-smoke-test` |
|
|
1058
|
+
| QC | `/qc-analyze` · `/qc-plan` · `/qc-design-test` · `/qc-review` · `/qc-run-test` · `/qc-report` |
|
|
1059
|
+
| Trace Audit | `/validate-traces` |
|
|
1060
|
+
|
|
1061
|
+
Với **lệnh review**, thêm vòng review 3 bước và đánh dấu bước hiện tại, vd:
|
|
1062
|
+
`Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume`.
|
|
1063
|
+
|
|
1064
|
+
**Lệnh xuyên suốt** (`/sync`, `/update-framework`, `/fix-bug`, `/debug`, `/learn`,
|
|
1065
|
+
`/report-bug`, `/propose-scenario`, `/generate-spec-manifest`) nằm ngoài pipeline tuyến tính —
|
|
1066
|
+
**bỏ hẳn dòng Pipeline** cho các lệnh này (đừng cố nhét chúng vào sơ đồ).
|
|
1067
|
+
|
|
1068
|
+
## Gợi ý lệnh tiếp theo
|
|
1069
|
+
|
|
1070
|
+
Gợi ý lệnh kế tiếp hợp lý theo phase của workflow:
|
|
1071
|
+
|
|
1072
|
+
| Lệnh hiện tại | Gợi ý lệnh tiếp theo |
|
|
1073
|
+
|-------------------------|-----------------------------------------------|
|
|
1074
|
+
| /setup-ai-first | `/define-product` để bắt đầu feature đầu tiên |
|
|
1075
|
+
| /define-product | `/generate-prd {product-definition-file}` |
|
|
1076
|
+
| /generate-prd | `/refine-prd {prd-file}` rồi `/review-context {prd-file}` |
|
|
1077
|
+
| /refine-prd | Mở Review Board → cập nhật PRD → `/review-context {prd-file}` |
|
|
1078
|
+
| /review-context (PRD) | Khi 0 critical → PO đặt `Status: approved`, rồi FE/App: `/generate-design-spec {prd-file}` (→ design sign-off → BDD); BE: `/generate-bdd {prd-file}`. Còn critical/NEEDS_FIX → sửa PRD (giữ draft) |
|
|
1079
|
+
| /generate-design-spec | Designer review → xác nhận link Figma → PO + Designer sign-off → `/generate-bdd {prd-file}` |
|
|
1080
|
+
| /generate-bdd | `/review-context {feature-file}` để kiểm tra độ phủ |
|
|
1081
|
+
| /review-context (BDD) | `/generate-tech-docs {UC-ID}` nếu APPROVED; sinh lại nếu NEEDS_FIX |
|
|
1082
|
+
| /qc-analyze | `/qc-plan {UC-ID}` (xử lý các gap blocker 🔴 trước) |
|
|
1083
|
+
| /qc-plan | `/qc-design-test {UC-ID}` |
|
|
1084
|
+
| /qc-design-test | `/qc-review {UC-ID}` (review test-case) |
|
|
1085
|
+
| /qc-review (test-case) | `/qc-run-test {UC-ID}` nếu APPROVED; sửa TC nếu NEEDS_FIX |
|
|
1086
|
+
| /qc-run-test | `/qc-report {UC-ID}` rồi `/qc-review {UC-ID}` (review script) |
|
|
1087
|
+
| /qc-review (script) | `/qc-report {UC-ID}` rồi tạo PR nếu APPROVED |
|
|
1088
|
+
| /qc-report | `/validate-traces {UC-ID}` để làm mới Living Docs (qc_status) |
|
|
1089
|
+
| /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
|
|
1090
|
+
| /review-tech-docs | `/generate-code {feature-file}` nếu APPROVED; sửa doc nếu NEEDS_FIX |
|
|
1091
|
+
| /generate-code | Lần gen đầu → `/review-code {UC-ID}`; gen lại → `/dev-gen-test {UC-ID}` |
|
|
1092
|
+
| /dev-gen-test | `/dev-run-test {UC-ID}` |
|
|
1093
|
+
| /dev-run-test (passing) | `/review-code {UC-ID}` |
|
|
1094
|
+
| /dev-run-test (failing) | `/fix-bug {ticket-id}` hoặc `/debug {error}` |
|
|
1095
|
+
| /review-code | `/dev-smoke-test {UC-ID}` hoặc tạo PR |
|
|
1096
|
+
| /dev-smoke-test | Tạo PR và link tới ticket |
|
|
1097
|
+
| /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/dev-gen-test {UC-ID}`; tất cả OK → tạo PR |
|
|
1098
|
+
| /fix-bug | Tạo PR và link tới ticket |
|
|
1099
|
+
| /debug | `/fix-bug {ticket-id}` nếu cần sửa |
|
|
1100
|
+
| /report-bug | Gửi cho dev (`/fix-bug {BUG-ID}`); nếu thiếu coverage → `/propose-scenario {UC-ID}` |
|
|
1101
|
+
| /propose-scenario | Báo PO/Dev review proposal trong `feedback/bdd-proposals/` |
|
|
1102
|
+
| /learn | Tiếp tục làm việc — lesson áp dụng ở lệnh kế tiếp |
|
|
1103
|
+
| /sync | `/validate-traces` để xem độ phủ đầy đủ; xử lý mọi `📥 tester feedback` được nêu |
|
|
1104
|
+
| /update-framework | Review `git diff .agent/`, commit; `/sync` để đồng bộ nội dung dự án |
|
|
1105
|
+
|
|
1106
|
+
Định dạng footer như sau:
|
|
1107
|
+
```
|
|
1108
|
+
---
|
|
1109
|
+
Status : {badge}
|
|
1110
|
+
{khối Output Artifacts}
|
|
1111
|
+
Pipeline : Discovery → PRD → [BDD ◀ bạn ở đây] → Tech Design → Code → Dev Self-Check → QC → Trace Audit
|
|
1112
|
+
(lệnh review) Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume
|
|
1113
|
+
Next : {lệnh gợi ý kèm ví dụ tham số}
|
|
1114
|
+
```
|
|
1115
|
+
*(Bỏ dòng `Pipeline` cho các lệnh xuyên suốt liệt kê ở trên.)*
|
|
1116
|
+
|
|
1117
|
+
|
|
1118
|
+
```
|
|
1119
|
+
/generate-bdd Hoàn tất
|
|
1120
|
+
|
|
1121
|
+
[Spec repo mode — platform: {active_platform}]
|
|
1122
|
+
Files:
|
|
1123
|
+
{paths.specs_dir}/{domain}/{prd-slug}/bdd/{active_platform}/{TICKET-ID}-UC1-{slug}.feature ({N} scenarios)
|
|
1124
|
+
{paths.specs_dir}/{domain}/{prd-slug}/bdd/{active_platform}/{TICKET-ID}-UC2-{slug}.feature ({N} scenarios)
|
|
1125
|
+
Trace:
|
|
1126
|
+
{paths.trace_dir}/{domain}/{prd-slug}/{TICKET-ID}-UC1-{active_platform}.tsv ({N} rows)
|
|
1127
|
+
{paths.trace_dir}/{domain}/{prd-slug}/{TICKET-ID}-UC2-{active_platform}.tsv ({N} rows)
|
|
1128
|
+
Next (spec repo):
|
|
1129
|
+
→ Chạy /generate-bdd lại cho các platform khác (web → app → system)
|
|
1130
|
+
→ Sau khi gen hết platform: commit + push + báo team dev
|
|
1131
|
+
→ Team dev đọc BDD từ spec submodule — không chạy /generate-bdd ở phía họ
|
|
1132
|
+
|
|
1133
|
+
[Umbrella mode — service: {active_service}]
|
|
1134
|
+
Files:
|
|
1135
|
+
{paths.specs_dir}/{domain}/{prd-slug}/bdd/{TICKET-ID}-UC1-{slug}.feature ({N} scenarios)
|
|
1136
|
+
Trace:
|
|
1137
|
+
{paths.trace_dir}/{domain}/{prd-slug}/{TICKET-ID}-UC1-{active_platform}.tsv ({N} rows)
|
|
1138
|
+
Next (umbrella):
|
|
1139
|
+
→ /review-context {feature-file} để kiểm tra coverage
|
|
1140
|
+
→ /generate-tech-docs {feature-file}
|
|
1141
|
+
→ /generate-code {feature-file}
|
|
1142
|
+
|
|
1143
|
+
📊 Living Docs: chạy /validate-traces (hoặc /sync) để push trace này lên dashboard spec-module.
|
|
1144
|
+
```
|