@torus-engineering/tas-kit 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 (50) hide show
  1. package/.claude/agents/ado-agent.md +39 -0
  2. package/.claude/agents/code-reviewer.md +41 -0
  3. package/.claude/commands/ado-create.md +26 -0
  4. package/.claude/commands/ado-delete.md +20 -0
  5. package/.claude/commands/ado-get.md +19 -0
  6. package/.claude/commands/ado-status.md +17 -0
  7. package/.claude/commands/ado-update.md +25 -0
  8. package/.claude/commands/tas-adr.md +28 -0
  9. package/.claude/commands/tas-brainstorm.md +19 -0
  10. package/.claude/commands/tas-bug.md +62 -0
  11. package/.claude/commands/tas-design.md +31 -0
  12. package/.claude/commands/tas-dev-story.md +61 -0
  13. package/.claude/commands/tas-epic.md +29 -0
  14. package/.claude/commands/tas-feature.md +41 -0
  15. package/.claude/commands/tas-init.md +17 -0
  16. package/.claude/commands/tas-prd.md +31 -0
  17. package/.claude/commands/tas-review-code.md +42 -0
  18. package/.claude/commands/tas-sad.md +37 -0
  19. package/.claude/commands/tas-security-check.md +30 -0
  20. package/.claude/commands/tas-status.md +16 -0
  21. package/.claude/commands/tas-story.md +50 -0
  22. package/.claude/commands/tas-verify.md +33 -0
  23. package/.claude/settings.json +21 -0
  24. package/.claude/skills/ado-integration/SKILL.md +32 -0
  25. package/.claude/skills/tas-conventions/SKILL.md +17 -0
  26. package/.claude/skills/tas-tdd/SKILL.md +26 -0
  27. package/.env.example +1 -0
  28. package/.tas/README.md +1583 -0
  29. package/.tas/checklists/code-review.md +29 -0
  30. package/.tas/checklists/security.md +21 -0
  31. package/.tas/checklists/story-done.md +23 -0
  32. package/.tas/project-status-example.yaml +17 -0
  33. package/.tas/tas-example.yaml +108 -0
  34. package/.tas/templates/ADR.md +47 -0
  35. package/.tas/templates/Bug.md +67 -0
  36. package/.tas/templates/Design-Spec.md +36 -0
  37. package/.tas/templates/Epic.md +46 -0
  38. package/.tas/templates/Feature.md +55 -0
  39. package/.tas/templates/PRD.md +142 -0
  40. package/.tas/templates/Performance-Report.md +30 -0
  41. package/.tas/templates/SAD.md +64 -0
  42. package/.tas/templates/Security-Report.md +27 -0
  43. package/.tas/templates/Story.md +88 -0
  44. package/.tas/tools/tas-ado-readme.md +169 -0
  45. package/.tas/tools/tas-ado.py +621 -0
  46. package/CLAUDE-Example.md +58 -0
  47. package/README.md +67 -0
  48. package/bin/cli.js +49 -0
  49. package/lib/install.js +114 -0
  50. package/package.json +34 -0
package/.tas/README.md ADDED
@@ -0,0 +1,1583 @@
1
+ # Torus-Agentic-SDLC (TAS) Kit - Thiết kế chi tiết
2
+
3
+ > **Version:** 1.5
4
+ > **Author:** Torus BelleSoft Architecture Team
5
+ > **Purpose:** Bộ kit Claude Code skills/commands cho quy trình SDLC hiện đại
6
+
7
+ ---
8
+
9
+ ## 1. Tổng quan kiến trúc
10
+
11
+ ### 1.1 Triết lý thiết kế
12
+
13
+ TAS lấy ý tưởng từ BMAD (workflow agent theo role) và Superpowers (skills có phương pháp luận) nhưng thiết kế lại hoàn toàn theo nguyên tắc:
14
+
15
+ - **Gọn nhẹ**: Mỗi skill < 3KB, tổng kit < 50KB. Không load thừa context.
16
+ - **Context-aware**: Story.md là context digest đã hấp thụ toàn bộ thông tin từ PRD, SAD, ADR, Feature — mỗi session implement chỉ cần đọc CLAUDE.md + Story.md. Đây là Context Layer: đầu tư token ở phase thiết kế để tiết kiệm gấp nhiều lần ở phase code. Khi code PHẢI bắt đầu session mới (không tận dụng session cũ đã load PRD/SAD vì sẽ phình Window Context).
17
+ - **Role-based**: 3 role thực tế của công ty (PE, SE, DSE) thay vì 12 agent giả lập.
18
+ - **Template-driven**: SAD, ADR, PRD, Story dùng template riêng của Torus, cho phép custom.
19
+ - **Flow-configurable**: File `tas.yaml` điều khiển flow theo từng dự án (greenfield/brownfield).
20
+ - **AzureDevops-compatible**: Output Markdown tương thích Wiki, không dùng ký tự `()` trong Mermaid.
21
+
22
+ ### 1.2 Cấu trúc thư mục
23
+
24
+ ```
25
+ your-project/
26
+ ├── CLAUDE.md # Project context (copy từ CLAUDE-Example.md)
27
+ ├── .env # PAT và secrets (trong .gitignore)
28
+ ├── .gitignore # Chứa .env
29
+ ├── .claude/
30
+ │ ├── settings.json # Hooks configuration
31
+ │ ├── commands/ # Slash commands (thin wrappers)
32
+ │ │ ├── tas-init.md # /tas-init - Khởi tạo TAS trong project
33
+ │ │ ├── tas-status.md # /tas-status - Xem trạng thái workflow
34
+ │ │ ├── tas-prd.md # /tas-prd - Tạo hoặc cập nhật PRD
35
+ │ │ ├── tas-design.md # /tas-design - Tạo hoặc cập nhật Design Spec
36
+ │ │ ├── tas-epic.md # /tas-epic - Tạo hoặc cập nhật Epic
37
+ │ │ ├── tas-feature.md # /tas-feature - Tạo hoặc cập nhật Feature
38
+ │ │ ├── tas-story.md # /tas-story - Tạo hoặc cập nhật Story
39
+ │ │ ├── tas-sad.md # /tas-sad - Tạo hoặc cập nhật SAD
40
+ │ │ ├── tas-adr.md # /tas-adr - Tạo hoặc cập nhật ADR
41
+ │ │ ├── tas-dev-story.md # /tas-dev-story - Implement story
42
+ │ │ ├── tas-review-code.md # /tas-review-code
43
+ │ │ ├── tas-brainstorm.md # /tas-brainstorm
44
+ │ │ ├── tas-bug.md # /tas-bug - Bug lifecycle
45
+ │ │ ├── tas-security-check.md # /tas-security-check
46
+ │ │ ├── tas-verify.md # /tas-verify - PE verify Feature trên Staging
47
+ │ │ ├── ado-create.md # /ado-create - Tạo work item trên ADO
48
+ │ │ ├── ado-get.md # /ado-get - Pull work item từ ADO
49
+ │ │ ├── ado-update.md # /ado-update - Cập nhật work item trên ADO
50
+ │ │ ├── ado-status.md # /ado-status - Quick update status trên ADO
51
+ │ │ └── ado-delete.md # /ado-delete - Xóa work item trên ADO
52
+ │ │
53
+ │ └── skills/ # Auto-invocable skills
54
+ │ ├── tas-conventions/
55
+ │ │ └── SKILL.md # Coding conventions, naming rules
56
+ │ ├── tas-tdd/
57
+ │ │ └── SKILL.md # TDD workflow skill
58
+ │ └── ado-integration/
59
+ │ └── SKILL.md # ADO sync skill
60
+
61
+ ├── tas.yaml # Flow config per project (copy từ .tas/tas-example.yaml)
62
+ ├── .tas/ # TAS kit (static, safe to overwrite on upgrade)
63
+ │ ├── tas-example.yaml # Reference template cho tas.yaml
64
+ │ ├── project-status-example.yaml # Reference template cho root/project-status.yaml
65
+ │ ├── templates/
66
+ │ │ ├── PRD.md
67
+ │ │ ├── Design-Spec.md
68
+ │ │ ├── Epic.md
69
+ │ │ ├── Feature.md
70
+ │ │ ├── Story.md
71
+ │ │ ├── Bug.md
72
+ │ │ ├── SAD.md
73
+ │ │ ├── ADR.md
74
+ │ │ ├── Security-Report.md
75
+ │ │ └── Performance-Report.md
76
+ │ ├── checklists/
77
+ │ │ ├── story-done.md # Definition of Done checklist
78
+ │ │ ├── code-review.md # Code review checklist
79
+ │ │ └── security.md # Security checklist
80
+ │ └── tools/
81
+ │ └── tas-ado.py # ADO integration Python script
82
+
83
+ ├── project-status.yaml # Trạng thái tổng hợp project (auto-updated)
84
+ └── docs/ # Generated artifacts
85
+ ├── bugs/ # Bug tickets
86
+ │ ├── PROJ-Bug-001-login-error.md
87
+ │ └── PROJ-Bug-002-timeout.md
88
+ ├── prd.md
89
+ ├── design-spec.md
90
+ ├── sad.md
91
+ ├── security-report.md # DSE: báo cáo security
92
+ ├── performance-report.md # DSE: báo cáo performance (optional)
93
+ ├── adr/
94
+ │ ├── ADR-001-*.md
95
+ │ └── ADR-002-*.md
96
+ └── epics/
97
+ ├── Epic-001-user-management/
98
+ │ ├── Epic-001-user-management.md
99
+ │ ├── Feature-001-login/
100
+ │ │ ├── Feature-001-login.md
101
+ │ │ ├── Story-001-login-form.md
102
+ │ │ └── Story-002-forgot-password.md
103
+ │ └── Feature-002-registration/
104
+ │ ├── Feature-002-registration.md
105
+ │ └── Story-003-register-form.md
106
+ └── Epic-002-order/
107
+ ├── Epic-002-order.md
108
+ └── Feature-003-checkout/
109
+ ├── Feature-003-checkout.md
110
+ └── Story-004-cart-page.md
111
+ ```
112
+
113
+ ### 1.3 Cơ chế hoạt động
114
+
115
+ ```
116
+ User gõ /tas-prd
117
+
118
+
119
+ Command file (.claude/commands/tas-prd.md)
120
+ │ Chứa prompt ngắn: "Cần context từ config + template, tạo hoặc cập nhật PRD"
121
+
122
+
123
+ Claude Code kiểm tra:
124
+ A. File docs/prd.md đã tồn tại?
125
+ → KHÔNG: Chế độ CREATE - tạo mới theo template
126
+ → CÓ: Chế độ UPDATE - đọc file hiện tại, hỏi user cần cập nhật gì,
127
+ giữ nguyên phần không thay đổi, ghi changelog cuối file
128
+
129
+ B. Context files (tas.yaml, templates, artifacts khác):
130
+ → Đọc file cần thiết cho command.
131
+
132
+
133
+ Claude Code tạo/cập nhật artifact → docs/prd.md
134
+ ```
135
+
136
+ **Ví dụ tiết kiệm token:** SE implement 10 stories (mỗi story 1 session mới):
137
+ - Không có TAS: mỗi session đọc CLAUDE.md + PRD + SAD + ADR + Feature + Story = ~9,000 tokens → tổng 90,000 tokens.
138
+ - Có TAS: Story.md đã digest sẵn context từ PRD/SAD/ADR → mỗi session chỉ đọc CLAUDE.md + Story.md = ~2,000 tokens → tổng 20,000 tokens.
139
+ - Tiết kiệm ~78%. Lợi thế đến từ việc **đầu tư viết Story.md tốt ở phase thiết kế**, không phải từ việc tái dùng session cũ.
140
+
141
+ ---
142
+
143
+ ## 2. File cấu hình: tas.yaml
144
+
145
+ File `tas.yaml` ở root dự án. CHỈ chứa flow và logic của TAS. Tech stack, coding conventions, build commands thuộc về CLAUDE.md. Tham khảo `.tas/tas-example.yaml` khi cần.
146
+
147
+ ```yaml
148
+ # tas.yaml - TAS Project Configuration
149
+ project:
150
+ name: "Project Name"
151
+ code: "PROJ" # Prefix for file naming: PROJ-Epic-001, PROJ-Feature-001, etc.
152
+ type: greenfield # greenfield | brownfield
153
+ description: "Mô tả ngắn về dự án"
154
+
155
+ # Azure DevOps integration
156
+ ado:
157
+ organization: "https://dev.azure.com/torus-bellesoft"
158
+ project_id: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
159
+
160
+ team:
161
+ - name: "Nguyen Van A"
162
+ role: pe # Product Engineer
163
+ ado_id: "nguyenvana@torus.vn"
164
+ - name: "Tran Van B"
165
+ role: se # Software Engineer
166
+ ado_id: "tranvanb@torus.vn"
167
+ - name: "Le Van C"
168
+ role: dse # DevSecOps Engineer
169
+ ado_id: "levanc@torus.vn"
170
+
171
+ # Flow configuration - bật/tắt phase theo nhu cầu dự án
172
+ workflow:
173
+ # Phase 0: Discovery & Design (Human-led, AI-powered)
174
+ # PE lead, SE hỗ trợ architecture. Tạo toàn bộ artifacts trước khi code.
175
+ # Gate: "Ready for Development" - PE xác nhận đủ PRD, SAD, Stories
176
+ discovery:
177
+ enabled: true
178
+ lead: pe
179
+ artifacts:
180
+ - prd
181
+ - design_spec
182
+ - sad
183
+ - adr
184
+ - epic
185
+ - feature
186
+ - story
187
+ gate: ready_for_development # PE confirm trước khi sang Phase 1
188
+
189
+ # Phase 1: Develop (Orchestrated Agentic) → Môi trường Test
190
+ # SE implement stories, Claude Code orchestrate TDD + code review
191
+ develop:
192
+ enabled: true
193
+ lead: se
194
+ environment: test
195
+ use_tdd: true
196
+ auto_review: true
197
+
198
+ # Phase 2: Verify (Agentic + PE Review) → Môi trường Staging
199
+ # Per Feature: chạy integration test, PE verify acceptance criteria
200
+ # Gate: PE approved
201
+ verify:
202
+ enabled: true
203
+ lead: pe
204
+ environment: staging
205
+ auto_integration_test: true
206
+ gate: pe_approved
207
+
208
+ # Phase 3: Deploy with Feature Flag (Agentic) → Môi trường Prod
209
+ # DSE lead, deploy với feature flag, canary release
210
+ # Gate: PE approve production
211
+ deploy:
212
+ enabled: true
213
+ lead: dse
214
+ environment: production
215
+ feature_flag: true
216
+ gate: pe_approved_production
217
+
218
+ # Phase 4: Operate (Autonomous) → Môi trường Prod
219
+ # DSE lead, monitoring, auto-scaling, incident response
220
+ operate:
221
+ enabled: false # Bật khi đã có monitoring setup
222
+ lead: dse
223
+ environment: production
224
+ security_check: true
225
+ performance_monitor: true
226
+
227
+ # Brownfield-specific config
228
+ brownfield:
229
+ existing_docs_path: "docs/"
230
+ codebase_scan_on_init: true
231
+
232
+ # Template overrides (optional - chỉ định khi muốn dùng template khác default)
233
+ templates:
234
+ sad: ".tas/templates/SAD.md"
235
+ adr: ".tas/templates/ADR.md"
236
+ prd: ".tas/templates/PRD.md"
237
+ epic: ".tas/templates/Epic.md"
238
+ feature: ".tas/templates/Feature.md"
239
+ story: ".tas/templates/Story.md"
240
+ bug: ".tas/templates/Bug.md"
241
+
242
+ # Model mapping - chọn model phù hợp cho từng command để tối ưu chi phí
243
+ models:
244
+ default: sonnet
245
+ commands:
246
+ tas-prd: sonnet
247
+ tas-design: sonnet
248
+ tas-sad: opus # Kiến trúc cần suy luận sâu
249
+ tas-adr: opus # Quyết định kiến trúc cần chất lượng cao
250
+ tas-epic: sonnet
251
+ tas-feature: sonnet
252
+ tas-story: sonnet
253
+ tas-dev-story: sonnet # Code generation, Sonnet đủ tốt
254
+ tas-review-code: opus # Review cần phân tích sâu
255
+ tas-brainstorm: opus # Suy luận đa chiều
256
+ tas-bug: sonnet # Fix code, Sonnet đủ tốt
257
+ tas-verify: haiku # Chủ yếu đọc checklist, hỏi pass/fail
258
+ tas-status: haiku # Chỉ đọc và format
259
+ tas-security-check: opus # Security cần kỹ
260
+ ```
261
+
262
+ ---
263
+
264
+ ## 2.1 File trạng thái: project-status.yaml
265
+
266
+ File `root/project-status.yaml` lưu trạng thái tổng hợp của toàn bộ project. Được auto-update bởi TAS commands, có thể sửa tay.
267
+
268
+ ```yaml
269
+ # project-status.yaml - Auto-updated by TAS commands
270
+ last_updated: "2026-03-12T10:30:00"
271
+
272
+ artifacts:
273
+ prd:
274
+ status: done
275
+ path: "docs/prd.md"
276
+ design_spec:
277
+ status: done
278
+ path: "docs/design-spec.md"
279
+ sad:
280
+ status: in_progress
281
+ path: "docs/sad.md"
282
+
283
+ adrs:
284
+ ADR-001:
285
+ title: "Use CQRS for Order Service"
286
+ status: Accepted
287
+ path: "docs/adr/ADR-001-use-cqrs.md"
288
+ ADR-002:
289
+ title: "JWT Authentication"
290
+ status: Proposed
291
+ path: "docs/adr/ADR-002-jwt-auth.md"
292
+
293
+ bugs:
294
+ Bug-001:
295
+ title: "Login timeout on mobile"
296
+ severity: High
297
+ status: In Progress
298
+ path: "docs/bugs/PROJ-Bug-001-login-timeout.md"
299
+
300
+ epics:
301
+ Epic-001:
302
+ title: "User Management"
303
+ status: In Progress
304
+ path: "docs/epics/Epic-001-user-management/"
305
+ features:
306
+ Feature-001:
307
+ title: "Login"
308
+ status: In Development
309
+ path: "docs/epics/Epic-001-user-management/Feature-001-login/"
310
+ stories:
311
+ Story-001:
312
+ title: "Login form"
313
+ status: In Progress
314
+ assigned: "tranvanb@torus.vn"
315
+ Story-002:
316
+ title: "Forgot password"
317
+ status: Committed
318
+ assigned: "tranvanb@torus.vn"
319
+ Feature-002:
320
+ title: "Registration"
321
+ status: New
322
+ path: "docs/epics/Epic-001-user-management/Feature-002-registration/"
323
+ stories: {}
324
+ Epic-002:
325
+ title: "Order Management"
326
+ status: Pending
327
+ path: "docs/epics/Epic-002-order/"
328
+ features: {}
329
+ ```
330
+
331
+ **Nguyên tắc:**
332
+ - File này là single source of truth cho trạng thái project
333
+ - /tas-status CHỈ đọc file này, không quét thư mục
334
+ - Mọi command thay đổi artifact/status PHẢI cập nhật file này (xem bảng chi tiết ở section 3)
335
+ - Human có thể sửa tay khi cần (ví dụ: cập nhật status hàng loạt)
336
+ - Nếu file bị lệch thực tế, chạy /tas-init để quét và đồng bộ lại
337
+
338
+ ---
339
+
340
+ ## 3. Chi tiết từng Command
341
+
342
+ > **Quy tắc Context-Aware (áp dụng cho TẤT CẢ commands):**
343
+ > Mỗi command phase code (/tas-dev-story, /tas-bug fix) PHẢI chạy trong session mới. Story.md đã chứa đủ context (Acceptance Criteria, Technical Notes, Unit Test Cases, references SAD/ADR) — KHÔNG cần đọc PRD, SAD, ADR, Feature trong session implement. Chỉ đọc thêm khi user yêu cầu cụ thể. Nguyên tắc này tránh phình Window Context do tích lũy artifact từ session cũ.
344
+
345
+ > **Quy tắc Project Status (áp dụng cho TẤT CẢ commands có thay đổi artifact hoặc status):**
346
+ > Sau khi hoàn thành tạo/cập nhật artifact hoặc thay đổi status, PHẢI cập nhật file `root/project-status.yaml` ngay lập tức. Cụ thể:
347
+ >
348
+ > | Command | Cập nhật gì trong project-status.yaml |
349
+ > |---------|---------------------------------------|
350
+ > | /tas-init | Tạo file mới với cấu trúc rỗng |
351
+ > | /tas-prd | artifacts.prd: status + path |
352
+ > | /tas-design | artifacts.design_spec: status + path |
353
+ > | /tas-sad | artifacts.sad: status + path |
354
+ > | /tas-adr | adrs.ADR-{NNN}: title + status |
355
+ > | /tas-epic | epics.Epic-{NNN}: title + status + path, tạo features rỗng |
356
+ > | /tas-feature | epics.Epic-{NNN}.features.Feature-{NNN}: title + status + path, tạo stories rỗng |
357
+ > | /tas-story | epics...stories.Story-{NNN}: title + status + assigned |
358
+ > | /tas-dev-story | Story status: Committed → In Progress → (done) cập nhật theo progress |
359
+ > | /tas-verify | Feature status: Ready To Verify → Verified (hoặc giữ nguyên nếu fail). Story status cập nhật tương ứng. |
360
+ > | /tas-bug | Tạo mới: thêm bug entry trong Feature. Update: cập nhật bug status theo lifecycle. |
361
+ > | /tas-security-check | artifacts.security_report: status + path + last_scan date |
362
+ >
363
+ > Luôn cập nhật `last_updated` timestamp. Quy tắc này đảm bảo /tas-status chỉ cần đọc 1 file duy nhất thay vì quét toàn bộ thư mục.
364
+
365
+ > **Quy tắc Model Selection (áp dụng cho TẤT CẢ commands):**
366
+ > Trước khi thực thi command, đọc `models.commands` trong tas.yaml để xác định model phù hợp. Nếu command không có trong danh sách thì dùng `models.default`. KHÔNG ghi model trong từng command prompt để tránh trùng lặp.
367
+
368
+ ### 3.1 /tas-init - Khởi tạo TAS
369
+
370
+ ```markdown
371
+ # /tas-init
372
+
373
+ Khởi tạo bộ TAS cho dự án hiện tại.
374
+
375
+ ## Hành động
376
+ 1. Cần context từ tas.yaml ở root. Nếu chưa có, copy từ .tas/tas-example.yaml ra root và hỏi user điền thông tin cần thiết.
377
+ 2. Tạo cấu trúc thư mục: .tas/templates/, .tas/checklists/, docs/, docs/adr/, docs/epics/
378
+ 3. Tạo file root/project-status.yaml với trạng thái ban đầu (artifacts, epics, adrs đều rỗng).
379
+ 4. Copy các template mặc định vào .tas/templates/ nếu chưa có.
380
+ 5. Nếu project type là brownfield và codebase_scan_on_init = true:
381
+ - Quét codebase hiện tại
382
+ - Tạo file docs/codebase-overview.md tóm tắt kiến trúc hiện có
383
+ 6. Hiển thị trạng thái: project type, team roles, workflow phases đang bật.
384
+
385
+ ## Lưu ý
386
+ - KHÔNG tạo lại file nếu đã tồn tại
387
+ - Hỏi xác nhận trước khi thực hiện
388
+ ```
389
+
390
+ ### 3.2 /tas-status - Xem trạng thái
391
+
392
+ ```markdown
393
+ # /tas-status
394
+
395
+ Kiểm tra trạng thái hiện tại của dự án TAS.
396
+
397
+ ## Hành động
398
+ 1. Cần context từ root/project-status.yaml (CHỈ đọc file này, KHÔNG quét thư mục docs/)
399
+ 2. Cần context từ tas.yaml để biết workflow config
400
+ 3. Dựa vào project-status.yaml, tổng hợp:
401
+ - Số lượng artifacts đã tạo và status
402
+ - Số lượng epics/features/stories theo từng status
403
+ - Phase hiện tại dựa trên trạng thái tổng hợp
404
+ 4. Hiển thị bảng trạng thái:
405
+
406
+ | Phase | Status | Lead | Environment | Gate | Next Action |
407
+ |-------|--------|------|-------------|------|-------------|
408
+ | 0 - Discovery & Design | Done | PE | - | Ready for Dev | - |
409
+ | 1 - Develop | In Progress | SE | Test | - | Implement Story-003 |
410
+ | 2 - Verify | Not Started | PE | Staging | PE Approved | Chờ Feature hoàn thành |
411
+ | 3 - Deploy | Not Started | DSE | Production | PE Approved Prod | - |
412
+ | 4 - Operate | Disabled | DSE | Production | - | - |
413
+
414
+ 5. Hiển thị chi tiết stories theo status:
415
+ - Committed: {count} stories chờ implement
416
+ - In Progress: {count} stories đang làm
417
+ - Deploy Test: {count} stories chờ deploy test
418
+ - ...
419
+
420
+ ## Lưu ý
421
+ - Đây là command chỉ đọc, không thay đổi gì
422
+ - Nếu nghi ngờ project-status.yaml lệch thực tế, user có thể chạy /tas-init để quét lại và đồng bộ
423
+ ```
424
+
425
+ ### 3.3 /tas-prd - PRD
426
+
427
+ ```markdown
428
+ # /tas-prd $ARGUMENTS
429
+
430
+ Vai trò: PE - Product Engineer
431
+ Tạo hoặc cập nhật Product Requirements Document.
432
+
433
+ ## Hành động
434
+ 1. Cần context từ tas.yaml để lấy project context
435
+ 2. Kiểm tra docs/prd.md đã tồn tại chưa:
436
+
437
+ ### Chế độ CREATE (file chưa tồn tại):
438
+ 3. Cần context từ .tas/templates/PRD.md
439
+ 4. Nếu $ARGUMENTS có nội dung, dùng làm input mô tả sản phẩm
440
+ 5. Nếu không có $ARGUMENTS, hỏi user:
441
+ - Sản phẩm giải quyết vấn đề gì?
442
+ - Đối tượng người dùng chính?
443
+ - Các tính năng cốt lõi?
444
+ - Ràng buộc kỹ thuật/kinh doanh?
445
+ 6. Tạo file docs/prd.md theo template
446
+
447
+ ### Chế độ UPDATE (file đã tồn tại):
448
+ 3. Cần context từ docs/prd.md hiện tại
449
+ 4. $ARGUMENTS là mô tả thay đổi. Nếu không có, hỏi user cần cập nhật section nào.
450
+ 5. Cập nhật file, giữ nguyên các section không thay đổi
451
+ 6. Thêm dòng vào section Changelog cuối file: ngày, mô tả thay đổi
452
+
453
+ ## Nguyên tắc
454
+ - Viết ở mức đủ chi tiết để SE có thể hiểu và thiết kế kiến trúc
455
+ - Phân loại requirements theo MoSCoW: Must/Should/Could/Won't
456
+ - Mỗi requirement có ID duy nhất: FR-001, NFR-001
457
+ - Luôn có section Non-Goals để giới hạn scope
458
+ - Sơ đồ Mermaid phải dùng :::mermaid wrapper, KHÔNG dùng ký tự ()
459
+ ```
460
+
461
+ ### 3.4 /tas-sad - SAD
462
+
463
+ ```markdown
464
+ # /tas-sad $ARGUMENTS
465
+
466
+ Vai trò: SE - Software Engineer
467
+ Tạo hoặc cập nhật Solution Architecture Document.
468
+
469
+ ## Prerequisite
470
+ - docs/prd.md phải tồn tại. Nếu chưa có, thông báo user chạy /tas-prd trước.
471
+
472
+ ## Hành động
473
+ 1. Cần context từ tas.yaml để lấy project info, workflow config
474
+ 2. Cần context từ docs/prd.md để hiểu requirements
475
+ 3. Nếu brownfield: cần context từ docs/codebase-overview.md nếu có
476
+ 4. Kiểm tra docs/sad.md đã tồn tại chưa:
477
+
478
+ ### Chế độ CREATE (file chưa tồn tại):
479
+ 5. Cần context từ .tas/templates/SAD.md
480
+ 6. Tạo file docs/sad.md theo template SAD của Torus
481
+
482
+ ### Chế độ UPDATE (file đã tồn tại):
483
+ 5. Cần context từ docs/sad.md hiện tại
484
+ 6. $ARGUMENTS là mô tả thay đổi. Nếu không có, hỏi user cần cập nhật section nào.
485
+ 7. Cập nhật file, giữ nguyên các section không thay đổi
486
+ 8. Thêm dòng vào section Changelog cuối file
487
+ 9. Nếu thay đổi là quyết định kiến trúc quan trọng, gợi ý user chạy /tas-adr
488
+
489
+ ## Quy tắc Mermaid
490
+ - Các sơ đồ C4 PHẢI dùng Mermaid flow diagram
491
+ - Bắt đầu bằng :::mermaid, kết thúc bằng :::
492
+ - KHÔNG dùng ký tự () trong node labels, thay bằng []
493
+ - Ví dụ: A["Web App"] --> B["API Gateway"]
494
+ - Bao gồm các view: System Context, Container, Component, Data, Deployment
495
+
496
+ ## Nguyên tắc
497
+ - SAD phải align với tech stack trong CLAUDE.md
498
+ - Mỗi architectural decision quan trọng cần reference sang ADR
499
+ - ERD phải dùng Mermaid erDiagram
500
+ - Sequence diagram dùng Mermaid sequenceDiagram
501
+ ```
502
+
503
+ ### 3.5 /tas-adr - ADR
504
+
505
+ ```markdown
506
+ # /tas-adr $ARGUMENTS
507
+
508
+ Vai trò: SE - Software Engineer
509
+ Tạo mới hoặc cập nhật Architecture Decision Record.
510
+
511
+ ## Hành động
512
+ 1. Cần context từ tas.yaml
513
+ 2. Cần context từ .tas/templates/ADR.md
514
+ 3. Quét docs/adr/ để xác định các ADR hiện có
515
+ 4. Xác định chế độ dựa vào $ARGUMENTS:
516
+
517
+ ### Chế độ CREATE ($ARGUMENTS là tiêu đề mới, ví dụ: "Use CQRS for Order Service"):
518
+ 5. Xác định số thứ tự tiếp theo (ADR-001, ADR-002...)
519
+ 6. Nếu docs/sad.md tồn tại, cần context từ SAD để đảm bảo ADR consistent
520
+ 7. Tạo file docs/adr/ADR-{NNN}-{slug}.md
521
+
522
+ ### Chế độ UPDATE ($ARGUMENTS là ADR ID, ví dụ: "ADR-001"):
523
+ 5. Cần context từ file ADR hiện tại
524
+ 6. Hỏi user cần thay đổi gì (cập nhật status, thêm consequences, supersede...)
525
+ 7. Cập nhật file, thêm changelog
526
+ 8. Nếu supersede: cập nhật status ADR cũ thành "Superseded by ADR-{NNN}"
527
+
528
+ ## Nguyên tắc
529
+ - ADR phải có: Context, Decision, Rationale, Consequences, Alternatives Considered
530
+ - Status: Proposed | Accepted | Deprecated | Superseded
531
+ - Mỗi ADR độc lập, tự chứa đủ context để hiểu
532
+ - Link sang ADR liên quan nếu có (Supersedes, Related to)
533
+ - Sơ đồ Mermaid tuân thủ quy tắc: :::mermaid wrapper, không dùng ()
534
+ ```
535
+
536
+ ### 3.6 /tas-epic - Epic
537
+
538
+ ```markdown
539
+ # /tas-epic $ARGUMENTS
540
+
541
+ Vai trò: PE - Product Engineer
542
+ Tạo mới hoặc cập nhật Epic document.
543
+
544
+ ## Prerequisite
545
+ - docs/prd.md phải tồn tại
546
+
547
+ ## Hành động
548
+ 1. Cần context từ tas.yaml và docs/prd.md
549
+ 2. Cần context từ .tas/templates/Epic.md
550
+ 3. Xác định chế độ dựa vào $ARGUMENTS:
551
+
552
+ ### Chế độ CREATE ($ARGUMENTS là mô tả Epic mới, hoặc không có $ARGUMENTS):
553
+ 4. Nếu không có $ARGUMENTS, hỏi user mô tả Epic.
554
+ 5. Đọc project.code từ tas.yaml (ví dụ: "MP"). Quét docs/epics/ để xác định số thứ tự.
555
+ 6. Tạo thư mục docs/epics/{code}-Epic-{NNN}-{slug}/
556
+ 7. Tạo file docs/epics/{code}-Epic-{NNN}-{slug}/{code}-Epic-{NNN}-{slug}.md
557
+
558
+ ### Chế độ UPDATE ($ARGUMENTS là Epic ID, ví dụ: "Epic-001"):
559
+ 4. Tìm thư mục docs/epics/Epic-001-*/
560
+ 5. Cần context từ file Epic hiện tại
561
+ 5. Hỏi user cần thay đổi gì (cập nhật scope, thêm feature, đổi status...)
562
+ 6. Cập nhật file, thêm changelog
563
+
564
+ ## Nguyên tắc
565
+ - Mỗi Epic map với một business capability trong PRD
566
+ - Epic KHÔNG chứa chi tiết kỹ thuật, chỉ chứa business value
567
+ - Ước lượng effort ở mức T-shirt size: S/M/L/XL
568
+ ```
569
+
570
+ ### 3.7 /tas-feature - Feature
571
+
572
+ ```markdown
573
+ # /tas-feature $ARGUMENTS
574
+
575
+ Vai trò: PE - Product Engineer
576
+ Tạo mới hoặc cập nhật Feature document, bao gồm thiết kế Integration Test và E2E/Acceptance Test.
577
+
578
+ ## Prerequisite
579
+ - Ít nhất một Epic phải tồn tại trong docs/epics/
580
+
581
+ ## Hành động
582
+ 1. Cần context từ tas.yaml
583
+ 2. Cần context từ .tas/templates/Feature.md
584
+ 3. Xác định chế độ dựa vào $ARGUMENTS:
585
+
586
+ ### Chế độ CREATE ($ARGUMENTS là mô tả Feature mới, hoặc không có $ARGUMENTS):
587
+ 4. Đọc project.code từ tas.yaml (ví dụ: "MP"). Liệt kê các Epic hiện có (quét docs/epics/{code}-Epic-*/), hỏi user Feature này thuộc Epic nào
588
+ 5. Quét thư mục Epic đã chọn để xác định số thứ tự Feature
589
+ 6. Tạo thư mục docs/epics/{code}-Epic-{NNN}-{slug}/{code}-Feature-{NNN}-{slug}/
590
+ 7. Tạo file docs/epics/{code}-Epic-{NNN}-{slug}/{code}-Feature-{NNN}-{slug}/{code}-Feature-{NNN}-{slug}.md
591
+ 8. Sau khi PE điền mô tả và acceptance criteria, TỰ ĐỘNG chuyển sang thiết kế test:
592
+ a. **Integration Test Cases**: Hỏi PE:
593
+ - "Feature này tương tác với service/module nào khác?"
594
+ - "Các flow liên kết giữa stories cần test những gì?"
595
+ - "Có data flow nào cần verify end-to-end trong feature này?"
596
+ Ghi vào section Integration Test Cases trong Feature.
597
+ b. **E2E / Acceptance Test Cases**: Hỏi PE:
598
+ - "User scenario chính để verify feature này trên Staging là gì?"
599
+ - "Có scenario nào cần test với data thật hoặc gần thật?"
600
+ - "Acceptance criteria nào cần PE verify thủ công?"
601
+ Ghi vào section E2E Test Cases trong Feature.
602
+ Đây là checklist PE dùng ở Phase 2 khi chạy /tas-verify.
603
+
604
+ ### Chế độ UPDATE ($ARGUMENTS là Feature ID, ví dụ: "Feature-003"):
605
+ 4. Tìm file Feature trong cây docs/epics/ (dùng glob)
606
+ 5. Cần context từ file Feature hiện tại
607
+ 6. Hỏi user cần thay đổi gì (thêm story, cập nhật AC, thêm test cases, đổi status...)
608
+ 7. Cập nhật file, thêm changelog
609
+
610
+ ## Nguyên tắc
611
+ - Feature là một chức năng cụ thể, có thể demo được
612
+ - Feature PHẢI có acceptance criteria rõ ràng, testable
613
+ - Integration Test Cases PHẢI cover các flow liên kết giữa stories
614
+ - E2E Test Cases PHẢI đủ để PE verify feature trên Staging ở Phase 2
615
+ ```
616
+
617
+ ### 3.8 /tas-story - Story
618
+
619
+ ```markdown
620
+ # /tas-story $ARGUMENTS
621
+
622
+ Vai trò: PE - Product Engineer
623
+ Tạo mới hoặc cập nhật User Story document.
624
+
625
+ ## Prerequisite
626
+ - Ít nhất một Feature phải tồn tại
627
+
628
+ ## Hành động
629
+ 1. Cần context từ tas.yaml
630
+ 2. Cần context từ .tas/templates/Story.md
631
+ 3. Xác định chế độ dựa vào $ARGUMENTS:
632
+
633
+ ### Chế độ CREATE ($ARGUMENTS là mô tả Story mới, hoặc không có $ARGUMENTS):
634
+ 4. Liệt kê Features hiện có (quét docs/epics/Epic-*/Feature-*/), hỏi user Story thuộc Feature nào
635
+ 5. Nếu docs/sad.md tồn tại, cần context từ SAD để hiểu kiến trúc
636
+ 6. Quét thư mục Feature đã chọn để xác định số thứ tự Story
637
+ 7. Tạo file docs/epics/{code}-Epic-{NNN}-{slug}/{code}-Feature-{NNN}-{slug}/{code}-Story-{NNN}-{slug}.md
638
+ 8. Story chứa:
639
+ - User story format: "As a [role], I want [goal], so that [benefit]"
640
+ - Acceptance criteria (Given/When/Then format)
641
+ - Technical notes: files cần thay đổi, patterns áp dụng
642
+ - Unit Test Cases (xem bên dưới)
643
+ - Definition of Done checklist
644
+ 9. **Test Case Prompting**: Sau khi PE điền acceptance criteria, TỰ ĐỘNG hỏi thêm:
645
+ - "Ngoài happy path, có edge case nào cần test không?" (ví dụ: input rỗng, giá trị biên, concurrent access)
646
+ - "Có negative case nào cần cover?" (ví dụ: unauthorized, invalid data, timeout)
647
+ - "Có dependency nào cần mock khi test?" (ví dụ: external API, database state)
648
+ Ghi tất cả vào section Unit Test Cases trong Story.
649
+
650
+ ### Chế độ UPDATE ($ARGUMENTS là Story ID, ví dụ: "Story-005"):
651
+ 4. Tìm file Story trong cây docs/epics/ (dùng glob)
652
+ 5. Cần context từ file Story hiện tại
653
+ 6. Hỏi user cần thay đổi gì (cập nhật AC, đổi status, thêm test cases...)
654
+ 7. Cập nhật file, thêm changelog
655
+
656
+ ## Nguyên tắc
657
+ - Story phải nhỏ đủ để hoàn thành trong 1-3 ngày
658
+ - PHẢI có acceptance criteria dạng Given/When/Then
659
+ - Technical notes phải reference đến SAD/ADR nếu liên quan
660
+ - Unit Test Cases PHẢI cover: happy path, edge cases, negative cases
661
+ - Story status: New → Committed → In Progress → Deploy Test → Verify Test → Deploy Stag → Verify Stag → Deploy Prod → Verify Prod → Done
662
+ ```
663
+
664
+ ### 3.9 /tas-dev-story - Implement Story
665
+
666
+ ```markdown
667
+ # /tas-dev-story $ARGUMENTS
668
+
669
+ Vai trò: SE - Software Engineer
670
+ Implement một User Story.
671
+
672
+ ## Hành động
673
+ 1. Cần context từ tas.yaml
674
+ 2. $ARGUMENTS là Story ID hoặc file path. Nếu không có, quét docs/epics/**/Story-*.md tìm stories có status Committed.
675
+ 3. Cần context từ Story file để hiểu requirements (CHỈ đọc Story file là đủ, KHÔNG đọc PRD, SAD, ADR, Design-Spec)
676
+ 4. Cần context từ .tas/checklists/story-done.md
677
+ 5. Nếu trong quá trình implement gặp vấn đề cần tra cứu kiến trúc hoặc requirements gốc, HỎI user xác nhận trước khi đọc thêm SAD/ADR/PRD
678
+
679
+ ## Workflow
680
+ ### Nếu use_tdd = true trong tas.yaml:
681
+ a. Viết test cases TRƯỚC (Red phase)
682
+ - Unit tests theo acceptance criteria
683
+ - Chạy tests, xác nhận FAIL
684
+ b. Implement code (Green phase)
685
+ - Viết code tối thiểu để pass tests
686
+ - Tuân thủ conventions trong CLAUDE.md
687
+ c. Refactor
688
+ - Clean up code
689
+ - Đảm bảo tests vẫn pass
690
+
691
+ ### Nếu use_tdd = false:
692
+ a. Implement code theo acceptance criteria
693
+ b. Viết unit tests cover các cases
694
+ c. Chạy tests, fix nếu fail
695
+
696
+ 6. Cập nhật Story status thành "Done" trong file Story
697
+ 7. Nếu auto_review = true, tự chạy code review theo .tas/checklists/code-review.md
698
+ 8. Tạo commit message theo conventions trong CLAUDE.md
699
+
700
+ ## Nguyên tắc
701
+ - KHÔNG implement ngoài scope của Story
702
+ - Code PHẢI follow naming conventions trong CLAUDE.md
703
+ - Mỗi public method PHẢI có XML doc comment
704
+ ```
705
+
706
+ ### 3.10 /tas-review-code - Review Code
707
+
708
+ ```markdown
709
+ # /tas-review-code $ARGUMENTS
710
+
711
+ Vai trò: SE - Software Engineer
712
+ Review code thay đổi gần nhất hoặc một file/PR cụ thể.
713
+
714
+ ## Hành động
715
+ 1. Cần context từ tas.yaml và .tas/checklists/code-review.md
716
+ 2. $ARGUMENTS có thể là: file path, hoặc để trống (review git diff)
717
+ 3. Nếu $ARGUMENTS trống: lấy git diff của staged changes hoặc last commit
718
+ 4. Review theo checklist:
719
+ - Naming conventions
720
+ - Architecture alignment (so với SAD)
721
+ - Error handling
722
+ - Security concerns
723
+ - Test coverage
724
+ - Performance implications
725
+ 5. Output: danh sách findings phân loại theo severity (Critical/Major/Minor/Info)
726
+
727
+ ## Nguyên tắc
728
+ - Review khách quan, chỉ ra cụ thể dòng code và lý do
729
+ - Đề xuất fix cụ thể, không chỉ nói "code xấu"
730
+ - Check xem code có vi phạm ADR nào không
731
+ ```
732
+
733
+ ### 3.11 /tas-brainstorm - Brainstorm
734
+
735
+ ```markdown
736
+ # /tas-brainstorm $ARGUMENTS
737
+
738
+ Vai trò: Bất kỳ
739
+ Brainstorm có cấu trúc trước khi code hoặc thiết kế.
740
+
741
+ ## Hành động
742
+ 1. $ARGUMENTS là chủ đề brainstorm
743
+ 2. Dẫn dắt qua 4 bước:
744
+ a. **Clarify**: Hỏi 3-5 câu hỏi làm rõ vấn đề
745
+ b. **Explore**: Đưa ra 3+ hướng giải quyết, mỗi hướng có pros/cons
746
+ c. **Evaluate**: So sánh các hướng theo tiêu chí: complexity, maintainability, cost, time
747
+ d. **Decide**: Đề xuất hướng tốt nhất và lý do
748
+
749
+ 3. Nếu kết quả brainstorm dẫn đến quyết định kiến trúc, gợi ý user chạy /tas-create-adr
750
+
751
+ ## Nguyên tắc
752
+ - KHÔNG nhảy thẳng vào giải pháp
753
+ - Hỏi trước, suggest sau
754
+ - Luôn xem xét ít nhất 2 alternatives
755
+ ```
756
+
757
+ ### 3.12 /tas-bug - Bug Lifecycle
758
+
759
+ ```markdown
760
+ # /tas-bug $ARGUMENTS
761
+
762
+ Quản lý toàn bộ lifecycle của bug: tạo, phân tích, fix, verify.
763
+ Vai trò thay đổi theo status của bug.
764
+
765
+ ## Hành động
766
+ 1. Cần context từ tas.yaml
767
+ 2. Cần context từ .tas/templates/Bug.md
768
+ 3. Xác định chế độ dựa vào $ARGUMENTS:
769
+
770
+ ### Chế độ CREATE ($ARGUMENTS là mô tả bug mới):
771
+ Vai trò: PE hoặc SE (ai phát hiện bug)
772
+ 4. Hỏi user:
773
+ - Bug thuộc Feature nào?
774
+ - Severity: Critical | High | Medium | Low
775
+ - Steps to reproduce
776
+ - Expected vs Actual behavior
777
+ - Môi trường phát hiện (Test | Staging | Production)
778
+ 5. Quét thư mục Feature đã chọn để xác định số thứ tự Bug
779
+ 6. Tạo file docs/epics/{code}-Epic-{NNN}-*/{code}-Feature-{NNN}-*/{code}-Bug-{NNN}-{slug}.md
780
+ 7. Bug status ban đầu: New
781
+ 8. Cập nhật project-status.yaml
782
+
783
+ ### Chế độ UPDATE ($ARGUMENTS là Bug ID, ví dụ: "Bug-001"):
784
+ Tìm file Bug trong cây docs/epics/ (dùng glob), detect status hiện tại:
785
+
786
+ **Status = New → Phân tích (SE)**
787
+ 4. SE phân tích root cause:
788
+ - Đọc error logs/stack trace
789
+ - Trace code flow
790
+ - Xác định file và dòng gây lỗi
791
+ 5. Ghi Root Cause Analysis vào Bug file
792
+ 6. Viết Regression Test Cases (test reproduce bug)
793
+ 7. Cập nhật status: New → Committed
794
+ 8. Cập nhật project-status.yaml
795
+
796
+ **Status = Committed → Fix (SE)**
797
+ 4. CHỈ đọc Bug file là đủ (đã có Root Cause Analysis, Regression Test Cases). KHÔNG đọc PRD, SAD, ADR, Design-Spec.
798
+ 5. Nếu trong quá trình fix gặp vấn đề cần tra cứu kiến trúc, HỎI user xác nhận trước khi đọc thêm SAD/ADR.
799
+ 6. Workflow:
800
+ a. Chạy regression test case, xác nhận FAIL (reproduce bug)
801
+ b. Fix code đúng root cause
802
+ c. Chạy regression test, xác nhận PASS
803
+ d. Chạy toàn bộ test suite, đảm bảo không regression mới
804
+ 6. Cập nhật status: Committed → In Progress → Deploy Test
805
+ 7. Cập nhật project-status.yaml
806
+ 8. Commit message format: "fix: [mô tả] - resolves Bug-{NNN}"
807
+
808
+ **Status = Verify Test/Verify Stag → Verify (PE)**
809
+ 4. PE verify trên môi trường tương ứng:
810
+ - Chạy lại Steps to Reproduce, xác nhận bug không còn
811
+ - Kiểm tra regression test case đã pass
812
+ 5. Nếu Pass: cập nhật status → tiếp theo trong flow (Deploy Stag hoặc Done)
813
+ 6. Nếu Fail: ghi lý do, cập nhật status quay lại Committed, SE phải fix lại
814
+ 7. Cập nhật project-status.yaml
815
+
816
+ ## Nguyên tắc
817
+ - KHÔNG patch symptom, phải fix root cause
818
+ - PHẢI có regression test case TRƯỚC khi fix
819
+ - Bug status theo cùng flow Story: New → Committed → In Progress → Deploy Test → Verify Test → Deploy Stag → Verify Stag → Deploy Prod → Verify Prod → Done
820
+ - Bug Critical/High phải fix trước khi Feature được Verified
821
+ ```
822
+
823
+ ### 3.13 /tas-security-check - Security Check
824
+
825
+ ```markdown
826
+ # /tas-security-check $ARGUMENTS
827
+
828
+ Vai trò: DSE - DevSecOps Engineer
829
+ Kiểm tra bảo mật codebase, lưu báo cáo vào docs/security-report.md.
830
+
831
+ ## Hành động
832
+ 1. Cần context từ .tas/checklists/security.md
833
+ 2. $ARGUMENTS có thể là: file path, hoặc để trống (scan toàn bộ)
834
+ 3. Kiểm tra theo OWASP Top 10:
835
+ - SQL Injection
836
+ - XSS
837
+ - Authentication/Authorization issues
838
+ - Sensitive data exposure
839
+ - Security misconfiguration
840
+ - Insecure deserialization
841
+ 4. Kiểm tra thêm cho .NET:
842
+ - Anti-forgery tokens
843
+ - CORS configuration
844
+ - Connection string exposure
845
+ - Proper use of Data Protection API
846
+ 5. Kiểm tra docs/security-report.md đã tồn tại chưa:
847
+ - Chưa có: tạo mới theo template
848
+ - Đã có: append thêm report mới, cập nhật status findings cũ nếu đã fix
849
+ 6. Lưu output vào docs/security-report.md
850
+ 7. Cập nhật root/project-status.yaml: artifacts.security_report
851
+
852
+ ## Nguyên tắc
853
+ - Phân loại: Critical/High/Medium/Low
854
+ - Mỗi finding phải có recommended fix cụ thể
855
+ - Finding có status: Open | In Progress | Fixed | Accepted Risk
856
+ ```
857
+
858
+ ### 3.14 /tas-design - Design Spec
859
+
860
+ ```markdown
861
+ # /tas-design $ARGUMENTS
862
+
863
+ Vai trò: PE - Product Engineer
864
+ Tạo hoặc cập nhật Design Specification document (UI/UX flows, wireframe descriptions).
865
+
866
+ ## Prerequisite
867
+ - docs/prd.md phải tồn tại
868
+
869
+ ## Hành động
870
+ 1. Cần context từ tas.yaml và docs/prd.md
871
+ 2. Kiểm tra docs/design-spec.md đã tồn tại chưa:
872
+
873
+ ### Chế độ CREATE (file chưa tồn tại):
874
+ 3. Cần context từ .tas/templates/Design-Spec.md
875
+ 4. $ARGUMENTS là mô tả scope của design. Nếu không có, dựa vào PRD.
876
+ 5. Tạo file docs/design-spec.md chứa:
877
+ - User flows (Mermaid flowchart)
878
+ - Screen descriptions
879
+ - Navigation structure
880
+ - Interaction patterns
881
+ - Responsive behavior notes
882
+
883
+ ### Chế độ UPDATE (file đã tồn tại):
884
+ 3. Cần context từ docs/design-spec.md hiện tại
885
+ 4. $ARGUMENTS là mô tả thay đổi. Nếu không có, hỏi user cần cập nhật section nào.
886
+ 5. Cập nhật file, thêm changelog
887
+
888
+ ## Nguyên tắc
889
+ - Focus vào flows và behavior, không vào pixel-perfect design
890
+ - Mỗi screen cần mô tả: purpose, key elements, actions available
891
+ - Mermaid tuân thủ: :::mermaid wrapper, không dùng ()
892
+ ```
893
+
894
+ ### 3.15 /tas-verify - Verify Feature (Phase 2)
895
+
896
+ ```markdown
897
+ # /tas-verify $ARGUMENTS
898
+
899
+ Vai trò: PE - Product Engineer
900
+ Verify Feature trên môi trường Staging (Phase 2).
901
+
902
+ ## Prerequisite
903
+ - Feature phải có status "Ready To Verify"
904
+ - Môi trường Staging phải sẵn sàng
905
+
906
+ ## Hành động
907
+ 1. Cần context từ tas.yaml
908
+ 2. $ARGUMENTS là Feature ID. Nếu không có, liệt kê features có stories đã Done.
909
+ 3. Tìm file Feature trong cây docs/epics/ (dùng glob)
910
+ 4. Cần context từ file Feature hiện tại (đặc biệt section Integration Test Cases và E2E Test Cases)
911
+
912
+ ### Workflow verify:
913
+ 5. Hiển thị checklist từ 2 section test trong Feature:
914
+ a. **Integration Test Cases**: Liệt kê từng test case, hỏi PE kết quả (Pass/Fail)
915
+ b. **E2E / Acceptance Test Cases**: Liệt kê từng test case, hỏi PE kết quả (Pass/Fail)
916
+ 6. Với mỗi test case FAIL:
917
+ - Hỏi PE mô tả lỗi
918
+ - Tự động tạo Bug trong thư mục Feature đó (dùng logic /tas-bug)
919
+ - Bug Story có tag "bug" và reference đến test case gốc
920
+ 7. Cập nhật file Feature:
921
+ - Ghi kết quả test (Pass/Fail + ngày) vào từng test case
922
+ - Nếu tất cả Pass: cập nhật Feature status thành "Verified"
923
+ - Nếu có Fail: giữ Feature status "Ready To Verify", liệt kê bug stories
924
+
925
+ ## Nguyên tắc
926
+ - KHÔNG skip test case nào, phải verify hết
927
+ - Bug phát hiện ở Phase 2 PHẢI được ghi thành Story để track
928
+ - Feature chỉ được chuyển sang Phase 3 (Deploy) khi status = "Verified"
929
+ ```
930
+
931
+ ---
932
+
933
+ ## 4. Skills (Auto-invocable)
934
+
935
+ ### 4.1 tas-conventions
936
+
937
+ ```yaml
938
+ ---
939
+ name: tas-conventions
940
+ description: |
941
+ Coding conventions và naming rules của dự án Torus.
942
+ Auto-invoke khi viết code mới, review code, refactor,
943
+ hoặc khi user hỏi về coding standards.
944
+ allowed-tools: Read, Grep, Glob
945
+ ---
946
+ ```
947
+
948
+ Nội dung: Đọc conventions từ tas.yaml và enforce khi Claude Code generate/review code.
949
+
950
+ ### 4.2 tas-tdd
951
+
952
+ ```yaml
953
+ ---
954
+ name: tas-tdd
955
+ description: |
956
+ TDD workflow. Auto-invoke khi implement feature,
957
+ write tests, hoặc khi use_tdd=true trong tas.yaml.
958
+ allowed-tools: Read, Write, Edit, Bash, Grep
959
+ ---
960
+ ```
961
+
962
+ Nội dung: Enforce Red-Green-Refactor cycle khi implement.
963
+
964
+ ---
965
+
966
+ ## 5. Templates mặc định
967
+
968
+ ### 5.1 Template SAD
969
+
970
+ Dùng nguyên template từ repo https://github.com/liemqv/sad-adr-best-practices/blob/main/SAD-Template.md của anh Liêm, với các section:
971
+ 1. Executive Summary
972
+ 2. Architecture Vision
973
+ 3. Business Requirements
974
+ 4. Technology Baseline
975
+ 5. System Context - C4 Level 1
976
+ 6. Logical View - C4 Level 2
977
+ 7. Component View - C4 Level 3
978
+ 8. Data Architecture & ERD
979
+ 9. Integration & Data Flow
980
+ 10. Security Architecture
981
+ 11. Deployment View
982
+ 12. Non-Functional Requirements
983
+ 13. Architectural Decisions
984
+ 14. Risks & Mitigation
985
+
986
+ **Quy tắc Mermaid cho AzureDevops Wiki:**
987
+ - Wrap: `:::mermaid` ... `:::`
988
+ - Node labels dùng `["text"]` thay vì `("text")`
989
+ - KHÔNG dùng `()` trong bất kỳ node label nào
990
+
991
+ ### 5.2 Template ADR
992
+
993
+ Dùng template từ repo https://github.com/liemqv/sad-adr-best-practices/blob/main/ADR-Template.md, gồm:
994
+ 1. Title & Metadata (ID, Status, Date, Author)
995
+ 2. Context
996
+ 3. Decision
997
+ 4. Rationale
998
+ 5. Consequences (Positive/Negative)
999
+ 6. Alternatives Considered
1000
+ 7. Related ADRs
1001
+
1002
+ ### 5.3 Template PRD
1003
+
1004
+ Dùng template từ https://github.com/ugur10/prd-template/blob/main/PRD_TEMPLATE.md, customize bỏ các section Go-to-Market vì Torus là outsource.
1005
+
1006
+ ### 5.4 Template Epic
1007
+
1008
+ ```markdown
1009
+ # Epic-{NNN}: {Title}
1010
+
1011
+ > **Status:** New | Pending | In Design | In Progress | In Monitoring | In Closing | Done | Removed
1012
+ > **Owner:** {PE name}
1013
+ > **Created:** {Date}
1014
+ > **PRD Reference:** {link to PRD section}
1015
+
1016
+ ## Business Value
1017
+ {Mô tả giá trị kinh doanh}
1018
+
1019
+ ## Scope
1020
+ ### In Scope
1021
+ - Item 1
1022
+ - Item 2
1023
+
1024
+ ### Out of Scope
1025
+ - Item 1
1026
+
1027
+ ## Acceptance Criteria (High-level)
1028
+ - [ ] Criteria 1
1029
+ - [ ] Criteria 2
1030
+
1031
+ ## Features
1032
+ | ID | Feature | Priority | Estimate |
1033
+ |----|---------|----------|----------|
1034
+ | Feature-001 | {name} | Must | M |
1035
+ | Feature-002 | {name} | Should | L |
1036
+
1037
+ ## Dependencies
1038
+ - {dependency 1}
1039
+
1040
+ ## Risks
1041
+ - {risk 1}
1042
+ ```
1043
+
1044
+ ### 5.5 Template Feature
1045
+
1046
+ ```markdown
1047
+ # Feature-{NNN}: {Title}
1048
+
1049
+ > **Status:** New | Pending | In Design | In Progress | Ready for Dev | In Development | Ready To Verify | Verified | Done | Removed
1050
+ > **Epic:** Epic-{NNN}
1051
+ > **Owner:** {PE name}
1052
+ > **Created:** {Date}
1053
+ > **Verified Date:** {Date khi status = Verified}
1054
+
1055
+ ## Description
1056
+ {Mô tả chức năng}
1057
+
1058
+ ## User Stories
1059
+ | ID | Story | Priority | Estimate | Status |
1060
+ |----|-------|----------|----------|--------|
1061
+ | Story-001 | {name} | Must | S | Draft |
1062
+
1063
+ ## Acceptance Criteria
1064
+ - [ ] AC-1: {criteria}
1065
+ - [ ] AC-2: {criteria}
1066
+
1067
+ ## UI/UX Notes
1068
+ {Nếu có, reference đến design-spec.md}
1069
+
1070
+ ## Technical Notes
1071
+ {Nếu có, reference đến SAD/ADR}
1072
+
1073
+ ## Integration Test Cases
1074
+ PE thiết kế khi tạo Feature. SE implement trong code.
1075
+
1076
+ | ID | Scenario | Expected Result | Status |
1077
+ |----|----------|-----------------|--------|
1078
+ | IT-1 | {Mô tả flow liên kết} | {Kết quả mong đợi} | - |
1079
+ | IT-2 | {Mô tả flow liên kết} | {Kết quả mong đợi} | - |
1080
+
1081
+ ## E2E / Acceptance Test Cases
1082
+ PE thiết kế khi tạo Feature. PE verify trên Staging ở Phase 2 bằng /tas-verify.
1083
+
1084
+ | ID | User Scenario | Steps | Expected Result | Status | Verified Date |
1085
+ |----|---------------|-------|-----------------|--------|---------------|
1086
+ | E2E-1 | {Scenario} | {Bước thực hiện} | {Kết quả mong đợi} | - | - |
1087
+ | E2E-2 | {Scenario} | {Bước thực hiện} | {Kết quả mong đợi} | - | - |
1088
+ ```
1089
+
1090
+ ### 5.6 Template Story
1091
+
1092
+ ```markdown
1093
+ # Story-{NNN}: {Title}
1094
+
1095
+ > **Status:** New | Committed | In Progress | Deploy Test | Verify Test | Deploy Stag | Verify Stag | Deploy Prod | Verify Prod | Done
1096
+ > **Feature:** Feature-{NNN}
1097
+ > **Assigned to:** {SE name}
1098
+ > **Estimate:** {S/M/L}
1099
+ > **Created:** {Date}
1100
+
1101
+ ## User Story
1102
+ As a {role}, I want {goal}, so that {benefit}.
1103
+
1104
+ ## Acceptance Criteria
1105
+ ### AC-1: {title}
1106
+ - **Given** {precondition}
1107
+ - **When** {action}
1108
+ - **Then** {expected result}
1109
+
1110
+ ### AC-2: {title}
1111
+ - **Given** {precondition}
1112
+ - **When** {action}
1113
+ - **Then** {expected result}
1114
+
1115
+ ## Technical Notes
1116
+ - **Files to modify:** {list}
1117
+ - **Patterns:** {reference to SAD/ADR}
1118
+ - **Database changes:** {if any}
1119
+
1120
+ ## Unit Test Cases
1121
+ SE implement trong code. PE thiết kế happy path + edge cases + negative cases khi tạo Story.
1122
+
1123
+ ### Happy Path
1124
+ | ID | Description | Input | Expected Output |
1125
+ |----|-------------|-------|-----------------|
1126
+ | UT-1 | {description} | {input} | {expected} |
1127
+
1128
+ ### Edge Cases
1129
+ | ID | Description | Input | Expected Output |
1130
+ |----|-------------|-------|-----------------|
1131
+ | UT-E1 | {description, ví dụ: input rỗng, giá trị biên} | {input} | {expected} |
1132
+
1133
+ ### Negative Cases
1134
+ | ID | Description | Input | Expected Output |
1135
+ |----|-------------|-------|-----------------|
1136
+ | UT-N1 | {description, ví dụ: unauthorized, invalid data} | {input} | {expected} |
1137
+
1138
+ ### Dependencies to Mock
1139
+ - {external API, database state, third-party service...}
1140
+
1141
+ ## Definition of Done
1142
+ - [ ] Code implemented
1143
+ - [ ] Unit tests pass
1144
+ - [ ] Code review passed
1145
+ - [ ] Acceptance criteria verified
1146
+ - [ ] No regression
1147
+ - [ ] Documentation updated (if needed)
1148
+ ```
1149
+
1150
+ ### 5.7 Template Bug
1151
+
1152
+ ```markdown
1153
+ # Bug-{NNN}: {Title}
1154
+
1155
+ > **Status:** New | Committed | In Progress | Deploy Test | Verify Test | Deploy Stag | Verify Stag | Deploy Prod | Verify Prod | Done
1156
+ > **Feature:** Feature-{NNN}
1157
+ > **Severity:** Critical | High | Medium | Low
1158
+ > **Found in:** Test | Staging | Production
1159
+ > **Found by:** {PE/SE name}
1160
+ > **Assigned to:** {SE name}
1161
+ > **Created:** {Date}
1162
+
1163
+ ## Description
1164
+ {Mô tả bug ngắn gọn}
1165
+
1166
+ ## Steps to Reproduce
1167
+ 1. {Step 1}
1168
+ 2. {Step 2}
1169
+ 3. {Step 3}
1170
+
1171
+ ## Expected Behavior
1172
+ {Kết quả mong đợi}
1173
+
1174
+ ## Actual Behavior
1175
+ {Kết quả thực tế}
1176
+
1177
+ ## Evidence
1178
+ {Screenshots, logs, error messages}
1179
+
1180
+ ## Root Cause Analysis
1181
+ *SE điền khi phân tích*
1182
+ - **Root Cause:** {Mô tả nguyên nhân gốc}
1183
+ - **Affected Files:** {Danh sách file liên quan}
1184
+ - **Impact Scope:** {Ảnh hưởng đến những chức năng nào khác}
1185
+
1186
+ ## Regression Test Cases
1187
+ *SE thiết kế trước khi fix*
1188
+
1189
+ | ID | Description | Input | Expected | Status |
1190
+ |----|-------------|-------|----------|--------|
1191
+ | RT-1 | Reproduce bug case | {input} | {expected fail trước fix, pass sau fix} | - |
1192
+ | RT-2 | Related regression | {input} | {expected} | - |
1193
+
1194
+ ## Fix Notes
1195
+ *SE ghi sau khi fix*
1196
+ - **Fix Description:** {Mô tả cách fix}
1197
+ - **Files Changed:** {Danh sách file đã sửa}
1198
+ - **Commit:** {commit hash}
1199
+
1200
+ ## Verify Notes
1201
+ *PE ghi khi verify*
1202
+
1203
+ | Date | Environment | Result | Verified by | Notes |
1204
+ |------|-------------|--------|-------------|-------|
1205
+ | {Date} | {env} | Pass/Fail | {PE name} | {notes} |
1206
+ ```
1207
+
1208
+ ### 5.8 Template Security Report
1209
+
1210
+ ```markdown
1211
+ # Security Report
1212
+
1213
+ > **Last Scan:** {Date}
1214
+ > **Scope:** {Full scan | File/Module specific}
1215
+ > **Scanned by:** {DSE name}
1216
+
1217
+ ## Summary
1218
+ | Severity | Open | Fixed | Accepted Risk | Total |
1219
+ |----------|------|-------|---------------|-------|
1220
+ | Critical | 0 | 0 | 0 | 0 |
1221
+ | High | 0 | 0 | 0 | 0 |
1222
+ | Medium | 0 | 0 | 0 | 0 |
1223
+ | Low | 0 | 0 | 0 | 0 |
1224
+
1225
+ ## Findings
1226
+
1227
+ ### SEC-001: {Title}
1228
+ - **Severity:** Critical | High | Medium | Low
1229
+ - **Status:** Open | In Progress | Fixed | Accepted Risk
1230
+ - **Location:** {file:line}
1231
+ - **Description:** {Mô tả vấn đề}
1232
+ - **Recommended Fix:** {Cách fix cụ thể}
1233
+ - **Fixed Date:** {Date, nếu đã fix}
1234
+
1235
+ ## Scan History
1236
+ | Date | Scope | New Findings | Fixed | Remaining |
1237
+ |------|-------|-------------|-------|-----------|
1238
+ | {Date} | {Scope} | {count} | {count} | {count} |
1239
+ ```
1240
+
1241
+ ### 5.9 Template Performance Report
1242
+
1243
+ ```markdown
1244
+ # Performance Report
1245
+
1246
+ > **Last Test:** {Date}
1247
+ > **Environment:** {Test | Staging | Production}
1248
+ > **Tested by:** {DSE name}
1249
+
1250
+ ## Baseline Metrics
1251
+ | Metric | Target | Actual | Status |
1252
+ |--------|--------|--------|--------|
1253
+ | API Response Time (p95) | < 200ms | {value} | Pass/Fail |
1254
+ | Throughput | > 1000 req/s | {value} | Pass/Fail |
1255
+ | Database Query (p95) | < 100ms | {value} | Pass/Fail |
1256
+ | Memory Usage | < 512MB | {value} | Pass/Fail |
1257
+ | CPU Usage (peak) | < 80% | {value} | Pass/Fail |
1258
+
1259
+ ## Bottlenecks
1260
+ | ID | Description | Impact | Recommendation | Status |
1261
+ |----|-------------|--------|----------------|--------|
1262
+ | PERF-001 | {description} | {impact} | {recommendation} | Open/Fixed |
1263
+
1264
+ ## Load Test Results
1265
+ - **Tool:** {k6 | JMeter | NBomber...}
1266
+ - **Scenario:** {description}
1267
+ - **Duration:** {minutes}
1268
+ - **Concurrent users:** {count}
1269
+ - **Results:** {summary}
1270
+
1271
+ ## Test History
1272
+ | Date | Environment | Result | Notes |
1273
+ |------|-------------|--------|-------|
1274
+ | {Date} | {env} | Pass/Fail | {notes} |
1275
+ ```
1276
+
1277
+ ---
1278
+
1279
+ ## 6. Checklists
1280
+
1281
+ ### 6.1 Code Review Checklist (.tas/checklists/code-review.md)
1282
+
1283
+ ```markdown
1284
+ # Code Review Checklist
1285
+
1286
+ ## Architecture
1287
+ - [ ] Code align với SAD
1288
+ - [ ] Không vi phạm ADR nào
1289
+ - [ ] Đúng layer separation
1290
+
1291
+ ## Code Quality
1292
+ - [ ] Naming theo conventions trong CLAUDE.md
1293
+ - [ ] Không có magic numbers/strings
1294
+ - [ ] Error handling đầy đủ
1295
+ - [ ] Logging có ý nghĩa
1296
+ - [ ] Không có code duplication
1297
+
1298
+ ## Security
1299
+ - [ ] Input validation
1300
+ - [ ] No SQL injection risk
1301
+ - [ ] No XSS risk
1302
+ - [ ] Sensitive data không log
1303
+
1304
+ ## Testing
1305
+ - [ ] Unit tests cover happy path
1306
+ - [ ] Unit tests cover edge cases
1307
+ - [ ] Tests có assertion rõ ràng
1308
+
1309
+ ## Performance
1310
+ - [ ] Không có N+1 query
1311
+ - [ ] Async/await đúng cách
1312
+ - [ ] Dispose resources properly
1313
+ ```
1314
+
1315
+ ### 6.2 Security Checklist (.tas/checklists/security.md)
1316
+
1317
+ ```markdown
1318
+ # Security Checklist - .NET Specific
1319
+
1320
+ ## Authentication & Authorization
1321
+ - [ ] JWT validation đúng
1322
+ - [ ] Role-based authorization
1323
+ - [ ] Anti-forgery token cho forms
1324
+
1325
+ ## Data Protection
1326
+ - [ ] Connection strings trong secrets, không hardcode
1327
+ - [ ] PII data encrypted at rest
1328
+ - [ ] HTTPS enforced
1329
+
1330
+ ## Input Validation
1331
+ - [ ] Model validation attributes
1332
+ - [ ] Parameterized queries (EF Core)
1333
+ - [ ] File upload validation
1334
+
1335
+ ## CORS & Headers
1336
+ - [ ] CORS policy restrictive
1337
+ - [ ] Security headers: X-Content-Type-Options, X-Frame-Options
1338
+ - [ ] HSTS enabled
1339
+ ```
1340
+
1341
+ ---
1342
+
1343
+ ## 7. CLAUDE.md Integration
1344
+
1345
+ Mẫu CLAUDE.md cho dự án dùng TAS. Lưu ý: tech stack, coding conventions, build commands thuộc về CLAUDE.md, KHÔNG ghi trong tas.yaml.
1346
+
1347
+ ```markdown
1348
+ # Project Context
1349
+
1350
+ ## Tech Stack
1351
+ - Backend: .NET 8, C#, Entity Framework Core
1352
+ - Frontend: Angular 17
1353
+ - Database: SQL Server 2022
1354
+ - Infrastructure: Azure App Service, Azure SQL
1355
+ - CI/CD: Azure DevOps Pipelines
1356
+
1357
+ ## Conventions
1358
+ - Branching: git-flow
1359
+ - Commit: conventional commits
1360
+ - Namespace: Torus.{ProjectName}.{Layer}
1361
+ - Naming: PascalCase for classes/methods, camelCase for variables
1362
+ - Test framework: xUnit
1363
+
1364
+ ## Legacy Patterns to Avoid (Brownfield)
1365
+ - Repository pattern without interface
1366
+ - Direct SQL queries in controllers
1367
+
1368
+ ## Mermaid Rules (AzureDevops Wiki)
1369
+ - Always wrap with :::mermaid and :::
1370
+ - NEVER use () in node labels, use [] instead
1371
+ - Example: A["Web App"] --> B["API Gateway"]
1372
+
1373
+ ## Build & Test
1374
+ - Build: dotnet build
1375
+ - Test: dotnet test
1376
+ - Lint: dotnet format --verify-no-changes
1377
+
1378
+ ## TAS Kit
1379
+ This project uses Torus-Agentic-SDLC (TAS) kit.
1380
+ - Flow config: tas.yaml
1381
+ - Templates: .tas/templates/
1382
+ - Generated docs: docs/
1383
+
1384
+ ## Key Rules
1385
+ - Architecture: see docs/sad.md
1386
+ - Decisions: see docs/adr/
1387
+
1388
+ ## Commands
1389
+ Type /tas-status to see current project state.
1390
+ Type /tas-[artifact] to create or update artifacts (prd, sad, adr, epic, feature, story, design).
1391
+ Type /tas-dev-story to implement a story.
1392
+ Type /tas-verify to verify a Feature on Staging (Phase 2).
1393
+ Type /tas-review-code, /tas-brainstorm, /tas-bug, /tas-security-check for dev workflows.
1394
+ ```
1395
+
1396
+ ---
1397
+
1398
+ ## 8. Flow Greenfield vs Brownfield
1399
+
1400
+ ### Greenfield Flow
1401
+ ```
1402
+ Phase 0: Discovery & Design (Human-led, AI-powered)
1403
+ ├── /tas-init (type: greenfield)
1404
+ ├── /tas-brainstorm (optional, product idea exploration)
1405
+ ├── /tas-prd
1406
+ ├── /tas-design (optional)
1407
+ ├── /tas-sad
1408
+ ├── /tas-adr (repeat per decision)
1409
+ ├── /tas-epic (repeat per epic)
1410
+ ├── /tas-feature (repeat per feature)
1411
+ └── /tas-story (repeat per story)
1412
+ ↓ Gate: PE confirm "Ready for Development"
1413
+
1414
+ Phase 1: Develop (Orchestrated Agentic) → Test
1415
+ ├── /tas-dev-story (implement each story, TDD)
1416
+ ├── /tas-review-code (auto hoặc manual)
1417
+ └── /tas-bug (nếu phát sinh)
1418
+ ↓ Per Feature completed:
1419
+
1420
+ Phase 2: Verify (Agentic + PE Review) → Staging
1421
+ ├── /tas-verify (PE verify per Feature)
1422
+ ├── Integration test chạy trên Staging
1423
+ ├── PE verify acceptance criteria per Feature
1424
+ └── /tas-security-check
1425
+ ↓ Gate: PE approved
1426
+
1427
+ Phase 3: Deploy with Feature Flag → Production
1428
+ ├── DSE deploy với feature flag
1429
+ ├── Canary release, monitor
1430
+ └── PE approve bật feature flag
1431
+ ↓ Gate: PE approved production
1432
+
1433
+ Phase 4: Operate (Autonomous) → Production
1434
+ ├── Monitoring, alerting
1435
+ ├── Auto-scaling
1436
+ └── Incident response
1437
+
1438
+ --- Sau Sprint 1, khi có change request ---
1439
+ Quay lại Phase 0:
1440
+ ├── /tas-prd (UPDATE mode)
1441
+ ├── /tas-sad (UPDATE mode nếu kiến trúc thay đổi)
1442
+ ├── /tas-epic / /tas-feature / /tas-story (tạo mới hoặc cập nhật)
1443
+ └── Tiếp tục Phase 1 → 2 → 3 → 4
1444
+ ```
1445
+
1446
+ ### Brownfield Flow
1447
+ ```
1448
+ Phase 0: Discovery & Design
1449
+ ├── /tas-init (type: brownfield, auto-scan codebase)
1450
+ ├── /tas-brainstorm (explore improvement areas)
1451
+ ├── /tas-adr (document decisions cho codebase hiện tại)
1452
+ ├── /tas-epic (nếu feature set mới)
1453
+ ├── /tas-story (smaller changes go direct to story)
1454
+
1455
+ │ --- Khi cần mở rộng ---
1456
+ ├── /tas-prd (tạo hoặc cập nhật)
1457
+ ├── /tas-sad (tạo hoặc cập nhật)
1458
+ └── /tas-epic / /tas-feature / /tas-story
1459
+ ↓ Gate: PE confirm "Ready for Development"
1460
+
1461
+ Phase 1: Develop → Test
1462
+ ├── /tas-dev-story
1463
+ ├── /tas-bug (bug fixes không cần full Phase 0)
1464
+ └── /tas-review-code
1465
+ ↓ Per Feature:
1466
+
1467
+ Phase 2 → 3 → 4: Giống Greenfield Flow
1468
+ ```
1469
+
1470
+ ---
1471
+
1472
+ ## 9. Ước tính Token Cost
1473
+
1474
+ | Component | Size | Khi nào load |
1475
+ |-----------|------|--------------|
1476
+ | tas.yaml | ~300 tokens | Lần đầu cần. Các lần sau lấy từ context. |
1477
+ | project-status.yaml | ~200-800 tokens | /tas-status đọc. Các command khác chỉ write, không cần read. |
1478
+ | Template (1 file) | ~800 tokens | Lần đầu tạo artifact loại đó. Các lần sau lấy từ context. |
1479
+ | Checklist (1 file) | ~300 tokens | Lần đầu review/check. Các lần sau lấy từ context. |
1480
+ | Command prompt | ~200 tokens | Mỗi lần gọi command (luôn load) |
1481
+ | Existing artifact (PRD, SAD...) | ~1000-3000 tokens | Lần đầu cần reference. Các lần sau lấy từ context. |
1482
+
1483
+ **Cost phase thiết kế (1 lần/artifact)**: Story.md = 1,000-2,000 tokens context để tạo.
1484
+ **Cost phase code (mỗi session mới)**: CLAUDE.md + Story.md = ~2,000 tokens.
1485
+ **So sánh**: Không có TAS phải load CLAUDE.md + PRD + SAD + ADR + Feature + Story = ~9,000 tokens/session.
1486
+
1487
+ **Ví dụ thực tế:** Implement 10 stories (mỗi story 1 session mới):
1488
+ - Không có TAS: 10 x 9,000 = 90,000 tokens
1489
+ - Có TAS (Context Layer): 10 x 2,000 = 20,000 tokens
1490
+ - Tiết kiệm: ~78% — nhờ Story.md đã digest sẵn context, KHÔNG nhờ tái dùng session cũ
1491
+
1492
+ ---
1493
+
1494
+ ## 9.1 ADO Integration
1495
+
1496
+ ### Prerequisites
1497
+ - Azure CLI + extension: `az extension add --name azure-devops --upgrade`
1498
+ - Python 3.8+ với pyyaml: `pip install pyyaml`
1499
+ - Tạo file `.env` ở root project (đã có trong .gitignore):
1500
+ ```
1501
+ AZURE_DEVOPS_PAT=your-pat-here
1502
+ ```
1503
+ PAT cần scope "Work Items (Full)"
1504
+
1505
+ ### Commands
1506
+
1507
+ | Command | Cú pháp | Mô tả |
1508
+ |---------|---------|-------|
1509
+ | /ado-create | `<type> <temp-id> [--parent-id <id>]` | Tạo work item trên ADO từ file local |
1510
+ | /ado-get | `<ado-id>` | Pull work item từ ADO về file local |
1511
+ | /ado-update | `<type> <ado-id> [--assign <n>] [--status <s>]` | Cập nhật work item trên ADO |
1512
+ | /ado-status | `<ado-id> --status <state>` | Quick update status trên ADO |
1513
+ | /ado-delete | `<type> <ado-id>` | Xóa work item trên ADO (giữ file local) |
1514
+
1515
+ Type: `epic | feature | story | bug`
1516
+
1517
+ ### Frontmatter YAML
1518
+ Mỗi file Epic/Feature/Story/Bug có frontmatter cho ADO sync:
1519
+ ```yaml
1520
+ ---
1521
+ ado_id: 5345
1522
+ ado_type: User Story
1523
+ ado_title: Login Form
1524
+ ado_state: In Progress
1525
+ ado_assigned_to: Tran Van B <tranvanb@torus.vn>
1526
+ ado_created: 2026-03-10
1527
+ last_ado_sync: 2026-03-17 15:42:08
1528
+ parent_ado_id: 456
1529
+ ---
1530
+ ```
1531
+
1532
+ ### Cơ chế hoạt động
1533
+ - File .md là single source of truth
1534
+ - Mỗi lần create/get/update thành công, `last_ado_sync` được cập nhật tự động
1535
+ - Khi create: file được rename từ temp-id sang ado-id thực
1536
+ - Khi delete: chỉ xóa trên ADO, file local giữ nguyên với state "Removed"
1537
+ - Script: `python .tas/tools/tas-ado.py <command> [args]`
1538
+
1539
+ ---
1540
+
1541
+ ## 10. Lộ trình triển khai
1542
+
1543
+ ### Triển khai Phase 1 - Phase 0 commands (Tuần 1-2)
1544
+ - tas-init, tas-status
1545
+ - tas-prd, tas-design, tas-sad, tas-adr
1546
+ - tas-epic, tas-feature, tas-story
1547
+ - tas-brainstorm
1548
+ - Tất cả templates + tas.yaml config
1549
+
1550
+ ### Triển khai Phase 2 - Phase 1 commands (Tuần 3-4)
1551
+ - tas-dev-story, tas-review-code, tas-bug
1552
+ - Checklists: code-review, story-done
1553
+ - Skills: tas-conventions, tas-tdd
1554
+
1555
+ ### Triển khai Phase 3 - Phase 2+3 commands (Tuần 5)
1556
+ - tas-security-check
1557
+ - Checklist: security
1558
+ - ADO integration: auto update work items
1559
+
1560
+ ### Triển khai Phase 4 - Phase 4 commands (Tuần 6+)
1561
+ - Monitoring integration
1562
+ - Performance testing template
1563
+ - Incident response workflow
1564
+
1565
+ ### Ongoing - Optimization
1566
+ - Đo lường token cost thực tế
1567
+ - Tinh chỉnh template/command dựa trên feedback team
1568
+ - Tạo hooks tự động (auto-lint, auto-test)
1569
+
1570
+ ---
1571
+
1572
+ ## 11. Changelog
1573
+
1574
+ ### v1.5 — 2026-03-22
1575
+ - **Thêm `CLAUDE.md`** cho TAS Kit repo: mô tả cấu trúc kit, hướng dẫn thêm/sửa command, skill, agent để Claude hiểu khi làm việc trên repo này
1576
+ - **Cập nhật `.claude/settings.json`**: mở rộng permissions — thêm `Write:*`, `Edit:*` (trước chỉ cho `*.md`), thêm `Bash` cho `python`, `dotnet`, `npm`, `node`, `az`; fix deny rule cho `.env` files
1577
+ - **Thêm `.claude/agents/`**: tạo mới thư mục agents với 2 specialized subagents
1578
+ - `ado-agent.md`: chạy ADO operations trong isolated context, trả về structured result
1579
+ - `code-reviewer.md`: review code isolated, output findings theo severity với file:line cụ thể
1580
+ - Cập nhật cấu trúc thư mục trong README phản ánh thêm `.claude/agents/`
1581
+
1582
+ ### v1.4 — (trước 2026-03-22)
1583
+ - Phiên bản ban đầu với 20 commands, 3 skills, ADO integration