@edupia-tutor/spec-driven-docs 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (339) hide show
  1. package/bin/build.js +230 -0
  2. package/bin/index.js +598 -0
  3. package/commands/debug.md +830 -0
  4. package/commands/debug.tmpl +257 -0
  5. package/commands/define-product.md +652 -0
  6. package/commands/define-product.tmpl +158 -0
  7. package/commands/dev-gen-test.md +1010 -0
  8. package/commands/dev-gen-test.tmpl +490 -0
  9. package/commands/dev-run-test.md +744 -0
  10. package/commands/dev-run-test.tmpl +224 -0
  11. package/commands/dev-smoke-test.md +711 -0
  12. package/commands/dev-smoke-test.tmpl +217 -0
  13. package/commands/fix-bug.md +744 -0
  14. package/commands/fix-bug.tmpl +171 -0
  15. package/commands/generate-bdd.md +1054 -0
  16. package/commands/generate-bdd.tmpl +534 -0
  17. package/commands/generate-code.md +869 -0
  18. package/commands/generate-code.tmpl +349 -0
  19. package/commands/generate-design-spec.md +958 -0
  20. package/commands/generate-design-spec.tmpl +464 -0
  21. package/commands/generate-prd.md +748 -0
  22. package/commands/generate-prd.tmpl +254 -0
  23. package/commands/generate-spec-manifest.md +658 -0
  24. package/commands/generate-spec-manifest.tmpl +164 -0
  25. package/commands/generate-tech-docs.md +849 -0
  26. package/commands/generate-tech-docs.tmpl +355 -0
  27. package/commands/learn.md +636 -0
  28. package/commands/learn.tmpl +63 -0
  29. package/commands/map-testids.md +575 -0
  30. package/commands/map-testids.tmpl +81 -0
  31. package/commands/propose-scenario.md +623 -0
  32. package/commands/propose-scenario.tmpl +129 -0
  33. package/commands/qc-analyze.md +580 -0
  34. package/commands/qc-analyze.tmpl +86 -0
  35. package/commands/qc-design-test.md +562 -0
  36. package/commands/qc-design-test.tmpl +68 -0
  37. package/commands/qc-plan.md +543 -0
  38. package/commands/qc-plan.tmpl +49 -0
  39. package/commands/qc-report.md +554 -0
  40. package/commands/qc-report.tmpl +60 -0
  41. package/commands/qc-review.md +547 -0
  42. package/commands/qc-review.tmpl +53 -0
  43. package/commands/qc-run-test.md +604 -0
  44. package/commands/qc-run-test.tmpl +84 -0
  45. package/commands/refine-prd.md +772 -0
  46. package/commands/refine-prd.tmpl +140 -0
  47. package/commands/report-bug.md +639 -0
  48. package/commands/report-bug.tmpl +145 -0
  49. package/commands/review-code.md +677 -0
  50. package/commands/review-code.tmpl +104 -0
  51. package/commands/review-context.md +1047 -0
  52. package/commands/review-context.tmpl +415 -0
  53. package/commands/review-tech-docs.md +811 -0
  54. package/commands/review-tech-docs.tmpl +317 -0
  55. package/commands/setup-ai-first.md +545 -0
  56. package/commands/setup-ai-first.tmpl +358 -0
  57. package/commands/sync.md +451 -0
  58. package/commands/sync.tmpl +351 -0
  59. package/commands/update-framework.md +251 -0
  60. package/commands/update-framework.tmpl +151 -0
  61. package/commands/validate-traces.md +842 -0
  62. package/commands/validate-traces.tmpl +348 -0
  63. package/core/FRAMEWORK_VERSION +1 -0
  64. package/core/commands/debug.md +830 -0
  65. package/core/commands/define-product.md +652 -0
  66. package/core/commands/dev-gen-test.md +1010 -0
  67. package/core/commands/dev-run-test.md +744 -0
  68. package/core/commands/dev-smoke-test.md +711 -0
  69. package/core/commands/fix-bug.md +744 -0
  70. package/core/commands/generate-bdd.md +1054 -0
  71. package/core/commands/generate-code.md +869 -0
  72. package/core/commands/generate-design-spec.md +958 -0
  73. package/core/commands/generate-prd.md +748 -0
  74. package/core/commands/generate-spec-manifest.md +658 -0
  75. package/core/commands/generate-tech-docs.md +849 -0
  76. package/core/commands/learn.md +636 -0
  77. package/core/commands/map-testids.md +575 -0
  78. package/core/commands/propose-scenario.md +623 -0
  79. package/core/commands/qc-analyze.md +580 -0
  80. package/core/commands/qc-design-test.md +562 -0
  81. package/core/commands/qc-plan.md +543 -0
  82. package/core/commands/qc-report.md +554 -0
  83. package/core/commands/qc-review.md +547 -0
  84. package/core/commands/qc-run-test.md +604 -0
  85. package/core/commands/refine-prd.md +772 -0
  86. package/core/commands/report-bug.md +639 -0
  87. package/core/commands/review-code.md +677 -0
  88. package/core/commands/review-context.md +1047 -0
  89. package/core/commands/review-tech-docs.md +811 -0
  90. package/core/commands/setup-ai-first.md +545 -0
  91. package/core/commands/sync.md +451 -0
  92. package/core/commands/update-framework.md +251 -0
  93. package/core/commands/validate-traces.md +842 -0
  94. package/core/hooks/data-guard.js +141 -0
  95. package/core/hooks/settings.json +18 -0
  96. package/core/modules/android-compose/module.yaml +13 -0
  97. package/core/modules/android-compose/stack-profile.yaml +57 -0
  98. package/core/modules/angular/architecture-snippets/component-patterns.md +187 -0
  99. package/core/modules/angular/module.yaml +6 -0
  100. package/core/modules/angular/stack-profile.yaml +38 -0
  101. package/core/modules/context-engineering/architecture-snippets/context-design.md +119 -0
  102. package/core/modules/context-engineering/module.yaml +9 -0
  103. package/core/modules/context-engineering/stack-profile.yaml +61 -0
  104. package/core/modules/dotnet/architecture-snippets/clean-arch.md +160 -0
  105. package/core/modules/dotnet/module.yaml +6 -0
  106. package/core/modules/dotnet/stack-profile.yaml +50 -0
  107. package/core/modules/flutter/module.yaml +14 -0
  108. package/core/modules/flutter/stack-profile.yaml +59 -0
  109. package/core/modules/golang/architecture-snippets/domain-layout.md +283 -0
  110. package/core/modules/golang/module.yaml +6 -0
  111. package/core/modules/golang/stack-profile.yaml +40 -0
  112. package/core/modules/ios-swiftui/module.yaml +13 -0
  113. package/core/modules/ios-swiftui/stack-profile.yaml +55 -0
  114. package/core/modules/java-spring/architecture-snippets/layered-arch.md +201 -0
  115. package/core/modules/java-spring/module.yaml +15 -0
  116. package/core/modules/java-spring/stack-profile.yaml +28 -0
  117. package/core/modules/nextjs/architecture-snippets/app-router-patterns.md +269 -0
  118. package/core/modules/nextjs/module.yaml +14 -0
  119. package/core/modules/nextjs/stack-profile.yaml +74 -0
  120. package/core/modules/nuxt/module.yaml +14 -0
  121. package/core/modules/nuxt/stack-profile.yaml +58 -0
  122. package/core/modules/php-laravel/architecture-snippets/service-repository.md +302 -0
  123. package/core/modules/php-laravel/module.yaml +15 -0
  124. package/core/modules/php-laravel/stack-profile.yaml +56 -0
  125. package/core/modules/qc-playwright/stack-profile.yaml +66 -0
  126. package/core/modules/react/architecture-snippets/hooks-query-patterns.md +254 -0
  127. package/core/modules/react/module.yaml +14 -0
  128. package/core/modules/react/stack-profile.yaml +63 -0
  129. package/core/modules/react-native/module.yaml +14 -0
  130. package/core/modules/react-native/stack-profile.yaml +56 -0
  131. package/core/modules/vue/module.yaml +14 -0
  132. package/core/modules/vue/stack-profile.yaml +65 -0
  133. package/core/rules/data-protection.md +80 -0
  134. package/core/rules/workflow.md +44 -0
  135. package/core/skills/code/SKILL.md +770 -0
  136. package/core/skills/debug/SKILL.md +869 -0
  137. package/core/skills/design-spec/SKILL.md +589 -0
  138. package/core/skills/discovery/SKILL.md +554 -0
  139. package/core/skills/prd/SKILL.md +562 -0
  140. package/core/skills/qc/qa-analyst/DOC_GAPS.template.md +63 -0
  141. package/core/skills/qc/qa-analyst/acceptance-criteria.md +60 -0
  142. package/core/skills/qc/qa-analyst/business-rules.md +59 -0
  143. package/core/skills/qc/qa-analyst/data-flow.md +64 -0
  144. package/core/skills/qc/qa-analyst/spec-breakdown.md +61 -0
  145. package/core/skills/qc/qa-designer/e2e/journey.md +41 -0
  146. package/core/skills/qc/qa-designer/exploratory/charter.md +68 -0
  147. package/core/skills/qc/qa-designer/exploratory/explore-to-functional.md +43 -0
  148. package/core/skills/qc/qa-designer/functional/api.md +45 -0
  149. package/core/skills/qc/qa-designer/functional/gui-feature.md +46 -0
  150. package/core/skills/qc/qa-designer/functional/gui-screen.md +52 -0
  151. package/core/skills/qc/qa-designer/integration/api.md +42 -0
  152. package/core/skills/qc/qa-designer/integration/db.md +39 -0
  153. package/core/skills/qc/qa-designer/integration/gui.md +40 -0
  154. package/core/skills/qc/qa-designer/integration/kafka.md +40 -0
  155. package/core/skills/qc/qa-designer/non-functional.md +40 -0
  156. package/core/skills/qc/qa-planner/test-plan.md +120 -0
  157. package/core/skills/qc/qa-reviewer/script/e2e.md +87 -0
  158. package/core/skills/qc/qa-reviewer/script/exploratory.md +45 -0
  159. package/core/skills/qc/qa-reviewer/script/functional.md +101 -0
  160. package/core/skills/qc/qa-reviewer/script/integration.md +91 -0
  161. package/core/skills/qc/qa-reviewer/script/non-functional.md +126 -0
  162. package/core/skills/qc/qa-reviewer/test-case/e2e.md +73 -0
  163. package/core/skills/qc/qa-reviewer/test-case/exploratory.md +43 -0
  164. package/core/skills/qc/qa-reviewer/test-case/functional.md +76 -0
  165. package/core/skills/qc/qa-reviewer/test-case/integration.md +69 -0
  166. package/core/skills/qc/qa-reviewer/test-case/non-functional.md +73 -0
  167. package/core/skills/qc/qa-runner/e2e.md +49 -0
  168. package/core/skills/qc/qa-runner/exploratory/session.md +36 -0
  169. package/core/skills/qc/qa-runner/functional/api.md +35 -0
  170. package/core/skills/qc/qa-runner/functional/gui-feature.md +51 -0
  171. package/core/skills/qc/qa-runner/functional/gui-screen.md +55 -0
  172. package/core/skills/qc/qa-runner/integration.md +47 -0
  173. package/core/skills/qc/qa-runner/non-functional.md +49 -0
  174. package/core/skills/qc/qa-runner/report/report.md +37 -0
  175. package/core/skills/setup-ai-first/SKILL.md +216 -0
  176. package/core/skills/spec/SKILL.md +461 -0
  177. package/core/skills/test/SKILL.md +1297 -0
  178. package/core/steps/capture-lesson.md +79 -0
  179. package/core/steps/context-loader.md +307 -0
  180. package/core/steps/gate.md +87 -0
  181. package/core/steps/report-footer.md +100 -0
  182. package/core/steps/review-fanout.md +138 -0
  183. package/core/steps/spawn-agent.md +124 -0
  184. package/core/steps/trace-mirror.md +26 -0
  185. package/core/templates/architecture.template.md +113 -0
  186. package/core/templates/design-spec.template.md +217 -0
  187. package/core/templates/feature.template +259 -0
  188. package/core/templates/platform-guide.template.md +145 -0
  189. package/core/templates/prd.template.md +327 -0
  190. package/core/templates/product-definition.template.md +168 -0
  191. package/core/templates/project-context.yaml +161 -0
  192. package/docs/01-getting-started/README.md +19 -0
  193. package/docs/01-getting-started/core-concepts.md +102 -0
  194. package/docs/01-getting-started/installation.md +156 -0
  195. package/docs/01-getting-started/quickstart.md +85 -0
  196. package/docs/02-guides/README.md +26 -0
  197. package/docs/02-guides/developer/README.md +46 -0
  198. package/docs/02-guides/developer/bdd-and-trace.md +125 -0
  199. package/docs/02-guides/developer/commands.md +76 -0
  200. package/docs/02-guides/developer/pr-checklist.md +15 -0
  201. package/docs/02-guides/developer/scenarios.md +460 -0
  202. package/docs/02-guides/developer/workflow.md +121 -0
  203. package/docs/02-guides/product-owner/README.md +79 -0
  204. package/docs/02-guides/product-owner/commands.md +30 -0
  205. package/docs/02-guides/product-owner/handoff-checklist.md +42 -0
  206. package/docs/02-guides/product-owner/prd-writing-rules.md +45 -0
  207. package/docs/02-guides/product-owner/scenarios.md +436 -0
  208. package/docs/02-guides/tester/README.md +75 -0
  209. package/docs/02-guides/tester/bug-reporting.md +117 -0
  210. package/docs/02-guides/tester/qc-automation.md +165 -0
  211. package/docs/02-guides/tester/reading-specs.md +79 -0
  212. package/docs/02-guides/tester/scenarios.md +186 -0
  213. package/docs/02-guides/tester/spec-manifest.md +130 -0
  214. package/docs/02-guides/tester/test-checklist.md +31 -0
  215. package/docs/02-guides/tester/workflow.md +77 -0
  216. package/docs/03-concepts/README.md +19 -0
  217. package/docs/03-concepts/architecture.md +248 -0
  218. package/docs/03-concepts/pipeline.md +274 -0
  219. package/docs/03-concepts/traceability.md +149 -0
  220. package/docs/04-operations/README.md +33 -0
  221. package/docs/04-operations/bug-flow.md +362 -0
  222. package/docs/04-operations/publishing.md +137 -0
  223. package/docs/04-operations/sync-and-update.md +522 -0
  224. package/docs/05-reference/README.md +32 -0
  225. package/docs/05-reference/command-cheatsheet.md +147 -0
  226. package/docs/05-reference/commands.md +232 -0
  227. package/docs/05-reference/modules.md +110 -0
  228. package/docs/05-reference/trace-schema.md +153 -0
  229. package/docs/README.md +49 -0
  230. package/hooks/data-guard.js +141 -0
  231. package/hooks/settings.json +18 -0
  232. package/modules/android-compose/module.yaml +13 -0
  233. package/modules/android-compose/stack-profile.yaml +57 -0
  234. package/modules/angular/architecture-snippets/component-patterns.md +187 -0
  235. package/modules/angular/module.yaml +6 -0
  236. package/modules/angular/stack-profile.yaml +38 -0
  237. package/modules/context-engineering/architecture-snippets/context-design.md +119 -0
  238. package/modules/context-engineering/module.yaml +9 -0
  239. package/modules/context-engineering/stack-profile.yaml +61 -0
  240. package/modules/dotnet/architecture-snippets/clean-arch.md +160 -0
  241. package/modules/dotnet/module.yaml +6 -0
  242. package/modules/dotnet/stack-profile.yaml +50 -0
  243. package/modules/flutter/module.yaml +14 -0
  244. package/modules/flutter/stack-profile.yaml +59 -0
  245. package/modules/golang/architecture-snippets/domain-layout.md +283 -0
  246. package/modules/golang/module.yaml +6 -0
  247. package/modules/golang/stack-profile.yaml +40 -0
  248. package/modules/ios-swiftui/module.yaml +13 -0
  249. package/modules/ios-swiftui/stack-profile.yaml +55 -0
  250. package/modules/java-spring/architecture-snippets/layered-arch.md +201 -0
  251. package/modules/java-spring/module.yaml +15 -0
  252. package/modules/java-spring/stack-profile.yaml +28 -0
  253. package/modules/nextjs/architecture-snippets/app-router-patterns.md +269 -0
  254. package/modules/nextjs/module.yaml +14 -0
  255. package/modules/nextjs/stack-profile.yaml +74 -0
  256. package/modules/nuxt/module.yaml +14 -0
  257. package/modules/nuxt/stack-profile.yaml +58 -0
  258. package/modules/php-laravel/architecture-snippets/service-repository.md +302 -0
  259. package/modules/php-laravel/module.yaml +15 -0
  260. package/modules/php-laravel/stack-profile.yaml +56 -0
  261. package/modules/qc-playwright/stack-profile.yaml +66 -0
  262. package/modules/react/architecture-snippets/hooks-query-patterns.md +254 -0
  263. package/modules/react/module.yaml +14 -0
  264. package/modules/react/stack-profile.yaml +63 -0
  265. package/modules/react-native/module.yaml +14 -0
  266. package/modules/react-native/stack-profile.yaml +56 -0
  267. package/modules/vue/module.yaml +14 -0
  268. package/modules/vue/stack-profile.yaml +65 -0
  269. package/package.json +49 -0
  270. package/rules/data-protection.md +80 -0
  271. package/rules/workflow.md +44 -0
  272. package/scripts/init.sh +49 -0
  273. package/scripts/migrate-specs.js +256 -0
  274. package/scripts/upgrade.sh +94 -0
  275. package/skills/code/SKILL.md +770 -0
  276. package/skills/code/SKILL.tmpl +176 -0
  277. package/skills/debug/SKILL.md +869 -0
  278. package/skills/debug/SKILL.tmpl +262 -0
  279. package/skills/design-spec/SKILL.md +589 -0
  280. package/skills/design-spec/SKILL.tmpl +95 -0
  281. package/skills/discovery/SKILL.md +554 -0
  282. package/skills/discovery/SKILL.tmpl +147 -0
  283. package/skills/prd/SKILL.md +562 -0
  284. package/skills/prd/SKILL.tmpl +188 -0
  285. package/skills/qc/qa-analyst/DOC_GAPS.template.md +63 -0
  286. package/skills/qc/qa-analyst/acceptance-criteria.md +60 -0
  287. package/skills/qc/qa-analyst/business-rules.md +59 -0
  288. package/skills/qc/qa-analyst/data-flow.md +64 -0
  289. package/skills/qc/qa-analyst/spec-breakdown.md +61 -0
  290. package/skills/qc/qa-designer/e2e/journey.md +41 -0
  291. package/skills/qc/qa-designer/exploratory/charter.md +68 -0
  292. package/skills/qc/qa-designer/exploratory/explore-to-functional.md +43 -0
  293. package/skills/qc/qa-designer/functional/api.md +45 -0
  294. package/skills/qc/qa-designer/functional/gui-feature.md +46 -0
  295. package/skills/qc/qa-designer/functional/gui-screen.md +52 -0
  296. package/skills/qc/qa-designer/integration/api.md +42 -0
  297. package/skills/qc/qa-designer/integration/db.md +39 -0
  298. package/skills/qc/qa-designer/integration/gui.md +40 -0
  299. package/skills/qc/qa-designer/integration/kafka.md +40 -0
  300. package/skills/qc/qa-designer/non-functional.md +40 -0
  301. package/skills/qc/qa-planner/test-plan.md +120 -0
  302. package/skills/qc/qa-reviewer/script/e2e.md +87 -0
  303. package/skills/qc/qa-reviewer/script/exploratory.md +45 -0
  304. package/skills/qc/qa-reviewer/script/functional.md +101 -0
  305. package/skills/qc/qa-reviewer/script/integration.md +91 -0
  306. package/skills/qc/qa-reviewer/script/non-functional.md +126 -0
  307. package/skills/qc/qa-reviewer/test-case/e2e.md +73 -0
  308. package/skills/qc/qa-reviewer/test-case/exploratory.md +43 -0
  309. package/skills/qc/qa-reviewer/test-case/functional.md +76 -0
  310. package/skills/qc/qa-reviewer/test-case/integration.md +69 -0
  311. package/skills/qc/qa-reviewer/test-case/non-functional.md +73 -0
  312. package/skills/qc/qa-runner/e2e.md +49 -0
  313. package/skills/qc/qa-runner/exploratory/session.md +36 -0
  314. package/skills/qc/qa-runner/functional/api.md +35 -0
  315. package/skills/qc/qa-runner/functional/gui-feature.md +51 -0
  316. package/skills/qc/qa-runner/functional/gui-screen.md +55 -0
  317. package/skills/qc/qa-runner/integration.md +47 -0
  318. package/skills/qc/qa-runner/non-functional.md +49 -0
  319. package/skills/qc/qa-runner/report/report.md +37 -0
  320. package/skills/setup-ai-first/SKILL.md +216 -0
  321. package/skills/setup-ai-first/SKILL.tmpl +116 -0
  322. package/skills/spec/SKILL.md +461 -0
  323. package/skills/spec/SKILL.tmpl +174 -0
  324. package/skills/test/SKILL.md +1297 -0
  325. package/skills/test/SKILL.tmpl +296 -0
  326. package/steps/capture-lesson.md +79 -0
  327. package/steps/context-loader.md +307 -0
  328. package/steps/gate.md +87 -0
  329. package/steps/report-footer.md +100 -0
  330. package/steps/review-fanout.md +138 -0
  331. package/steps/spawn-agent.md +124 -0
  332. package/steps/trace-mirror.md +26 -0
  333. package/templates/architecture.template.md +113 -0
  334. package/templates/design-spec.template.md +217 -0
  335. package/templates/feature.template +259 -0
  336. package/templates/platform-guide.template.md +145 -0
  337. package/templates/prd.template.md +327 -0
  338. package/templates/product-definition.template.md +168 -0
  339. package/templates/project-context.yaml +161 -0
@@ -0,0 +1,117 @@
1
+ [📚 Docs](../../README.md) › [Guides](../README.md) › [Tester](README.md) › Báo cáo bug
2
+
3
+ # Khi Tìm Thấy Bug — Quy Trình Trace
4
+
5
+ Khi test fail, báo cáo phải có đủ **spec context** để Dev fix đúng chỗ.
6
+
7
+ ## Cách nhanh nhất: `/report-bug`
8
+
9
+ ```bash
10
+ /report-bug FT-001 tài khoản khoá sau 6 lần sai, spec ghi 5
11
+ ```
12
+
13
+ Lệnh tự động:
14
+ - Resolve spec-context từ `spec-manifest.yaml`: PRD path + version, BDD scenario fail, tech-doc
15
+ - Tìm **AC bị vi phạm** trong PRD
16
+ - **Phân loại layer** theo BUG_FLOW (Code / BDD / PRD / Design Spec / Env) → route đúng người
17
+ - Phát hiện **coverage gap** → gợi ý `/propose-scenario`
18
+ - Ghi report vào **spec repo** (`{spec_source}/feedback/bug-reports/{BUG-ID}.md`) → **commit + push**
19
+
20
+ Hoàn toàn **read-only** trên spec/code chính thức — chỉ ghi vào vùng `feedback/`.
21
+
22
+ > **Làm sao PO/Dev biết?** Report được commit+push vào **spec repo dùng chung**. PO/Dev chạy `/sync` hàng ngày sẽ thấy dòng `📥 New tester feedback`. File nằm local một mình thì không ai biết — chính bước push + `/sync` mới khép vòng. (Không có quyền push → tạo PR/MR.)
23
+
24
+ ## Khi bug là "thiếu scenario" — `/propose-scenario`
25
+
26
+ Nếu `/report-bug` báo *coverage gap* (behavior đúng nhưng chưa có scenario nào kiểm):
27
+
28
+ ```bash
29
+ /propose-scenario FT-001 login với email có khoảng trắng ở cuối vẫn phải thành công
30
+ ```
31
+
32
+ - Nếu behavior **đã nằm trong một AC của PRD** → lệnh draft Gherkin (tag `@proposed @from-test`), ghi vào `{spec_source}/feedback/bdd-proposals/` → commit + push. PO/Dev review rồi đưa vào `.feature`.
33
+ - Nếu behavior **chưa có trong PRD** → lệnh **ghi** một *PRD change request* (`State: Open`) vào `{spec_source}/feedback/prd-change-requests/{UC-ID}-{slug}.md` → commit + push (KHÔNG chỉ in ra). PO thấy nó khi `/sync`, thêm/sửa AC rồi `/generate-bdd` lại.
34
+
35
+ > Tester không tự ghi vào BDD — chỉ đề xuất. Giữ đúng ownership.
36
+
37
+ ## Template báo cáo bug
38
+
39
+ *(Tham khảo — `/report-bug` tự sinh theo format này. Dùng khi báo cáo thủ công.)*
40
+
41
+ ```
42
+ Bug ID : BUG-{date}-{seq}
43
+ Feature : FT-{xxx} — {feature name}
44
+ Service : BE / Web / App
45
+ Severity : Critical / Major / Minor
46
+
47
+ Spec context:
48
+ PRD : specs/{domain}/{prd-slug}/prd.md (v{x.x})
49
+ BDD : {bdd path} → Scenario: "{scenario title}"
50
+ Tech Doc : {tech_docs path}
51
+
52
+ AC bị vi phạm:
53
+ AC{N}: "{AC text từ PRD}"
54
+
55
+ BDD Scenario bị fail:
56
+ "{Scenario title}"
57
+ Given: {given state}
58
+ When : {action}
59
+ Then : {expected theo spec}
60
+
61
+ Actual behavior:
62
+ {what actually happened}
63
+
64
+ Steps to reproduce:
65
+ 1. {step}
66
+ 2. {step}
67
+
68
+ Environment: staging / production
69
+ ```
70
+
71
+ ## Ví dụ báo cáo thực tế
72
+
73
+ ```
74
+ Bug ID : BUG-20260605-003
75
+ Feature : FT-001 — User Login
76
+ Service : BE
77
+ Severity : Major
78
+
79
+ Spec context:
80
+ PRD : specs/auth/FT-001-login/prd.md (v1.0)
81
+ BDD : free-trial-specs/specs/auth/FT-001-login/bdd/system/FT-001-login.feature
82
+ → Scenario: "Lock account after 5 failed attempts"
83
+ Tech Doc : free-trial-specs/specs/auth/FT-001-login/tech-docs/FT-001-auth-api.md
84
+
85
+ AC bị vi phạm:
86
+ AC3: "Sai password 5 lần liên tiếp → khoá tài khoản 30 phút"
87
+
88
+ BDD Scenario bị fail:
89
+ "Lock account after 5 failed attempts"
90
+ Given : user "alice@example.com" has 0 failed attempts
91
+ When : login with wrong password 5 times
92
+ Then : 5th attempt returns 423 Locked
93
+ AND retry_after = 1800
94
+
95
+ Actual behavior:
96
+ 5th attempt returns 401 Unauthorized (không phải 423)
97
+ Không có retry_after header
98
+ → Tài khoản không bị khoá, vẫn cho thử tiếp
99
+
100
+ Steps to reproduce:
101
+ POST /api/v1/auth/login × 5 với password sai
102
+ → lần thứ 5 vẫn nhận 401
103
+
104
+ Environment: staging (deploy 2026-06-05 09:00)
105
+ ```
106
+
107
+ ## Sau khi gửi bug report
108
+
109
+ Dev sẽ xác định bug thuộc layer nào (code / BDD / PRD / env) và phản hồi với root cause + scenario cần re-test.
110
+
111
+ > Xem flow phối hợp đầy đủ giữa Tester ↔ Dev ↔ PO trong **[Operations › Bug Flow](../../04-operations/bug-flow.md)**.
112
+
113
+ > **Nếu AI lặp lại cùng kiểu lỗi qua nhiều feature:** ghi chú trong bug report. Dev chạy `/learn` để biến nó thành guardrail — AI sẽ không sinh lại lỗi đó ở các UC sau.
114
+
115
+ ---
116
+
117
+ ← [Tình huống thực tế](scenarios.md) · Tiếp theo: [Checklist test pass](test-checklist.md)
@@ -0,0 +1,165 @@
1
+ [📚 Docs](../../README.md) › [Guides](../README.md) › [Tester](README.md) › QC Automation
2
+
3
+ # Hướng Dẫn QC Automation — Spec-Driven Docs
4
+
5
+ > Đây là **một chương của [guide Tester / QA](README.md)** — QC và Tester là **cùng một role**. Chương này đi sâu vào pipeline QC tự động (`/qc-*`); phần vai trò chung, spec-manifest, `/report-bug`, `/propose-scenario`… ở [README của guide](README.md).
6
+
7
+ Pipeline QC automation **chính thức** của framework — được port từ agent của team QC (reference repo `ai-automation-qc-base`) vào ngay trong framework. Nó sinh và chạy automation **Playwright/pytest** từ BDD `.feature` chính thức, rồi ghi tín hiệu **`qc_status`** (authoritative) vào trace TSV → Living Docs.
8
+
9
+ ## Mục Lục
10
+
11
+ - [Hai luồng test: dev self-check vs QC chính thức](#hai-luồng-test-dev-self-check-vs-qc-chính-thức)
12
+ - [Pipeline 6 bước](#pipeline-6-bước)
13
+ - [Stack — module qc-playwright](#stack--module-qc-playwright)
14
+ - [Trace join: qc_status đến Living Docs như thế nào](#trace-join-qc_status-đến-living-docs-như-thế-nào)
15
+ - [Entry point](#entry-point)
16
+ - [Skills theo layer](#skills-theo-layer)
17
+
18
+ ## Hai Luồng Test: Dev Self-Check vs QC Chính Thức
19
+
20
+ Pipeline QC này **khác** với developer **self-check** (`/dev-gen-test`, `/dev-run-test`, `/dev-smoke-test`):
21
+
22
+ | Signal | Owner | Command | Ý nghĩa |
23
+ |--------|-------|---------|---------|
24
+ | `dev_selftest` | Dev | `/dev-run-test` | smoke check của riêng dev (KHÔNG authoritative) |
25
+ | `qc_status` | QC | `/qc-run-test` | kết quả QC automation **chính thức** |
26
+
27
+ Cả hai hiển thị **cạnh nhau** trong Living Docs; không cái nào ghi đè cái nào. `dev_selftest: pass` chỉ nghĩa "dev đã tự smoke qua"; coverage chính thức nằm ở `qc_status`.
28
+
29
+ ## Pipeline 6 Bước
30
+
31
+ ```
32
+ /qc-analyze → /qc-plan → /qc-design-test → /qc-review → /qc-run-test → /qc-report
33
+ (requirement (risk/plan (test-case (review (gen+run (report +
34
+ breakdown) + Q-for-dev) .Test.md) gate) Python → evidence)
35
+ qc_status)
36
+ ```
37
+
38
+ | Command | Vai trò | Output |
39
+ |---------|---------|--------|
40
+ | `/qc-analyze` | bóc tách spec chính thức thành **1 file phân tích gộp** (requirement + BR/AC + data-flow) + `DOC_GAPS` | `{qc_dir}/{UC-ID}/` → `REQUIREMENT_ANALYSIS.md` + `DOC_GAPS.md` (**2 file**) |
41
+ | `/qc-plan` | risk / what-if / questions-for-dev + test plan | `TEST_PLAN.md` |
42
+ | `/qc-design-test` | thiết kế test case (Markdown `.Test.md`), tag `@trace.verifies={UC-ID}-SC{N}` | `test-cases/` |
43
+ | `/qc-review` | cổng review hai chiều: review test case (sau design) và script (sau run) | findings |
44
+ | `/qc-run-test` | sinh + chạy Python pytest-playwright; **ghi `qc_status`** per scenario | `{trace_dir}/{UC-ID}.tsv` |
45
+ | `/qc-report` | report pytest-html + Playwright trace + evidence | `reports/<feature>/report.html` |
46
+
47
+ > **Nơi lưu artifact (`qc_dir`):** mọi output của pipeline (trừ report) nằm trong thư mục QC
48
+ > **lộ ra ngoài** `{qc_dir}/{UC-ID}/` — mặc định `docs/{UC-ID}/`, cấu hình qua `paths.qc_dir`
49
+ > trong `project-context.yaml`. Đây là **working-doc riêng của QC** trong repo QC, **không ẩn**
50
+ > (KHÔNG nằm trong `.agent/`). Spec gốc (PRD/`.feature`/design-spec) KHÔNG nằm đây — chúng đến
51
+ > từ **submodule spec của PO** (`spec_source`). `/qc-analyze` chỉ ghi **đúng 2 file**:
52
+ > `REQUIREMENT_ANALYSIS.md` (phân tích gộp) + `DOC_GAPS.md`.
53
+
54
+ ## Stack — Module qc-playwright
55
+
56
+ `/qc-run-test` và `/qc-report` dùng stack module `qc-playwright`
57
+ (`.agent/modules/qc-playwright/stack-profile.yaml`): **Python + pytest-playwright + Page
58
+ Object** (slim `BasePage`, 3-layer), **Playwright Trace + pytest-html** (KHÔNG Allure). Stack
59
+ này độc lập với module implementation của dev (java-spring, react, flutter, …).
60
+
61
+ Per-layer guides chi tiết nằm trong `skills/qc/<stage>/` (port từ skills của agent QC):
62
+ functional / integration / e2e / non-functional / exploratory.
63
+
64
+ ### Test-ID contract — locate element không cần scan
65
+
66
+ Để QC **không** phải dò/giả lập vị trí element lúc runtime (chậm), FE tech-design có section **§2b Test Selectors**: mỗi element **có action** được gán test-id ổn định (`{uc}-{screen}-{element}-{type}`, vd `ft001-login-submit-btn`). `/generate-code` emit đúng id đó theo attribute platform (web `data-testid` · RN `testID` · Flutter `Key`/`Semantics` · iOS `accessibilityIdentifier`); `/qc-design-test` cite test-id trong step; `/qc-run-test` build Page Object locator **thẳng từ map** (ưu tiên trong locator priority `data-testid → role → …`). Element có action mà chưa có test-id trong §2b → QC **fallback** role/text (chậm hơn) và nên bổ sung vào tech-design. Xem [Trace Schema](../../05-reference/trace-schema.md) và FE tech-design (`/generate-tech-docs`).
67
+
68
+ > **Component reuse / code có sẵn:** `/generate-tech-docs` + `/generate-code` chỉ gán id cho code **mới**. Với component dùng chung (id ở usage site, component phải *forward* test-id) hoặc màn hình **brownfield** đã viết tay → chạy **`/map-testids {UC-ID}`**: reverse-document id đang có, gán id còn thiếu, patch forwarding + ghi vào `figma-components/{module}.md` (section *Test-ID Forwarding*), điền §2b. Nhờ vậy QC vẫn locate-by-id không cần scan.
69
+
70
+ ## Trace Join: qc_status Đến Living Docs Như Thế Nào
71
+
72
+ 1. `.feature` chính thức định nghĩa scenario là `@trace.scenario={UC-ID}-SC{N}`.
73
+ 2. `/qc-design-test` ghi SC mà test case thuộc về; `/qc-run-test` tag mỗi pytest test
74
+ `# @trace.verifies={UC-ID}-SC{N}`.
75
+ 3. `/qc-run-test` ghi `qc_status` (`pass|fail|skip|not_run`) + `qc_run_at` vào trace TSV của
76
+ service (authoritative), rồi refresh panel mirror local.
77
+ 4. `/validate-traces` (hoặc `/sync`) tổng hợp các TSV thành report Living Docs tại
78
+ `{spec_source}/.living-docs/` — dashboard hiển thị `qc_status` cạnh `dev_selftest`.
79
+
80
+ ## Entry Point
81
+
82
+ Pipeline QC bắt đầu ngay khi BDD của một UC được approved (`/review-context (BDD)` APPROVED):
83
+
84
+ ```
85
+ /qc-analyze {UC-ID} → … → /qc-report {UC-ID} → /validate-traces {UC-ID}
86
+ ```
87
+
88
+ ## Skills Theo Layer
89
+
90
+ Các skill chi tiết theo từng giai đoạn QC nằm trong `skills/qc/`:
91
+
92
+ | Stage skill | Vai trò |
93
+ |---|---|
94
+ | `qa-analyst` | phân tích requirement, sinh `DOC_GAPS` |
95
+ | `qa-planner` | test plan, risk, questions-for-dev |
96
+ | `qa-designer` | thiết kế test case `.Test.md` theo layer (functional / integration / e2e / non-functional / exploratory) |
97
+ | `qa-reviewer` | cổng review test case và script |
98
+ | `qa-runner` | sinh + chạy Python pytest-playwright, sinh report (Playwright Trace + pytest-html) |
99
+
100
+ Mỗi skill **tự chứa** (self-contained) và có version frontmatter để theo dõi khi nâng cấp.
101
+
102
+ ## Khi QC Tìm Thấy Bug / Spec Gap — Đẩy Lên Specs
103
+
104
+ QC chạy pipeline nhưng **không tự sửa spec/code**. Khi phát hiện vấn đề, đẩy lên spec repo của PO
105
+ qua flow feedback có sẵn (`/report-bug` · `/propose-scenario` — PO/Dev nhận khi `/sync`):
106
+
107
+ | QC phát hiện ở | Loại | Hành động |
108
+ |---|---|---|
109
+ | `/qc-run-test` FAIL = **product-gap** (impl ≠ spec, lỗi thật) | bug | `/report-bug {UC-ID} {expected vs actual}` |
110
+ | `/qc-run-test` FAIL = **script-bug** (sai selector/logic script) | — | QC tự sửa script + chạy lại (**KHÔNG** file bug) |
111
+ | `/qc-analyze` `DOC_GAPS` blocker = **spec sai / mơ hồ / mâu thuẫn** (PRD·BDD) | spec defect | `/report-bug {UC-ID}` (BUG_FLOW phân loại PRD/BDD) |
112
+ | `/qc-analyze` `DOC_GAPS` = **thiếu coverage** (behavior trong AC nhưng chưa có scenario) | coverage gap | `/propose-scenario {UC-ID}` |
113
+ | `DOC_GAPS` = `ASSUMPTION` / `OPEN QUESTION` | câu hỏi | qc-plan → questions-for-dev (xác nhận với PO/Dev, không file bug) |
114
+
115
+ `/report-bug` ghi `feedback/bug-reports/BUG-xxx.md` + commit/push lên spec repo; `/propose-scenario`
116
+ ghi `feedback/bdd-proposals/`. PO/Dev thấy khi `/sync`, rồi BUG_FLOW định tuyến root cause:
117
+
118
+ ```
119
+ • Code bug → Dev /fix-bug (KHÔNG đổi spec)
120
+ • BDD sai / thiếu → sửa .feature / promote proposal → /generate-bdd
121
+ • PRD mơ hồ / sai → PO sửa PRD → /refine-prd → /review-context → /generate-bdd
122
+ ↓ (nếu spec đổi → regenerate)
123
+ /generate-code lại → QC /qc-run-test lại → qc_status: fail → pass
124
+ ```
125
+
126
+ > QC chỉ **đọc** spec (từ submodule PO) — mọi thay đổi PRD/BDD là việc của PO/Dev. QC đẩy *tín hiệu*
127
+ > (bug / proposal / gap), không tự sửa canonical spec. `/qc-report` ở cuối pipeline **in sẵn** danh
128
+ > sách lệnh `/report-bug` cho từng product-gap để QC chạy. Chi tiết flow bug: [Operations · Bug Flow](../../04-operations/bug-flow.md).
129
+
130
+ ## Skill Sourcing & Upgrade-Safety
131
+
132
+ Các skill QC (`qa-analyst` / `qa-designer` / `qa-planner` / `qa-reviewer` / `qa-runner` +
133
+ `DOC_GAPS.template.md`) **không bị hardcode** — command nạp chúng từ `paths.qc_skills_dir`:
134
+
135
+ | Tình huống | `qc_skills_dir` | Hệ quả khi `/update-framework` |
136
+ |---|---|---|
137
+ | Mặc định (standalone) | `.agent/skills/qc` (bản framework bundle) | **Bị ghi đè** mỗi lần upgrade → đừng sửa trực tiếp ở đây |
138
+ | QC sở hữu skill (khuyến nghị) | repo QC / submodule, vd `qc-base/.claude/skills` | **Không bao giờ bị đụng** — upgrade chỉ rewrite `.agent/` |
139
+
140
+ > `qc_skills_dir` chỉ cần trỏ tới thư mục **chứa các folder `qa-*`**. Cả 2 layout đều hợp lệ:
141
+ > framework bundle (`.agent/skills/qc/qa-analyst/…`) và repo QC (`.claude/skills/qa-analyst/…`).
142
+
143
+ **Cách QC tách skill ra khỏi vòng đời framework:**
144
+
145
+ ```bash
146
+ # 1. Đưa repo skill của QC vào project (submodule để pin version):
147
+ git submodule add <ai-automation-qc-base-repo-url> qc-base
148
+
149
+ # 2. Trỏ qc_skills_dir trong .agent/project-context.yaml:
150
+ # paths:
151
+ # qc_skills_dir: "qc-base/.claude/skills"
152
+
153
+ # 3. Từ giờ: QC hoàn thiện skill trong repo qc-base, bump submodule khi cần.
154
+ # /update-framework ghi đè .agent/ nhưng KHÔNG chạm qc-base/ → skill an toàn.
155
+ ```
156
+
157
+ Nhờ vậy **vòng đời skill QC** và **vòng đời framework** tách hẳn nhau: nâng cấp framework
158
+ không nuốt mất skill đang hoàn thiện, và QC update skill 1 chỗ (repo của họ) cho mọi project.
159
+
160
+ ## Xem Thêm
161
+
162
+ - [Guide › Tester](README.md) — vai trò tester, spec-manifest, `/report-bug`, `/propose-scenario`
163
+ - [Concepts › Traceability](../../03-concepts/traceability.md) — trace TSV, dev_selftest vs qc_status
164
+ - [Reference › Modules](../../05-reference/modules.md) — chi tiết module `qc-playwright`
165
+ - [Reference › Commands](../../05-reference/commands.md) — danh mục đầy đủ mọi command
@@ -0,0 +1,79 @@
1
+ [📚 Docs](../../README.md) › [Guides](../README.md) › [Tester](README.md) › Đọc Spec Chain
2
+
3
+ # Đọc Và Hiểu Spec Chain
4
+
5
+ ## Thứ tự đọc và mục đích
6
+
7
+ | Tài liệu | Đọc để | Ví dụ thực tế |
8
+ |---|---|---|
9
+ | **PRD** | Hiểu WHAT — business requirement | "Sai password 5 lần → khoá 30 phút" |
10
+ | **BDD** | Biết HOW VERIFIED — exact scenarios | `Given 5 failed logins, Then 423 Locked` |
11
+ | **Tech Docs BE** | Biết API contract khi test BE | `POST /api/v1/auth/login`, error codes |
12
+ | **Tech Docs Web** | Biết UI states khi test Web | Screen names, component behaviors |
13
+
14
+ ## Ví dụ đọc spec chain — FT-001 Login
15
+
16
+ Sau khi chạy `/generate-spec-manifest`, tra manifest để lấy paths:
17
+
18
+ ```yaml
19
+ # spec-manifest.yaml
20
+ FT-001:
21
+ prd: "my-project-specs/specs/auth/FT-001-login/prd.md"
22
+ bdd:
23
+ be: "my-project-specs/specs/auth/FT-001-login/bdd/system/FT-001-UC1-login-system.feature"
24
+ web: "my-project-specs/specs/auth/FT-001-login/bdd/web/FT-001-UC1-login-web.feature"
25
+ tech_docs:
26
+ be: "my-project-specs/specs/auth/FT-001-login/tech-docs/FT-001-auth-api.md"
27
+ ```
28
+
29
+ **Bước 1: Đọc PRD** tại `my-project-specs/specs/auth/FT-001-login/prd.md`
30
+ *(nằm trong spec submodule — shared repo của PO)*
31
+
32
+ ```markdown
33
+ # AC trong PRD FT-001:
34
+ AC1: Đăng nhập thành công → truy cập được hệ thống
35
+ AC2: Sai password → hiển thị lỗi, không tiết lộ thông tin user
36
+ AC3: Sai password 5 lần liên tiếp → khoá tài khoản 30 phút
37
+ AC4: Tài khoản bị khoá → thông báo thời gian mở khoá
38
+ ```
39
+
40
+ **Bước 2: Đọc BDD System (cho BE)** tại `my-project-specs/specs/auth/FT-001-login/bdd/system/FT-001-UC1-login-system.feature`
41
+ *(nằm trong spec submodule — PO gen, chứa contract BE phải đáp ứng; tất cả BDD web/app/system đều ở spec repo)*
42
+
43
+ ```gherkin
44
+ Scenario: Successful login
45
+ Given user "alice@example.com" exists
46
+ When POST /api/v1/auth/login {"email": "alice@...", "password": "correct"}
47
+ Then status 200, body has access_token and refresh_token
48
+
49
+ Scenario: Lock after 5 failures
50
+ Given user has 0 failed attempts
51
+ When login with wrong password 5 times
52
+ Then 5th attempt returns 423
53
+ And response has retry_after: 1800
54
+ ```
55
+
56
+ **Bước 3: Đọc Tech Docs BE** tại `my-project-specs/specs/auth/FT-001-login/tech-docs/FT-001-auth-api.md`
57
+ *(nằm trong spec submodule — Dev gen, SA sign-off, đây là API contract chính thức)*
58
+
59
+ ```markdown
60
+ # Auth API — Error Codes
61
+ 401 — sai password (failed_attempts < 5)
62
+ 423 — tài khoản bị khoá (retry_after tính bằng giây)
63
+ 404 — email không tồn tại (không phân biệt với 401 — security)
64
+
65
+ # Headers bắt buộc
66
+ Authorization: Bearer {token}
67
+ X-Request-ID: uuid (optional, dùng để trace)
68
+ ```
69
+
70
+ **Kết quả: tester biết cần test:**
71
+ - `POST /auth/login` với đúng credentials → 200 + token
72
+ - `POST /auth/login` với sai password → 401 (message không reveal user exists/not)
73
+ - 5 lần sai → 423 + `retry_after: 1800`
74
+ - Email không tồn tại → 404 (message = 401 message — security by design)
75
+ - Sau 30 phút → có thể login lại
76
+
77
+ ---
78
+
79
+ ← [Workflow](workflow.md) · Tiếp theo: [Tình huống thực tế](scenarios.md)
@@ -0,0 +1,186 @@
1
+ [📚 Docs](../../README.md) › [Guides](../README.md) › [Tester](README.md) › Tình huống thực tế
2
+
3
+ # Tình Huống Thực Tế
4
+
5
+ ## Tình huống 1: Test feature mới được assign
6
+
7
+ **Bối cảnh:** PO thông báo FT-042 Checkout đã approved.
8
+
9
+ ```bash
10
+ # 1. Cập nhật repo
11
+ git pull && git submodule update --remote --recursive
12
+
13
+ # 2. Refresh manifest
14
+ /generate-spec-manifest
15
+
16
+ # 3. Kiểm tra status
17
+ # FT-042:
18
+ # status: approved ← ✅ có thể test
19
+ # prd: "specs/payment/FT-042-checkout/prd.md"
20
+ # bdd:
21
+ # be: "free-trial-specs/specs/payment/FT-042-checkout/bdd/system/FT-042-UC1-checkout-system.feature"
22
+ # web: "free-trial-specs/specs/payment/FT-042-checkout/bdd/web/FT-042-UC1-checkout-web.feature"
23
+ ```
24
+
25
+ **Test plan từ BDD BE (7 scenarios):**
26
+
27
+ | # | Scenario | Input | Expected |
28
+ |---|---|---|---|
29
+ | 1 | Checkout thành công | Cart đủ hàng, card valid | 201 + order_id |
30
+ | 2 | Cart rỗng | Không có items | 400 EMPTY_CART |
31
+ | 3 | Hết hàng | item_id đã sold out | 409 OUT_OF_STOCK |
32
+ | 4 | Card bị từ chối | card number test declined | 402 PAYMENT_DECLINED |
33
+ | 5 | Timeout payment gateway | mock timeout | 504 + order status PENDING |
34
+ | 6 | Giới hạn thanh toán | amount > 10,000,000 VND | 400 LIMIT_EXCEEDED |
35
+ | 7 | Session hết hạn | expired token | 401 UNAUTHORIZED |
36
+
37
+ ---
38
+
39
+ ## Tình huống 2: PRD thay đổi giữa sprint
40
+
41
+ **Bối cảnh:** Đang test FT-042 thì PO update PRD v1.0 → v1.1 (giới hạn từ 5tr → 10tr).
42
+
43
+ ```bash
44
+ git pull && git submodule update --remote --recursive
45
+ /generate-spec-manifest
46
+ # spec-manifest.yaml: FT-042 prd_version: "1.1"
47
+ # FT-042 Changelog:
48
+ # v1.1 | 2026-06-05 | BR7: payment limit thay đổi 5,000,000 → 10,000,000
49
+ ```
50
+
51
+ **Cập nhật test case:**
52
+ ```
53
+ Test case 6 cũ: amount > 5,000,000 → 400 LIMIT_EXCEEDED ← STALE
54
+ Test case 6 mới: amount > 10,000,000 → 400 LIMIT_EXCEEDED ← theo v1.1
55
+
56
+ Thêm test case mới:
57
+ Test case 6b: amount = 9,999,999 → 201 OK (boundary case — giờ pass)
58
+ Test case 6c: amount = 10,000,001 → 400 LIMIT_EXCEEDED
59
+ ```
60
+
61
+ > Nếu Dev chưa update code theo v1.1 → test fail vì code vẫn dùng limit 5tr → báo Dev, không phải bug.
62
+
63
+ ---
64
+
65
+ ## Tình huống 3: Test BE và Web cùng 1 feature
66
+
67
+ **Bối cảnh:** FT-001 Login có BDD cho cả BE (API) và Web (UI).
68
+
69
+ **BE test** — đọc `bdd.be` (System BDD) + `tech_docs.be`:
70
+
71
+ ```
72
+ Endpoint: POST /api/v1/auth/login
73
+ Test tool: Postman / k6 / Jest supertest
74
+
75
+ Test cases từ BDD System (cho BE):
76
+ ✅ SC1: Valid credentials → 200 + JWT
77
+ ✅ SC2: Wrong password → 401 (message generic)
78
+ ✅ SC3: 5 failures → 423 + retry_after
79
+ ✅ SC4: Locked account → 423
80
+ ✅ SC5: Email không tồn tại → 404 (message = 401 message)
81
+ ```
82
+
83
+ **Web test** — đọc `bdd.web` + `tech_docs.web`:
84
+
85
+ ```
86
+ Tool: Playwright
87
+
88
+ Test cases từ BDD Web:
89
+ ✅ SC1: Điền đúng → redirect dashboard
90
+ ✅ SC2: Sai password → toast error, password cleared
91
+ ✅ SC3: 5 lần sai → form disabled + countdown timer
92
+ ✅ SC4: "Quên mật khẩu?" link visible sau 3 lần sai
93
+ ✅ SC5: Session expired → redirect về login với message
94
+ ```
95
+
96
+ **Cross-check quan trọng:** BE trả `retry_after: 1800` → Web hiển thị countdown `29:59`. Nếu Web không đọc đúng header → bug.
97
+
98
+ ---
99
+
100
+ ## Tình huống 4: Feature chưa có BDD
101
+
102
+ **Manifest báo:**
103
+ ```
104
+ ⚠️ 1 PRDs with no matching BDD:
105
+ - FT-055 (notification) — run /generate-bdd first
106
+ ```
107
+
108
+ **Xử lý:**
109
+ ```
110
+ Không tự gen BDD — đó là việc của Dev.
111
+
112
+ 1. PRD có status: approved nhưng chưa có BDD → báo Dev lead
113
+ PRD còn draft → chờ PO approve trước
114
+
115
+ 2. Nếu bị yêu cầu test mà chưa có BDD:
116
+ → Test dựa trên PRD AC trực tiếp
117
+ → Ghi chú rõ trong test report: "Tested against PRD AC, no BDD available"
118
+ → Không thể trace chi tiết → coverage thấp hơn
119
+
120
+ 3. Sau khi Dev gen BDD → refresh manifest → test lại đầy đủ
121
+ ```
122
+
123
+ ---
124
+
125
+ ## Tình huống 5: Regression testing sau merge lớn
126
+
127
+ **Bối cảnh:** Dev merge refactor module Auth (đổi tên `AuthService` → `IdentityService`).
128
+
129
+ ```bash
130
+ git pull && git submodule update --remote --recursive
131
+ /generate-spec-manifest
132
+ ```
133
+
134
+ **Xác định scope regression từ spec-manifest:**
135
+
136
+ ```
137
+ 1. Domain bị ảnh hưởng: auth
138
+ 2. Tất cả features có domain: auth:
139
+ - FT-001 (login), FT-003 (register), FT-007 (password reset), FT-012 (2FA)
140
+
141
+ 3. Features khác có @trace.module: IdentityService:
142
+ → Grep trong tech_docs: "IdentityService"
143
+ → FT-019 (profile) cũng phụ thuộc vào IdentityService
144
+
145
+ Regression scope: FT-001, FT-003, FT-007, FT-012, FT-019
146
+ ```
147
+
148
+ ---
149
+
150
+ ## Tình huống 6: Test feature multi-service (BE + Web + App)
151
+
152
+ **Bối cảnh:** FT-042 Checkout có cả BE API, Web UI, và App UI.
153
+
154
+ ```yaml
155
+ FT-042:
156
+ domain: payment
157
+ status: approved
158
+ bdd:
159
+ be: "free-trial-specs/specs/payment/FT-042-checkout/bdd/system/FT-042-UC1-checkout-system.feature"
160
+ web: "free-trial-specs/specs/payment/FT-042-checkout/bdd/web/FT-042-UC1-checkout-web.feature"
161
+ app: "free-trial-specs/specs/payment/FT-042-checkout/bdd/app/FT-042-UC1-checkout-app.feature"
162
+ ```
163
+
164
+ **Test strategy:**
165
+
166
+ ```
167
+ Layer 1 — BE API:
168
+ → Test /api/v1/checkout endpoint isolated
169
+ → Tool: Postman hoặc Jest supertest
170
+
171
+ Layer 2 — Web E2E:
172
+ → Tool: Playwright
173
+ → Flow: Cart → Checkout page → Payment form → Order confirmation
174
+
175
+ Layer 3 — App E2E:
176
+ → Tool: Maestro / Detox
177
+ → Flow: Cart screen → Checkout → Payment → Success screen
178
+
179
+ Layer 4 — Cross-layer:
180
+ → Web checkout → kiểm tra order trong BE database
181
+ → App checkout → cùng order visible trong Web dashboard
182
+ ```
183
+
184
+ ---
185
+
186
+ ← [Đọc Spec Chain](reading-specs.md) · Tiếp theo: [Báo cáo bug](bug-reporting.md)
@@ -0,0 +1,130 @@
1
+ [📚 Docs](../../README.md) › [Guides](../README.md) › [Tester](README.md) › Spec Manifest & Setup
2
+
3
+ # Spec Manifest & Setup
4
+
5
+ ## Spec-Manifest Là Gì Và Tại Sao Cần
6
+
7
+ Trong umbrella repo (có `spec_source`), **mọi spec đều nằm trong spec submodule** — gom theo feature-package: mỗi PRD có một thư mục `specs/{domain}/{prd-slug}/` chứa tất cả artifact (`prd.md`, `bdd/{platform}/`, `tech-docs/`, `design-spec/`), trải trên nhiều domain:
8
+
9
+ ```
10
+ free-trial-umbrella/ ← umbrella (Claude Code mở ở đây)
11
+ ├── free-trial-specs/ ← SPEC submodule — TẤT CẢ spec ở đây
12
+ │ └── specs/
13
+ │ └── auth/FT-001-login/ ← feature-package (1 PRD = 1 thư mục)
14
+ │ ├── prd.md ← PRD
15
+ │ ├── design-spec/... ← Design Spec
16
+ │ ├── bdd/system/... ← BDD System (BE)
17
+ │ ├── bdd/web/... ← BDD Web (FE)
18
+ │ ├── bdd/app/... ← BDD App
19
+ │ └── tech-docs/... ← Tech Docs (BE contract + FE design)
20
+ ├── free-trial-be/ (chỉ code) ← SERVICE submodule
21
+ └── free-trial-web/ (chỉ code) ← SERVICE submodule
22
+ ```
23
+
24
+ Tester's agent không biết domain nào / file nào ứng với TICKET-ID → cần một **index file** để tra cứu. *(Chỉ khi KHÔNG có `spec_source` thì BDD mới rải theo từng service submodule.)*
25
+
26
+ `spec-manifest.yaml` là file được gen tự động, ánh xạ TICKET-ID → tất cả file liên quan:
27
+
28
+ ```yaml
29
+ features:
30
+ FT-001:
31
+ domain: auth
32
+ status: approved
33
+ prd: "specs/auth/FT-001-login/prd.md"
34
+ pdd: "specs/product-definition/auth/FT-001-def.md"
35
+ tech_docs:
36
+ be: "free-trial-specs/specs/auth/FT-001-login/tech-docs/FT-001-UC1-auth-api.md"
37
+ web: "free-trial-specs/specs/auth/FT-001-login/tech-docs/FT-001-UC1-login-web.md"
38
+ bdd:
39
+ be: "free-trial-specs/specs/auth/FT-001-login/bdd/system/FT-001-UC1-login-system.feature"
40
+ web: "free-trial-specs/specs/auth/FT-001-login/bdd/web/FT-001-UC1-login-web.feature"
41
+ ```
42
+
43
+ **Quan trọng:**
44
+ - File này **không commit vào git** (gitignored) — gen local mỗi khi cần
45
+ - Luôn `git pull` trước khi gen để có submodule mới nhất
46
+ - Chỉ test các feature có `status: approved` — draft PRD chưa được approve
47
+ - Nếu nhiều người gen cùng lúc → kết quả **giống nhau** (deterministic) — không conflict
48
+ - Khi PO cập nhật PRD hoặc BDD → re-run `/generate-spec-manifest` để manifest phản ánh nội dung mới
49
+
50
+ ## Setup Tester Agent
51
+
52
+ ### Lần đầu tiên
53
+
54
+ ```bash
55
+ # 1. Clone umbrella repo (nếu chưa có)
56
+ git clone {umbrella-repo-url} free-trial-spec
57
+ cd free-trial-spec
58
+
59
+ # 2. Init tất cả submodules
60
+ git submodule update --init --recursive
61
+
62
+ # 3. Mở Claude Code tại umbrella root
63
+ # QUAN TRỌNG: mở tại free-trial-spec/, không phải free-trial-tests/
64
+ ```
65
+
66
+ ### Trước mỗi test sprint
67
+
68
+ ```bash
69
+ # Cập nhật tất cả submodules về commit mới nhất
70
+ git pull
71
+ git submodule update --remote --recursive
72
+
73
+ # Gen manifest
74
+ /generate-spec-manifest
75
+ # → viết spec-manifest.yaml tại free-trial-spec/ root
76
+ ```
77
+
78
+ ### Cấu hình tester agent đọc manifest
79
+
80
+ Trong tester's agent config (hoặc system prompt), thêm:
81
+
82
+ ```
83
+ Trước khi test bất kỳ feature nào:
84
+ 1. Đọc spec-manifest.yaml tại project root
85
+ 2. Lookup TICKET-ID → lấy paths của prd, bdd, tech_docs
86
+ 3. Chỉ test features có status: approved
87
+ 4. Đọc PRD trước để hiểu business context
88
+ 5. Đọc BDD để biết scenarios cần cover
89
+ ```
90
+
91
+ ## Living Docs Panel (umbrella mode)
92
+
93
+ Khi làm việc với umbrella repo, VS Code Living Docs panel cần được đồng bộ trước khi xem (chạy `/sync` hoặc `/validate-traces`).
94
+
95
+ **Report canonical (Living Docs):** `{spec_source}/.living-docs/trace-report.json` + bản mirror TSV — nằm trong **spec module** (gitignored, regenerate mỗi lần `/sync` hoặc `/validate-traces`).
96
+
97
+ **Panel mirror:** `./.trace` của workspace hiện tại — giữ panel **không bị trống** kể cả khi mở Claude Code bên trong một service submodule đơn lẻ.
98
+
99
+ ```bash
100
+ # Chạy sau mỗi codegen session — hoặc khi cần refresh trạng thái coverage
101
+ /sync # hoặc /validate-traces
102
+
103
+ # → Đọc TSVs từ MỘT chỗ: {spec_source}/.trace/ (mỗi scenario mang @trace.service)
104
+ # → Ghi canonical: {spec_source}/.living-docs/trace-report.json (+ TSV mirror)
105
+ # → Ghi panel mirror: ./.trace (workspace hiện tại — panel luôn có data)
106
+ # → Panel cập nhật ngay sau khi lệnh hoàn tất
107
+ ```
108
+
109
+ Panel hiển thị trạng thái cross-service:
110
+
111
+ | Cột | Ý nghĩa |
112
+ |-----|---------|
113
+ | PRDs | Số PRD đã approve / tổng |
114
+ | UCs | Số Use Cases đã implement |
115
+ | Code Cov. | % scenarios có code |
116
+ | Test Cov. | % scenarios có test |
117
+ | DRIFT | Spec thay đổi sau khi gen code |
118
+ | GAP | Code có nhưng chưa có test |
119
+ | dev_selftest | Dev đã chạy self-check: `pass` / `fail` / `not_run` |
120
+ | qc_status | Kết quả QC chính thức: `pass` / `fail` / `skip` / `not_run` |
121
+
122
+ > **`dev_selftest`:** tín hiệu cho QC thấy dev đã tự chạy self-check. **Không phải** coverage chính thức — đó là `qc_status`.
123
+ >
124
+ > **`qc_status`:** kết quả pipeline QC chính thức (`/qc-run-test`). Dashboard hiển thị hai cột cạnh nhau để phân biệt rõ hai luồng.
125
+
126
+ > **Prerequisite:** umbrella cần `setup.spec_source` trỏ đúng spec submodule → trace TSV authoritative dồn về `{spec_source}/.trace/`. Nếu thiếu → panel trống → báo Dev team. (Chỉ chế độ không có `spec_source` mới cần `paths.trace_dir` per-service.)
127
+
128
+ ---
129
+
130
+ ← [Tester Guide](README.md) · Tiếp theo: [Workflow](workflow.md)