@torus-engineering/tas-kit 1.8.0 → 1.10.0

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