@longph2102/v-flow 1.5.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 (247) hide show
  1. package/AGENTS.md +265 -0
  2. package/CHANGELOG.md +318 -0
  3. package/LICENSE +21 -0
  4. package/README.md +326 -0
  5. package/agents/ba-agent.md +437 -0
  6. package/agents/ba-critic-agent.md +156 -0
  7. package/agents/ba-to-ptyc-agent.md +112 -0
  8. package/agents/bugfix-analyst-agent.md +221 -0
  9. package/agents/constitute-agent.md +155 -0
  10. package/agents/help-agent.md +168 -0
  11. package/agents/implement-agent.md +220 -0
  12. package/agents/import-ba-docs-agent.md +164 -0
  13. package/agents/master-check-agent.md +228 -0
  14. package/agents/metrics-agent.md +180 -0
  15. package/agents/operations-agent.md +123 -0
  16. package/agents/plan-agent.md +218 -0
  17. package/agents/prototype-agent.md +191 -0
  18. package/agents/retrospective-agent.md +196 -0
  19. package/agents/review-agent.md +210 -0
  20. package/agents/sprint-agent.md +191 -0
  21. package/agents/status-agent.md +186 -0
  22. package/agents/sync-agent.md +201 -0
  23. package/agents/test-agent.md +166 -0
  24. package/agents/understand-agent.md +339 -0
  25. package/cli/commands/check.js +96 -0
  26. package/cli/commands/dev-quiz.js +107 -0
  27. package/cli/commands/doctor.js +348 -0
  28. package/cli/commands/feature.js +259 -0
  29. package/cli/commands/hooks.js +163 -0
  30. package/cli/commands/init.js +189 -0
  31. package/cli/commands/log.js +199 -0
  32. package/cli/commands/plugin.js +230 -0
  33. package/cli/commands/score-card.js +203 -0
  34. package/cli/commands/status.js +269 -0
  35. package/cli/commands/sync.js +59 -0
  36. package/cli/commands/upgrade.js +150 -0
  37. package/cli/commands/validate.js +1259 -0
  38. package/cli/commands/watch.js +151 -0
  39. package/cli/index.js +46 -0
  40. package/cli/lib/ac-test-gate.js +89 -0
  41. package/cli/lib/activity-log.js +209 -0
  42. package/cli/lib/cli-error.js +183 -0
  43. package/cli/lib/constitution-lint.js +561 -0
  44. package/cli/lib/dev-quiz-grade.js +127 -0
  45. package/cli/lib/governance.js +78 -0
  46. package/cli/lib/hook-targets.js +167 -0
  47. package/cli/lib/i18n.js +375 -0
  48. package/cli/lib/knowledge-oracle.js +379 -0
  49. package/cli/lib/logger.js +203 -0
  50. package/cli/lib/module-card-lint.js +304 -0
  51. package/cli/lib/module-card-score.js +223 -0
  52. package/cli/lib/plugins.js +481 -0
  53. package/cli/lib/scanner.js +692 -0
  54. package/cli/lib/sync-core.js +232 -0
  55. package/cli/lib/sync-targets.js +84 -0
  56. package/cli/lib/templates.js +268 -0
  57. package/cli/lib/yaml-parser.js +203 -0
  58. package/commands/v.ba-critic.md +101 -0
  59. package/commands/v.ba-to-ptyc.md +71 -0
  60. package/commands/v.bugfix.md +86 -0
  61. package/commands/v.check.md +131 -0
  62. package/commands/v.constitute.md +87 -0
  63. package/commands/v.constitution.md +84 -0
  64. package/commands/v.fork.md +127 -0
  65. package/commands/v.help.md +73 -0
  66. package/commands/v.hotfix.md +200 -0
  67. package/commands/v.implement.md +92 -0
  68. package/commands/v.import-ba-docs.md +222 -0
  69. package/commands/v.metrics.md +74 -0
  70. package/commands/v.operations.md +70 -0
  71. package/commands/v.plan.md +78 -0
  72. package/commands/v.prototype.md +121 -0
  73. package/commands/v.quickfix.md +169 -0
  74. package/commands/v.retrospective.md +80 -0
  75. package/commands/v.review.md +78 -0
  76. package/commands/v.rewind.md +127 -0
  77. package/commands/v.specify.md +118 -0
  78. package/commands/v.sprint.md +75 -0
  79. package/commands/v.status.md +62 -0
  80. package/commands/v.sync.md +81 -0
  81. package/commands/v.test.md +67 -0
  82. package/commands/v.understand.md +112 -0
  83. package/package.json +65 -0
  84. package/skills/_shared/constitution-reader/SKILL.md +109 -0
  85. package/skills/_shared/constitution-reader/config.json +52 -0
  86. package/skills/_shared/constitution-reader/examples/good/b1-phase-output.md +48 -0
  87. package/skills/_shared/constitution-reader/gotchas.md +46 -0
  88. package/skills/_shared/context-reader/SKILL.md +111 -0
  89. package/skills/_shared/context-reader/config.json +54 -0
  90. package/skills/_shared/context-reader/examples/good/legacy-nodejs-output.md +35 -0
  91. package/skills/_shared/context-reader/gotchas.md +49 -0
  92. package/skills/_shared/ears-notation/SKILL.md +63 -0
  93. package/skills/_shared/ears-notation/config.json +55 -0
  94. package/skills/_shared/ears-notation/examples/good/plan-test-interpretation.md +29 -0
  95. package/skills/_shared/ears-notation/gotchas.md +43 -0
  96. package/skills/check/cross-validator/SKILL.md +206 -0
  97. package/skills/check/cross-validator/config.json +33 -0
  98. package/skills/check/cross-validator/examples/good/validation-report-pass-with-concerns.md +105 -0
  99. package/skills/check/cross-validator/gotchas.md +43 -0
  100. package/skills/implement/constitution-enforcer/SKILL.md +134 -0
  101. package/skills/implement/constitution-enforcer/config.json +16 -0
  102. package/skills/implement/constitution-enforcer/examples/bad/vague-report.md +42 -0
  103. package/skills/implement/constitution-enforcer/examples/good/compliance-report.md +57 -0
  104. package/skills/implement/constitution-enforcer/gotchas.md +26 -0
  105. package/skills/implement/constitution-enforcer/scripts/check-constitution.sh +88 -0
  106. package/skills/implement/no-go-zone-guard/SKILL.md +173 -0
  107. package/skills/implement/no-go-zone-guard/config.json +28 -0
  108. package/skills/implement/no-go-zone-guard/examples/good/adapter-workaround.md +46 -0
  109. package/skills/implement/no-go-zone-guard/gotchas.md +27 -0
  110. package/skills/implement/no-go-zone-guard/scripts/check-nogo-zones.sh +148 -0
  111. package/skills/implement/no-go-zone-guard/scripts/nogo-precommit.sh +96 -0
  112. package/skills/implement/tdd-driver/SKILL.md +159 -0
  113. package/skills/implement/tdd-driver/config.json +33 -0
  114. package/skills/implement/tdd-driver/examples/good/tdd-cycle-product-repo.md +81 -0
  115. package/skills/implement/tdd-driver/gotchas.md +34 -0
  116. package/skills/metrics/metrics-collector/SKILL.md +133 -0
  117. package/skills/metrics/metrics-collector/config.json +16 -0
  118. package/skills/metrics/metrics-collector/examples/bad/incomplete-report.md +48 -0
  119. package/skills/metrics/metrics-collector/examples/good/full-metrics-report.md +101 -0
  120. package/skills/metrics/metrics-collector/gotchas.md +26 -0
  121. package/skills/operations/incident-runbook/SKILL.md +167 -0
  122. package/skills/operations/incident-runbook/config.json +21 -0
  123. package/skills/operations/incident-runbook/examples/bad/vague-incident-report.md +48 -0
  124. package/skills/operations/incident-runbook/examples/good/p1-hotfix-response.md +119 -0
  125. package/skills/operations/incident-runbook/gotchas.md +26 -0
  126. package/skills/plan/architecture-designer/SKILL.md +228 -0
  127. package/skills/plan/architecture-designer/config.json +32 -0
  128. package/skills/plan/architecture-designer/examples/bad/vague-plan.md +62 -0
  129. package/skills/plan/architecture-designer/examples/good/expand-contract-migration.md +56 -0
  130. package/skills/plan/architecture-designer/examples/good/plan-structure.md +58 -0
  131. package/skills/plan/architecture-designer/gotchas.md +45 -0
  132. package/skills/plan/task-breakdown/SKILL.md +208 -0
  133. package/skills/plan/task-breakdown/config.json +26 -0
  134. package/skills/plan/task-breakdown/examples/bad/vague-tasks.md +77 -0
  135. package/skills/plan/task-breakdown/examples/good/spike-clarify-tasks.md +66 -0
  136. package/skills/plan/task-breakdown/examples/good/tasks-login-feature.md +111 -0
  137. package/skills/plan/task-breakdown/gotchas.md +39 -0
  138. package/skills/prototype/LOGIC.md +240 -0
  139. package/skills/prototype/SKILL.md +185 -0
  140. package/skills/prototype/UI.md +407 -0
  141. package/skills/prototype/config.json +104 -0
  142. package/skills/prototype/examples/bad/prototype-notes.md +68 -0
  143. package/skills/prototype/examples/good/prototype-notes-ui.md +109 -0
  144. package/skills/prototype/examples/good/prototype-notes.md +67 -0
  145. package/skills/prototype/gotchas.md +128 -0
  146. package/skills/prototype/scripts/check-flow-state.ps1 +112 -0
  147. package/skills/prototype/scripts/check-flow-state.sh +104 -0
  148. package/skills/prototype/scripts/check-prototype-cleanup.ps1 +124 -0
  149. package/skills/prototype/scripts/check-prototype-cleanup.sh +109 -0
  150. package/skills/prototype/scripts/check-prototype-notes.ps1 +107 -0
  151. package/skills/prototype/scripts/check-prototype-notes.sh +102 -0
  152. package/skills/review/adversarial-reviewer/SKILL.md +137 -0
  153. package/skills/review/adversarial-reviewer/config.json +32 -0
  154. package/skills/review/adversarial-reviewer/examples/good/review-report-template.md +56 -0
  155. package/skills/review/adversarial-reviewer/gotchas.md +46 -0
  156. package/skills/review/adversarial-reviewer/scripts/quick-security-scan.sh +52 -0
  157. package/skills/specify/ba-bpmn-doc-gen/SKILL.md +108 -0
  158. package/skills/specify/ba-bpmn-doc-gen/reference/reference-bpmn-generation.md +528 -0
  159. package/skills/specify/ba-bpmn-doc-gen/reference/reference-drawio-flowchart.md +466 -0
  160. package/skills/specify/ba-critic/SKILL.md +172 -0
  161. package/skills/specify/ba-critic/config.json +32 -0
  162. package/skills/specify/ba-critic/examples/good/critic-report-round1.md +51 -0
  163. package/skills/specify/ba-critic/gotchas.md +40 -0
  164. package/skills/specify/ba-critic/scripts/check-spec-quality.sh +72 -0
  165. package/skills/specify/ba-doc-generator/SKILL.md +102 -0
  166. package/skills/specify/ba-doc-generator/references/template-clevel.md +84 -0
  167. package/skills/specify/ba-doc-generator/references/template-compliance.md +83 -0
  168. package/skills/specify/ba-doc-generator/references/template-dev.md +138 -0
  169. package/skills/specify/ba-doc-generator/references/template-partner.md +167 -0
  170. package/skills/specify/ba-doc-generator/references/template-pm.md +92 -0
  171. package/skills/specify/ba-doc-generator/references/template-review.md +114 -0
  172. package/skills/specify/ba-doc-generator/references/template-tester.md +108 -0
  173. package/skills/specify/ba-doc-generator/references/template-user.md +98 -0
  174. package/skills/specify/bugfix-analyst/SKILL.md +296 -0
  175. package/skills/specify/bugfix-analyst/config.json +41 -0
  176. package/skills/specify/bugfix-analyst/examples/bad/common-mistakes.md +71 -0
  177. package/skills/specify/bugfix-analyst/examples/good/email-validation-bugfix.md +53 -0
  178. package/skills/specify/bugfix-analyst/gotchas.md +51 -0
  179. package/skills/specify/ears-writer/SKILL.md +129 -0
  180. package/skills/specify/ears-writer/config.json +20 -0
  181. package/skills/specify/ears-writer/examples/bad/common-mistakes.md +17 -0
  182. package/skills/specify/ears-writer/examples/good/login-requirements.md +41 -0
  183. package/skills/specify/ears-writer/gotchas.md +43 -0
  184. package/skills/specify/ears-writer/scripts/check-ears-compliance.sh +51 -0
  185. package/skills/test/test-case-generator/SKILL.md +161 -0
  186. package/skills/test/test-case-generator/config.json +33 -0
  187. package/skills/test/test-case-generator/examples/good/test-cases-login.md +104 -0
  188. package/skills/test/test-case-generator/gotchas.md +43 -0
  189. package/skills/understand/ba-docs-scanner/SKILL.md +239 -0
  190. package/skills/understand/ba-docs-scanner/config.json +47 -0
  191. package/skills/understand/ba-docs-scanner/examples/good/work-order-br-extract.md +28 -0
  192. package/skills/understand/ba-docs-scanner/gotchas.md +44 -0
  193. package/skills/understand/ba-docs-scanner/merge-rules.md +47 -0
  194. package/skills/understand/codebase-scanner/SKILL.md +260 -0
  195. package/skills/understand/codebase-scanner/config.json +56 -0
  196. package/skills/understand/codebase-scanner/examples/good/menu-module-output.md +44 -0
  197. package/skills/understand/codebase-scanner/gotchas.md +42 -0
  198. package/skills/understand/codebase-scanner/scripts/scan-project-structure.sh +64 -0
  199. package/templates/DESIGN.md +456 -0
  200. package/templates/agent-command-template.yaml +240 -0
  201. package/templates/agent-config-template.md +170 -0
  202. package/templates/agent-definition-template.md +145 -0
  203. package/templates/agent-metrics-template.md +150 -0
  204. package/templates/api-contract-template.md +72 -0
  205. package/templates/bugfix-report-template.md +195 -0
  206. package/templates/bugfix-spec-template.md +134 -0
  207. package/templates/code-review-report-template.md +119 -0
  208. package/templates/constitution-template.md +234 -0
  209. package/templates/context-template.md +94 -0
  210. package/templates/data-model-template.md +95 -0
  211. package/templates/decision-log-template.md +92 -0
  212. package/templates/flow-state-template.yaml +208 -0
  213. package/templates/github/workflows/v-flow-validate.yml +30 -0
  214. package/templates/knowledge/adr-template.md +70 -0
  215. package/templates/knowledge/api-contract-template.md +140 -0
  216. package/templates/knowledge/domain-glossary.md +29 -0
  217. package/templates/knowledge/golden-tests-readme.md +115 -0
  218. package/templates/knowledge/lessons-learned.md +41 -0
  219. package/templates/knowledge/patterns.md +103 -0
  220. package/templates/module-card/SKILL.md +85 -0
  221. package/templates/module-card/api-specs.md +96 -0
  222. package/templates/module-card/business-quiz.md +119 -0
  223. package/templates/module-card/cross-service.md +125 -0
  224. package/templates/module-card/db.md +85 -0
  225. package/templates/module-card/dev-quiz.md +62 -0
  226. package/templates/module-card/permissions.md +83 -0
  227. package/templates/module-card/state-diagram.md +64 -0
  228. package/templates/module-card/tech-context.md +90 -0
  229. package/templates/module-card/ui-flows.md +91 -0
  230. package/templates/module-card/use-cases.md +142 -0
  231. package/templates/module-template.yaml +161 -0
  232. package/templates/operations-report-template.md +108 -0
  233. package/templates/plan-template.md +308 -0
  234. package/templates/prototype-notes-template.md +116 -0
  235. package/templates/ptyc/PTYC.template.docx +0 -0
  236. package/templates/ptyc/ptyc.meta.example.yaml +44 -0
  237. package/templates/retrospective-report-template.md +136 -0
  238. package/templates/security-review-template.md +84 -0
  239. package/templates/session-template.md +167 -0
  240. package/templates/spec-review-log-template.md +75 -0
  241. package/templates/spec-template.md +229 -0
  242. package/templates/sprint-status-template.md +101 -0
  243. package/templates/tasks-template.md +275 -0
  244. package/templates/test-cases-template.md +124 -0
  245. package/templates/ux-checklist-template.md +79 -0
  246. package/templates/validation-report-template.md +125 -0
  247. package/templates/vflow-config-template.yaml +22 -0
@@ -0,0 +1,308 @@
1
+ # Template: Technical Plan (Kế hoạch kỹ thuật)
2
+
3
+ > Được tạo bởi **Plan Agent** từ Specification
4
+ > Feature: [TÊN FEATURE]
5
+ > Spec Version: [vX.Y]
6
+
7
+ > **Profile** — **Full** (mặc định): điền mọi section áp dụng. **Lite** (feature `quickfix`/`hotfix` trong `.flow-state.yaml`): tối thiểu §1 (tổng quan) + §6 (File Changes) + §3.4 (nếu đụng DB); **bỏ qua** §10 NFR, §11 Observability, §13 Tech Decisions, §3.5 Key Queries. `v-flow validate` tự **nới** các nudge này cho feature lite (không cảnh báo thiếu).
8
+
9
+ ## 1. Tổng quan kiến trúc
10
+
11
+ ### 1.1 Tóm tắt
12
+ <!-- Mô tả tổng quan cách triển khai feature — 3-5 câu -->
13
+
14
+ ### 1.2 Diagram kiến trúc
15
+
16
+ ```mermaid
17
+ graph TB
18
+ subgraph Presentation
19
+ UI[UI Layer]
20
+ end
21
+ subgraph Domain
22
+ UC[Use Cases]
23
+ ENT[Entities]
24
+ end
25
+ subgraph Data
26
+ REPO[Repositories]
27
+ DS[Data Sources]
28
+ end
29
+ UI --> UC
30
+ UC --> ENT
31
+ UC --> REPO
32
+ REPO --> DS
33
+ ```
34
+
35
+ ### 1.3 Components liên quan
36
+
37
+ | Component | Mô tả | Mới/Sửa | REQ mapping |
38
+ |-----------|-------|:-------:|------------|
39
+ | | | Mới / Sửa | REQ-xxx |
40
+
41
+ ---
42
+
43
+ ## 2. Tech Stack & Dependencies
44
+
45
+ ### 2.1 Công nghệ sử dụng
46
+
47
+ | Mục | Lựa chọn | Lý do | Constitution ref |
48
+ |-----|---------|-------|:----------------:|
49
+ | Framework | | | §1.1 |
50
+ | Database | | | §1.1 |
51
+ | Libraries | | | — |
52
+
53
+ ### 2.2 Dependencies mới
54
+
55
+ <!-- Libraries, packages cần thêm -->
56
+ - [ ] [package@version] — [lý do] — [impact: bundle size/performance]
57
+
58
+ ---
59
+
60
+ ## 3. Data Model
61
+
62
+ ### 3.1 Entities
63
+
64
+ <!-- Mô tả các entity / table / collection -->
65
+
66
+ ```
67
+ [Entity Name]
68
+ ├── field1: type (required) — [business meaning]
69
+ ├── field2: type (optional) — [business meaning]
70
+ └── field3: type — [business meaning]
71
+ ```
72
+
73
+ ### 3.2 Relationships
74
+
75
+ ```mermaid
76
+ erDiagram
77
+ ENTITY_A ||--o{ ENTITY_B : "has many"
78
+ ENTITY_B }|--|| ENTITY_C : "belongs to"
79
+ ```
80
+
81
+ ### 3.3 State Machine (nếu có)
82
+
83
+ ```mermaid
84
+ stateDiagram-v2
85
+ [*] --> Draft
86
+ Draft --> Active : approve
87
+ Active --> Completed : complete
88
+ Active --> Cancelled : cancel
89
+ ```
90
+
91
+ ### 3.4 Database Migrations (nếu đụng schema)
92
+
93
+ > Phân biệt rõ **bảng MỚI** vs **ALTER bảng hiện có**. Bắt buộc điền khi feature thay đổi schema — để dev biết thêm bảng/cột nào, không phải đoán.
94
+
95
+ | Bảng / Collection | New/ALTER | Cột | Kiểu | Null? | Default | Index / Constraint | REQ |
96
+ |-------------------|:---------:|-----|------|:-----:|---------|--------------------|-----|
97
+ | `users` | ALTER | `last_login_at` | timestamp | ✅ | null | — | REQ-S01 |
98
+ | `audit_log` | NEW | `id`, `user_id`, `action`, `created_at` | — | — | — | PK `id`, idx `user_id` | REQ-O01 |
99
+
100
+ - **DDL thật (up + rollback)** — câu lệnh copy-paste-được để dev KHÔNG phải đoán. DDL là *đặc tả schema* (không phải code logic) nên không vi phạm "plan không chứa code":
101
+
102
+ ```sql
103
+ -- up
104
+ ALTER TABLE users ADD COLUMN last_login_at timestamp NULL;
105
+ CREATE TABLE audit_log (
106
+ id bigserial PRIMARY KEY,
107
+ user_id bigint NOT NULL REFERENCES users(id),
108
+ action text NOT NULL,
109
+ created_at timestamptz NOT NULL DEFAULT now()
110
+ );
111
+ CREATE INDEX idx_audit_log_user_id ON audit_log(user_id);
112
+
113
+ -- down (rollback)
114
+ DROP TABLE audit_log;
115
+ ALTER TABLE users DROP COLUMN last_login_at;
116
+ ```
117
+ > Dùng ORM/migration tool (Prisma, TypeORM, Alembic…)? → ghi lệnh tương đương của tool thay cho SQL thô (vẫn phải có up + down cụ thể).
118
+
119
+ - **Migration file**: `migrations/[YYYYMMDD]_[tên].sql` (hoặc theo ORM/tool của dự án)
120
+ - **Rollback**: [cách hoàn tác — drop column / drop table / down migration]
121
+ - **Data backfill**: [có cần backfill dữ liệu cũ không? cách làm — bỏ trống nếu không]
122
+ - **Breaking change → Expand-Contract** (zero-downtime): nếu ALTER phá tương thích (đổi/bỏ cột, thêm NOT NULL) → tách 3 bước: **(1) Expand** thêm cột mới nullable, ghi cả cũ+mới → **(2) Migrate** backfill + chuyển đọc sang cột mới → **(3) Contract** bỏ cột cũ ở release sau. Mỗi bước là 1 task `[DB]` riêng.
123
+
124
+ ### 3.5 Truy vấn quan trọng (Key Queries)
125
+
126
+ > Cho các truy vấn có **access pattern không hiển nhiên**: filter, join, phân trang, soft-delete, aggregate… Ghi **hình dạng** (bảng / predicate chính / index dùng) để dev biết "đi đường nào" — KHÔNG cần câu SQL hoàn chỉnh (giữ nguyên tắc "plan không chứa code logic"). Bỏ qua nếu chỉ CRUD đơn giản theo khóa chính.
127
+
128
+ | Truy vấn (mục đích) | Bảng | Predicate / Filter chính | Index dùng | Ghi chú |
129
+ |---------------------|------|--------------------------|-----------|---------|
130
+ | Liệt kê bản ghi active (phân trang) | `products` | `WHERE deleted_at IS NULL` + `LIMIT/OFFSET` | `idx_products_deleted_at` | parameterized; KHÔNG string-concat |
131
+ | | | | | |
132
+
133
+ ---
134
+
135
+ ## 4. API Design (nếu có)
136
+
137
+ ### 4.1 Endpoints
138
+
139
+ | Method | Path | New/Sửa | Mô tả | Auth | Request | Response | REQ |
140
+ |--------|------|:-------:|-------|:----:|---------|----------|-----|
141
+ | | | Mới / Sửa | | ✅/❌ | | | REQ-xxx |
142
+
143
+ ### 4.2 Data Contracts (field-level)
144
+
145
+ > Field-level cho request/response — KHÔNG cần đợi `--with-api`. Mỗi field: tên / kiểu / bắt buộc / ràng buộc. Lặp block cho mỗi endpoint cần chi tiết. Contract-first (FE+BE) → đóng băng ở `contracts/api-contract.md`.
146
+
147
+ **`POST /api/x` — Request**
148
+
149
+ | Field | Kiểu | Bắt buộc | Ràng buộc |
150
+ |-------|------|:--------:|-----------|
151
+ | `email` | string | ✅ | định dạng email |
152
+ | `password` | string | ✅ | ≥ 8 ký tự |
153
+
154
+ **Response 200**
155
+
156
+ | Field | Kiểu | Ghi chú |
157
+ |-------|------|---------|
158
+ | `token` | string | JWT access token |
159
+ | `expiresIn` | number | giây |
160
+
161
+ ### 4.3 Error Codes
162
+
163
+ | Code | HTTP | Mô tả | Khi nào |
164
+ |------|:----:|-------|--------|
165
+ | | | | |
166
+
167
+ ### 4.4 Thay đổi Contract (nếu SỬA API hiện có)
168
+
169
+ > Khi sửa endpoint đã tồn tại — ghi rõ field thêm/đổi/bỏ và tính tương thích ngược.
170
+
171
+ | Endpoint | Field | Thay đổi | Trước | Sau | Breaking? |
172
+ |----------|-------|:--------:|-------|-----|:---------:|
173
+ | `POST /api/x` | `status` | Thêm | — | `enum(active,locked)` | Không |
174
+ | | | Thêm/Đổi/Bỏ | | | Có/Không |
175
+
176
+ ---
177
+
178
+ ## 5. UI / Screen Changes (nếu có giao diện)
179
+
180
+ > Lấy từ **"Mô tả màn hình"** trong spec (mỗi `UC-xx`). Ghi rõ màn hình nào tạo mới / sửa, sửa gì, component/widget nào, các trạng thái, và token tham chiếu từ `DESIGN.md`. Để dev không phải hỏi "sửa màn nào".
181
+
182
+ ### 5.1 Danh sách màn hình
183
+
184
+ | Màn hình | UC | New/Sửa | Thay đổi | Component / Widget | Trạng thái (empty/loading/error) | DESIGN token |
185
+ |----------|----|:-------:|----------|---------------------|----------------------------------|--------------|
186
+ | LoginPage | UC-01 | Mới | Form đăng nhập | email field, password field, submit btn | loading, error-401 | `button-primary`, `input-default` |
187
+ | ProductList | UC-03 | Sửa | Thêm cột "Trạng thái" + filter | DataTable, FilterBar | empty, loading | `badge-success`, `badge-error` |
188
+
189
+ ### 5.2 Điều hướng (Navigation flow thay đổi)
190
+
191
+ <!-- Luồng chuyển màn hình mới hoặc bị thay đổi -->
192
+ - `[Màn A]` --(action)--> `[Màn B]`
193
+
194
+ ---
195
+
196
+ ## 6. File Changes
197
+
198
+ ### 6.1 File mới
199
+
200
+ | File path | Mô tả | LOC ước tính | REQ |
201
+ |-----------|-------|:------------:|-----|
202
+ | | | | REQ-xxx |
203
+
204
+ ### 6.2 File sửa đổi
205
+
206
+ > Mỗi dòng phải chỉ rõ **vị trí (hàm/class/widget)** và **hiện trạng → mong muốn** — KHÔNG ghi chung chung "cập nhật logic".
207
+
208
+ | File path | Vị trí (hàm/class) | Loại | Hiện trạng → Mong muốn | Impact | REQ |
209
+ |-----------|--------------------|:----:|------------------------|:------:|-----|
210
+ | `src/auth/service.ts` | `AuthService.login()` | Sửa logic | Trả 200 ngay → validate role trước khi cấp token | Med | REQ-E01 |
211
+ | `lib/ui/product_page.dart` | `ProductPage.build()` | Thêm UI | Chưa có filter → thêm `FilterBar` widget | Low | REQ-S02 |
212
+ | | | Thêm/Sửa/Xóa/Refactor | | Low/Med/High | REQ-xxx |
213
+
214
+ ---
215
+
216
+ ## 7. Rủi ro kỹ thuật
217
+
218
+ | Mã | Rủi ro | Xác suất | Ảnh hưởng | Giải pháp | REQ liên quan |
219
+ |----|--------|:--------:|:---------:|----------|:-------------:|
220
+ | R-01 | | Cao/Trung/Thấp | Cao/Trung/Thấp | | REQ-xxx |
221
+
222
+ > Task gắn `[RISKY]`/`[SPIKE]` nên tham chiếu mã rủi ro (vd `Risk: R-01`) để truy vết hai chiều.
223
+
224
+ ---
225
+
226
+ ## 8. Constitution Compliance Check
227
+
228
+ > Plan Agent tự kiểm tra plan tuân thủ constitution
229
+
230
+ | Nguyên tắc Constitution | Plan tuân thủ? | Ghi chú |
231
+ |------------------------|:--------------:|---------|
232
+ | Architecture pattern (§1) | ✅ / ❌ | |
233
+ | Naming convention (§2) | ✅ / ❌ | |
234
+ | Testing standards (§2.2) | ✅ / ❌ | |
235
+ | API standards (§4) | ✅ / ❌ / N/A | |
236
+
237
+ ---
238
+
239
+ ## 9. No-Go Zone Verification
240
+
241
+ > Nếu legacy project có context.md
242
+
243
+ | No-Go Zone | Plan đụng? | Ghi chú |
244
+ |-----------|:----------:|---------|
245
+ | [zone 1 từ context.md] | ✅ Safe / ❌ Violated | |
246
+
247
+ ---
248
+
249
+ ## 10. Non-Functional Requirements (NFR)
250
+
251
+ > Lấy từ **"Yêu cầu đặc biệt"** của mỗi `UC-xx` trong spec (hiệu năng / bảo mật / khả dụng-a11y / tuân thủ-audit). Mỗi NFR phải có **cách plan đáp ứng** + **task/kiểm chứng** — để không rơi rụng khi implement.
252
+
253
+ | NFR | Loại | Yêu cầu (từ spec) | Cách plan đáp ứng | Verify (task/test) | UC/REQ |
254
+ |-----|------|-------------------|-------------------|--------------------|--------|
255
+ | Hiệu năng | Perf | p95 < 2s | cache + index phù hợp | TC perf budget | UC-01 |
256
+ | Khả dụng | A11y | keyboard + screen reader | semantics/label widget | tiêu chí task `[UI]` | UC-01 |
257
+ | Tuân thủ | Audit | log mọi thao tác ghi | audit interceptor | task `[LOGIC]` | UC-02 |
258
+
259
+ ---
260
+
261
+ ## 11. Observability & Rollout (nếu lên production)
262
+
263
+ > Cho feature chạy thật: làm sao **biết nó hoạt động/đổ vỡ**, và **tung ra an toàn**. Gieo mầm cho Metrics/Operations agent hạ nguồn.
264
+
265
+ - **Feature flag**: [tên cờ + default + cách bật dần]
266
+ - **Metrics cần emit**: [counter / latency p95 / error-rate — tên metric cụ thể]
267
+ - **Logs**: [sự kiện log mức info/error — KHÔNG log dữ liệu nhạy cảm]
268
+ - **Alerts**: [ngưỡng cảnh báo — vd error-rate > 1% trong 5 phút]
269
+ - **Rollout**: [canary / % traffic / điều kiện rollback]
270
+
271
+ ---
272
+
273
+ ## 12. Giả định & Câu hỏi mở (Assumptions & Open Questions)
274
+
275
+ > Gom về **một chỗ** mọi giả định thiết kế và điểm chưa chắc — để Master Check (R.0) và human review thấy ngay, thay vì rải rác trong từng task. Mỗi task `[CLARIFY]` PHẢI có câu hỏi tương ứng ở đây.
276
+
277
+ ### 12.1 Giả định thiết kế (Assumptions)
278
+
279
+ > Điều plan đang **mặc định là đúng** mà chưa được xác nhận. Nếu sai → phải re-plan.
280
+
281
+ | Mã | Giả định | Tác động nếu sai | Cần ai xác nhận |
282
+ |----|----------|------------------|-----------------|
283
+ | A-01 | [VD: API trả 401 cho cả sai mật khẩu lẫn khóa tài khoản] | [phải tách 2 luồng lỗi] | [Backend lead] |
284
+
285
+ ### 12.2 Câu hỏi mở (Open Questions — gom từ task `[CLARIFY]`)
286
+
287
+ > Mỗi dòng map tới task `[CLARIFY]`. Implement Agent KHÔNG được đoán — phải hỏi trước khi code.
288
+
289
+ | Câu hỏi | Task liên quan | Chặn implement? | Người trả lời |
290
+ |---------|----------------|:---------------:|---------------|
291
+ | [VD: Lockout 5 lần theo IP hay theo account?] | T-0xx | ✅ | [Product owner] |
292
+
293
+ ---
294
+
295
+ ## 13. Tech Decisions & Alternatives (Quyết định kỹ thuật)
296
+
297
+ > **WHY** của plan: vì sao chọn cách này, đã **cân nhắc & loại** phương án nào. Để người review và Implement Agent không mở lại tranh luận đã chốt. Mỗi quyết định không tầm thường → 1 dòng.
298
+
299
+ | Mã | Quyết định | Lý do chọn | Phương án đã cân nhắc & loại | Đánh đổi chấp nhận |
300
+ |----|-----------|-----------|------------------------------|--------------------|
301
+ | D-01 | [VD: BLoC cho state mgmt] | constitution §3.2 + dễ test | Provider (ít boilerplate, yếu test), setState (không scale) | nhiều boilerplate hơn |
302
+ | D-02 | | | | |
303
+
304
+ ---
305
+
306
+ > **Trạng thái**: Draft / Reviewed / Approved
307
+ > **Người review**: [Tech Lead]
308
+ > **Ngày review**: [YYYY-MM-DD]
@@ -0,0 +1,116 @@
1
+ # Prototype Notes — [Feature NNN: Feature Name]
2
+
3
+ > **Tạo lúc**: [YYYY-MM-DD HH:MM]
4
+ > **Phase**: S.1.5
5
+ > **Branch**: [LOGIC | UI]
6
+ > **Mode**: [N/A (LOGIC) | from-mockup | explore] _(UI only)_
7
+ > **Sub-shape**: [N/A | A — embedded in /existing-route | B — new route at /prototype/NNN] _(UI explore only)_
8
+ > **Prototype location**: `.v-flow/features/NNN/prototype/`
9
+ > **Render đã chốt**: [`.v-flow/features/NNN/ui/approved/UC-NN.*` | N/A] _(mode=from-mockup)_
10
+
11
+ ---
12
+
13
+ ## Câu hỏi cần trả lời
14
+
15
+ > [Câu hỏi cụ thể mà prototype này được tạo ra để trả lời]
16
+ > Lấy từ spec.md — không phải câu hỏi tổng quát.
17
+
18
+ **Liên quan đến**: [REQ-xxx, REQ-xxx]
19
+
20
+ ---
21
+
22
+ ## Branch: [LOGIC | UI]
23
+
24
+ ### Nhánh chọn vì
25
+
26
+ [Lý do chọn LOGIC hoặc UI branch — behavior/state question vs UI/layout question]
27
+
28
+ ### [LOGIC only] Runtime
29
+
30
+ [Node.js | TypeScript | Bun | Python | Java | Angular — detected from project files]
31
+
32
+ ### [UI explore only] Sub-shape
33
+
34
+ [Sub-shape A (embed trong existing page) | Sub-shape B (new throwaway route)]
35
+ Lý do chọn: [tại sao chọn Sub-shape này?]
36
+
37
+ ### [UI only] Design source
38
+
39
+ [project-root/DESIGN.md | .v-flow/DESIGN.md — file nào được dùng]
40
+
41
+ ### [UI from-mockup] Reproduce — Mockup → Render
42
+
43
+ - **Mockup nguồn**: [`ui/mockups/UC-NN-*.png` — từ PYC/PTYC/Figma]
44
+ - **Mức ràng buộc**: [Định hướng (layout/thành phần/luồng) | Bắt buộc (pixel)]
45
+ - **Render đã chốt**: `ui/approved/UC-NN.*` (GIỮ làm contract — KHÔNG xóa)
46
+ - **Đối chiếu DESIGN.md**: [token nào dùng; có chỗ nào mockup mâu thuẫn design system không?]
47
+
48
+ ---
49
+
50
+ ## Run command
51
+
52
+ ```bash
53
+ # [Exact command user cần chạy — không được thiếu]
54
+ # Ví dụ LOGIC: pnpm prototype:NNN
55
+ # Ví dụ UI HTML: mở index.html trong browser (double-click)
56
+ # Ví dụ UI Angular: ng serve → http://localhost:4200/route?variant=A
57
+ ```
58
+
59
+ ## Kết quả & Verdict
60
+
61
+ ### Verdict: [VALIDATED | REJECTED | INCONCLUSIVE]
62
+
63
+ **Người duyệt**: [Tên + vai trò — VD: `Nguyễn A (BA/PO)`] · **Duyệt lúc**: [YYYY-MM-DD HH:MM]
64
+ > ⚠️ `VALIDATED` BẮT BUỘC ghi người duyệt thật. Thiếu người duyệt → verdict = `INCONCLUSIVE`, KHÔNG được lock `ui/approved/`.
65
+
66
+ ### Kết quả interact (evidence)
67
+
68
+ > Mô tả cụ thể những case đã test — không cụ thể = verdict không đáng tin.
69
+
70
+ - [x] Case 1 — [mô tả và kết quả]
71
+ - [x] Case 2 — [mô tả và kết quả]
72
+ - [ ] Case chưa test — [lý do bỏ qua]
73
+
74
+ **Phát hiện quan trọng**: [key insight — lý do chính dẫn đến verdict]
75
+
76
+ ### Những gì đã học được
77
+
78
+ - [Finding 1 — cụ thể, không chung chung]
79
+ - [Finding 2]
80
+ - [Finding 3 nếu có]
81
+
82
+ ### Tác động đến Spec
83
+
84
+ - [ ] Không cần sửa spec — prototype xác nhận hướng hiện tại đúng
85
+ - [ ] Cần sửa [REQ-xxx]: [mô tả thay đổi cụ thể]
86
+ - [ ] Cần thêm requirement mới: [mô tả]
87
+
88
+ ### Quyết định cần carry-forward vào Plan
89
+
90
+ > Plan Agent phải biết những điều này khi thiết kế architecture:
91
+
92
+ - [Quyết định 1 — e.g. "Dùng reducer pattern, không dùng class"]
93
+ - [Quyết định 2 — e.g. "Sidebar layout (Variant B) được chọn"]
94
+
95
+ ---
96
+
97
+ ## Routing
98
+
99
+ - [ ] **VALIDATED** → `/v.plan + /v.test` (chạy song song)
100
+ - [ ] **REJECTED** → `/v.specify` (update spec với findings trên)
101
+ - [ ] **INCONCLUSIVE** → Chờ stakeholder input: [câu hỏi còn mở]
102
+
103
+ ---
104
+
105
+ ## Cleanup Checklist
106
+
107
+ - [ ] *(Explore)* Prototype code tại `.v-flow/features/NNN/prototype/` đã được xóa
108
+ - [ ] Hoặc: logic module đã được absorb vào code thật (và marked production-ready)
109
+ - [ ] *(Reproduce)* Render `ui/approved/UC-NN.*` được **GIỮ** (đừng xóa) — đã cập nhật spec UI Intent "Render đã chốt"
110
+ - [ ] Verdict đã được ghi vào `_session.md` (execution trace)
111
+ - [ ] `.flow-state.yaml` đã update `artifacts.prototype.*` (mode, approved_ref, **approved_by + approved_at nếu VALIDATED**)
112
+ - [ ] Spec đã được update (nếu REJECTED)
113
+
114
+ ---
115
+
116
+ *Prototype là throwaway. File này là thứ duy nhất đáng giữ.*
@@ -0,0 +1,44 @@
1
+ # ptyc.meta.yaml — Metadata trang bìa / ký / căn cứ cho PTYC (BA điền).
2
+ # Copy file này vào .v-flow/features/{NNN}/ptyc.meta.yaml và THAY mọi <...> bằng giá trị THẬT.
3
+ # Nội dung nghiệp vụ (chức năng, requirements...) KHÔNG ở đây — agent lấy từ spec.md.
4
+ #
5
+ # ⚠️ KHÔNG để nguyên số ví dụ. doc_code & tên file tự sinh từ `pyc_ref.no` —
6
+ # điền sai số PYC thì cả tên tài liệu & tên file đều sai.
7
+
8
+ doc:
9
+ system_name: "HỆ THỐNG IOC" # Tên hệ thống (in trang bìa)
10
+ project_code: "IOC" # Mã hiệu dự án
11
+ doc_code: "" # ĐỂ TRỐNG → tự sinh "PTYC_<project_code>_<pyc_ref.no>_<năm>_V1.0".
12
+ # Chỉ điền nếu muốn override thủ công.
13
+ place: "Hà Nội" # Nơi phát hành
14
+ date: "<MM/YYYY>" # Tháng/năm phát hành tài liệu, vd 06/2026
15
+
16
+ # §2.1 Căn cứ Phiếu Yêu Cầu (PYC) — `no` là NGUỒN DUY NHẤT cho doc_code & tên file
17
+ pyc_ref:
18
+ no: "<SỐ PYC>" # vd 01 — lấy đúng số trên Phiếu Yêu Cầu của feature này
19
+ date: "<DD/MM/YYYY>" # ngày trên PYC
20
+ unit: "<ĐƠN VỊ YÊU CẦU>" # vd Phòng Kỹ thuật Công nghệ
21
+
22
+ # Trang ký (để trống approver nếu ký tay)
23
+ signers:
24
+ preparer: "<NGƯỜI LẬP>" # NV phân tích nghiệp vụ
25
+ approver1: ""
26
+ approver2: ""
27
+ approver3: ""
28
+
29
+ # Bảng ghi nhận thay đổi (A=Tạo mới, M=Sửa, D=Xóa)
30
+ change_log:
31
+ - date: "<MM/YYYY>"
32
+ position: "-"
33
+ amd: "A"
34
+ source: "<BA>"
35
+ old_ver: "-"
36
+ desc: "Tạo mới tài liệu"
37
+ new_ver: "V1.0"
38
+
39
+ # §1.4 Tài liệu tham khảo (tùy chọn)
40
+ references:
41
+ - name: "PYC số <SỐ PYC>"
42
+ date: "<DD/MM/YYYY>"
43
+ source: "<ĐƠN VỊ>"
44
+ note: "-"
@@ -0,0 +1,136 @@
1
+ # Template: Retrospective Report — Báo cáo Tổng kết
2
+
3
+ > Được tạo bởi **Retrospective Agent**
4
+ > Feature/Sprint: [TÊN]
5
+ > Ngày: [YYYY-MM-DD]
6
+
7
+ ---
8
+
9
+ ## 1. Tổng quan Feature/Sprint
10
+
11
+ | Mục | Giá trị |
12
+ |-----|--------|
13
+ | **Feature** | [#NNN — Tên feature] |
14
+ | **Ngày bắt đầu** | [YYYY-MM-DD] |
15
+ | **Ngày hoàn thành** | [YYYY-MM-DD] |
16
+ | **Tổng thời gian** | [X ngày] |
17
+ | **Spec versions** | v1.0 → v[X.Y] ([N] revisions) |
18
+ | **Rework cycles** | [N] (quay lại phase nào) |
19
+
20
+ ---
21
+
22
+ ## 2. Phân tích 5 chiều
23
+
24
+ ### 2.1 🎯 Spec Quality — Chất lượng đặc tả
25
+
26
+ | Metric | Giá trị | Đánh giá |
27
+ |--------|--------|:--------:|
28
+ | Requirements rõ ràng ngay từ v1? | [%] | ✅ / ⚠️ / ❌ |
29
+ | Số lần phải sửa spec | [N] | ✅ / ⚠️ / ❌ |
30
+ | BA Critic rounds | [N] | ✅ / ⚠️ / ❌ |
31
+ | Requirements bị miss (phát hiện muộn) | [N] | ✅ / ⚠️ / ❌ |
32
+
33
+ **Nhận xét**: [phân tích]
34
+
35
+ ### 2.2 📐 Planning Quality — Chất lượng kế hoạch
36
+
37
+ | Metric | Giá trị | Đánh giá |
38
+ |--------|--------|:--------:|
39
+ | Plan đúng ngay từ đầu? | Yes/No | ✅ / ⚠️ / ❌ |
40
+ | Cần re-plan? | [N] lần | ✅ / ⚠️ / ❌ |
41
+ | Task estimation accuracy | [XX]% | ✅ / ⚠️ / ❌ |
42
+ | Dependency issues gặp? | [N] | ✅ / ⚠️ / ❌ |
43
+
44
+ **Nhận xét**: [phân tích]
45
+
46
+ ### 2.3 🛡️ Quality Gates — Hiệu quả cổng chất lượng
47
+
48
+ | Metric | Giá trị | Đánh giá |
49
+ |--------|--------|:--------:|
50
+ | Master Check pass lần 1? | Yes/No | ✅ / ⚠️ / ❌ |
51
+ | Code Review pass lần 1? | Yes/No | ✅ / ⚠️ / ❌ |
52
+ | Issues caught by Master Check | [N] | ✅ / ⚠️ / ❌ |
53
+ | Issues leaked to Review | [N] | ✅ / ⚠️ / ❌ |
54
+ | Bugs found after deploy | [N] | ✅ / ⚠️ / ❌ |
55
+
56
+ **Nhận xét**: [phân tích]
57
+
58
+ ### 2.4 ⚙️ Execution Quality — Chất lượng thực hiện
59
+
60
+ | Metric | Giá trị | Đánh giá |
61
+ |--------|--------|:--------:|
62
+ | TDD followed? | Yes/No | ✅ / ⚠️ / ❌ |
63
+ | Test coverage | [XX]% | ✅ / ⚠️ / ❌ |
64
+ | Concerns resolved | [N]/[N] | ✅ / ⚠️ / ❌ |
65
+ | Deviations from plan | [N] | ✅ / ⚠️ / ❌ |
66
+ | Constitution violations | [N] | ✅ / ⚠️ / ❌ |
67
+
68
+ **Nhận xét**: [phân tích]
69
+
70
+ ### 2.5 👥 Team & Process
71
+
72
+ | Metric | Giá trị | Đánh giá |
73
+ |--------|--------|:--------:|
74
+ | Human response time (avg) | [N] giờ | ✅ / ⚠️ / ❌ |
75
+ | Blocked time total | [N] giờ | ✅ / ⚠️ / ❌ |
76
+ | Communication issues | [N] | ✅ / ⚠️ / ❌ |
77
+
78
+ **Nhận xét**: [phân tích]
79
+
80
+ ---
81
+
82
+ ## 3. What Went Well ✅
83
+
84
+ 1. [Điều tốt 1]
85
+ 2. [Điều tốt 2]
86
+ 3. [Điều tốt 3]
87
+
88
+ ## 4. What Could Be Improved ⚠️
89
+
90
+ 1. [Cải thiện 1] → **Action**: [hành động cụ thể]
91
+ 2. [Cải thiện 2] → **Action**: [hành động cụ thể]
92
+ 3. [Cải thiện 3] → **Action**: [hành động cụ thể]
93
+
94
+ ## 5. What Went Wrong ❌
95
+
96
+ 1. [Vấn đề 1] → **Root cause**: [nguyên nhân] → **Prevention**: [cách phòng tránh]
97
+
98
+ ---
99
+
100
+ ## 6. Action Items
101
+
102
+ | # | Action | Owner | Deadline | Target |
103
+ |---|--------|-------|----------|--------|
104
+ | 1 | [hành động] | [ai] | [khi nào] | [agent-config / constitution / knowledge-base] |
105
+ | 2 | [hành động] | [ai] | [khi nào] | [mục tiêu] |
106
+
107
+ ---
108
+
109
+ ## 7. Knowledge Base Updates
110
+
111
+ > Đề xuất cập nhật vào `.v-flow/knowledge/`
112
+
113
+ | File | Loại update | Nội dung |
114
+ |------|:----------:|---------|
115
+ | `lessons-learned/[topic].md` | Tạo mới / Cập nhật | [tóm tắt bài học] |
116
+ | `patterns/[pattern].md` | Tạo mới / Cập nhật | [pattern mới phát hiện] |
117
+ | `domain-glossary.md` | Cập nhật | [thuật ngữ mới] |
118
+
119
+ ---
120
+
121
+ ## 8. Đánh giá tổng thể
122
+
123
+ | Tiêu chí | Điểm (1-5) |
124
+ |----------|:-----------:|
125
+ | Spec Quality | /5 |
126
+ | Planning Quality | /5 |
127
+ | Quality Gates | /5 |
128
+ | Execution Quality | /5 |
129
+ | Team & Process | /5 |
130
+ | **Trung bình** | **/5** |
131
+
132
+ > **So sánh với feature/sprint trước**: Tốt hơn / Tương đương / Kém hơn — [giải thích]
133
+
134
+ ---
135
+
136
+ > **Bước tiếp theo**: `/v.metrics` (nếu chưa chạy) → Feature complete
@@ -0,0 +1,84 @@
1
+ # Template: Security Review
2
+
3
+ > Được tạo bởi **Security Agent** — Phase B.0 (optional)
4
+ > Feature: [TÊN FEATURE]
5
+ > Spec Version: [vX.Y]
6
+ > Ngày review: [YYYY-MM-DD]
7
+
8
+ ---
9
+
10
+ ## 1. Authentication & Authorization
11
+
12
+ | Kiểm tra | Kết quả | Ghi chú |
13
+ |----------|---------|---------|
14
+ | Có authentication flow? | ✅ / ❌ / N/A | |
15
+ | Auth tokens an toàn? (JWT, expiry, refresh) | ✅ / ❌ / N/A | |
16
+ | Role-based access control? | ✅ / ❌ / N/A | |
17
+ | API endpoints đều yêu cầu auth? | ✅ / ❌ / N/A | |
18
+
19
+ ---
20
+
21
+ ## 2. Input Validation
22
+
23
+ | Kiểm tra | Kết quả | Ghi chú |
24
+ |----------|---------|---------|
25
+ | SQL Injection protected? | ✅ / ❌ / N/A | |
26
+ | XSS protected? | ✅ / ❌ / N/A | |
27
+ | Input sanitization đầy đủ? | ✅ / ❌ / N/A | |
28
+ | File upload validation? | ✅ / ❌ / N/A | |
29
+ | Rate limiting? | ✅ / ❌ / N/A | |
30
+
31
+ ---
32
+
33
+ ## 3. Data Protection
34
+
35
+ | Kiểm tra | Kết quả | Ghi chú |
36
+ |----------|---------|---------|
37
+ | Sensitive data encrypted at rest? | ✅ / ❌ / N/A | |
38
+ | HTTPS / TLS enforced? | ✅ / ❌ / N/A | |
39
+ | PII handled correctly? | ✅ / ❌ / N/A | |
40
+ | Logging không chứa sensitive data? | ✅ / ❌ / N/A | |
41
+
42
+ ---
43
+
44
+ ## 4. Infrastructure
45
+
46
+ | Kiểm tra | Kết quả | Ghi chú |
47
+ |----------|---------|---------|
48
+ | CORS configured đúng? | ✅ / ❌ / N/A | |
49
+ | CSP headers? | ✅ / ❌ / N/A | |
50
+ | Environment secrets an toàn? | ✅ / ❌ / N/A | |
51
+ | Dependencies không có known vulnerabilities? | ✅ / ❌ / N/A | |
52
+
53
+ ---
54
+
55
+ ## 5. Phân loại Issues
56
+
57
+ ### 🔴 Critical Security Issues
58
+ *(Không có)* / Liệt kê nếu có:
59
+ - **[SEC-C001]** [Mô tả] → Fix: [Đề xuất]
60
+
61
+ ### 🟠 Major Security Issues
62
+ *(Không có)* / Liệt kê nếu có:
63
+ - **[SEC-M001]** [Mô tả] → Fix: [Đề xuất]
64
+
65
+ ### 🟡 Security Concerns
66
+ *(Không có)* / Liệt kê nếu có:
67
+ - **[SEC-W001]** [Mô tả] → Implement Agent cần chú ý
68
+
69
+ ### 🔵 Recommendations
70
+ - **[SEC-R001]** [Gợi ý cải thiện]
71
+
72
+ ---
73
+
74
+ ## 6. Verdict
75
+
76
+ **Security Review**: ✅ PASS / ⚠️ PASS WITH CONCERNS / ❌ FAIL
77
+
78
+ > **FAIL** nếu có ít nhất 1 Critical hoặc Major security issue.
79
+ > **PASS WITH CONCERNS** nếu có concerns cần Implement Agent chú ý.
80
+
81
+ ---
82
+
83
+ > **Reviewer**: Security Agent
84
+ > **Mandatory khi**: Feature có auth, payment, user data, hoặc external API integration