@torus-engineering/tas-kit 1.6.0 → 1.8.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 (71) hide show
  1. package/.claude/commands/tas-adr.md +33 -29
  2. package/.claude/commands/tas-api-test.md +95 -0
  3. package/.claude/commands/tas-bug.md +113 -109
  4. package/.claude/commands/tas-design.md +37 -33
  5. package/.claude/commands/tas-dev.md +128 -115
  6. package/.claude/commands/tas-e2e-mobile.md +155 -0
  7. package/.claude/commands/tas-e2e-web.md +163 -0
  8. package/.claude/commands/tas-e2e.md +102 -0
  9. package/.claude/commands/tas-epic.md +35 -31
  10. package/.claude/commands/tas-feature.md +47 -43
  11. package/.claude/commands/tas-fix.md +51 -47
  12. package/.claude/commands/tas-functest-mobile.md +144 -0
  13. package/.claude/commands/tas-functest-web.md +192 -0
  14. package/.claude/commands/tas-functest.md +76 -0
  15. package/.claude/commands/tas-plan.md +200 -184
  16. package/.claude/commands/tas-prd.md +37 -33
  17. package/.claude/commands/tas-review.md +111 -104
  18. package/.claude/commands/tas-sad.md +43 -39
  19. package/.claude/commands/tas-security.md +81 -80
  20. package/.claude/commands/tas-story.md +91 -87
  21. package/.claude/commands/tas-verify.md +51 -41
  22. package/.claude/rules/common/post-review-agent.md +49 -39
  23. package/.claude/rules/common/testing.md +24 -0
  24. package/.claude/rules/common/token-logging.md +27 -0
  25. package/.claude/rules/csharp/api-testing.md +171 -0
  26. package/.claude/rules/csharp/patterns.md +10 -0
  27. package/.claude/rules/python/patterns.md +10 -0
  28. package/.claude/rules/typescript/patterns.md +10 -0
  29. package/.claude/rules/web/performance.md +9 -0
  30. package/.claude/skills/api-design/SKILL.md +3 -1
  31. package/.claude/skills/{backend-patterns → js-backend-patterns}/SKILL.md +2 -1
  32. package/.claude/skills/tas-implementation-complete/SKILL.md +99 -97
  33. package/.claude/skills/tas-tdd/SKILL.md +123 -82
  34. package/.claude/skills/token-logger/SKILL.md +19 -0
  35. package/.tas/templates/E2E-Execution-Report.md +198 -0
  36. package/.tas/templates/E2E-Mobile-Spec.md +130 -0
  37. package/.tas/templates/E2E-Report.md +174 -0
  38. package/.tas/templates/E2E-Scenario.md +180 -0
  39. package/.tas/templates/E2E-Web-Spec.md +164 -0
  40. package/.tas/templates/Feature.md +55 -55
  41. package/.tas/templates/Func-Test-Script.md +254 -0
  42. package/.tas/templates/Func-Test-Spec.md +187 -0
  43. package/.tas/templates/SAD.md +274 -64
  44. package/.tas/templates/Story.md +90 -88
  45. package/bin/cli.js +56 -49
  46. package/lib/deleted-files.json +33 -0
  47. package/lib/install.js +213 -114
  48. package/package.json +34 -34
  49. package/.claude/agents/README.md +0 -83
  50. package/.claude/agents/ado-agent.md +0 -39
  51. package/.claude/agents/code-architect.md +0 -62
  52. package/.claude/agents/code-simplifier.md +0 -53
  53. package/.claude/agents/comment-analyzer.md +0 -59
  54. package/.claude/agents/conversation-analyzer.md +0 -57
  55. package/.claude/agents/docs-lookup.md +0 -55
  56. package/.claude/agents/harness-optimizer.md +0 -62
  57. package/.claude/agents/loop-operator.md +0 -56
  58. package/.claude/agents/performance-optimizer.md +0 -78
  59. package/.claude/agents/pr-test-analyzer.md +0 -68
  60. package/.claude/agents/pytorch-build-resolver.md +0 -76
  61. package/.claude/agents/refactor-cleaner.md +0 -70
  62. package/.claude/agents/seo-specialist.md +0 -75
  63. package/.claude/agents/silent-failure-hunter.md +0 -69
  64. package/.claude/agents/type-design-analyzer.md +0 -75
  65. package/.claude/rules/common/agents.md +0 -65
  66. package/.claude/rules/common/coding-style.md +0 -90
  67. package/.claude/rules/common/development-workflow.md +0 -44
  68. package/.claude/rules/common/git-workflow.md +0 -24
  69. package/.claude/rules/common/performance.md +0 -55
  70. package/.claude/skills/agent-harness-construction/SKILL.md +0 -77
  71. package/.claude/skills/agent-introspection-debugging/SKILL.md +0 -157
@@ -1,104 +1,111 @@
1
- # /tas-review $ARGUMENTS
2
-
3
- Review code thay đổi gần nhất hoặc một file/PR cụ thể.
4
- Bao gồm hygiene scan, test run, và parallel multi-agent review.
5
-
6
- ## Stack Detection
7
- Đọc `.claude/rules/common/stack-detection.md`.
8
-
9
- ## Hành động
10
-
11
- ### Bước 1 — Xác định scope review
12
- `$ARGUMENTS` có thể là: file path, Story ID, hoặc để trống (review git diff).
13
- - Nếu trống: lấy `git diff HEAD` (staged + unstaged) hoặc last commit
14
- - Nếu Story ID: tìm file Story tương ứng để lấy danh sách files đã thay đổi
15
- - Nếu file path: review trực tiếp file đó
16
-
17
- ### Bước 2 — Pre-checks (PHẢI pass mới tiếp tục)
18
-
19
- **Hygiene scan** — scan nhanh các files trong scope:
20
- - Debug code còn sót: `console.log`, `print(`, `Debug.WriteLine`, `debugger`
21
- - Secrets hardcoded: password/key/token/secret gán bằng string literal
22
- - Commented-out code block lớn (>5 dòng) không có comment lý do
23
-
24
- → Nếu có blocker: liệt kê ngay, yêu cầu fix trước khi tiếp tục.
25
-
26
- **Run tests** — detect từ project structure:
27
- - `package.json` → `npm test`
28
- - `*.csproj` / `*.sln` → `dotnet test`
29
- - `pytest.ini` / `pyproject.toml` → `python -m pytest`
30
-
31
- → Nếu fail: dừng, list lỗi, KHÔNG tiếp tục review.
32
- → Nếu không detect được: ghi chú "No test runner detected" tiếp tục.
33
-
34
- ### Bước 3 — Parallel Multi-Agent Review
35
-
36
- Launch các agents ĐỒNG THỜI (không chờ nhau):
37
-
38
- **Agent 1 — `code-reviewer`** (luôn chạy):
39
- > Review [scope]. Đọc `.tas/checklists/code-review.md` `.claude/rules/common/code-review.md`.
40
- > Tập trung: naming, architecture alignment, error handling, DRY, function size, nesting depth.
41
- > Format: findings nhóm theo Critical / High / Medium / Low, mỗi finding có file:line và fix cụ thể.
42
-
43
- **Agent 2 — `security-reviewer`** (luôn chạy):
44
- > Security audit [scope]. Đọc `.claude/rules/common/security.md`.
45
- > Tập trung: OWASP Top 10, injection, hardcoded secrets, auth/authz, data exposure.
46
- > Format: findings nhóm theo Critical / High / Medium / Low, mỗi finding có file:line và remediation.
47
-
48
- **Agent 3 Language reviewer** (dựa theo `lang_agent` từ stack detection):
49
- > Language-specific review [scope].
50
- > Đọc `.claude/rules/[stack]/coding-style.md` `.claude/rules/[stack]/patterns.md`.
51
- > Tập trung: async/await patterns, null handling, type safety, anti-patterns đặc thù của stack.
52
- > Format: findings theo Critical / High / Medium / Low với file:line.
53
-
54
- **Agent 4 `aws-reviewer`** (chỉ khi `infra_agent = aws-reviewer`):
55
- > AWS infrastructure review [scope].
56
- > Tập trung: IAM policies, secrets trong env/config, S3 permissions, Lambda security.
57
- > Format: findings theo Critical / High / Medium / Low.
58
-
59
- Chờ TẤT CẢ agents hoàn thành, sau đó tổng hợp.
60
-
61
- ### Bước 4 — Tổng hợp kết quả
62
-
63
- Gộp findings từ tất cả agents, deduplicate (cùng file:line từ nhiều agent → gộp lại), sort theo severity:
64
-
65
- ```
66
- ## Review Summary
67
-
68
- ### Critical (phải fix trước khi merge)
69
- - [file:line] Issue — Fix: ...
70
-
71
- ### High (nên fix trước khi merge)
72
- - [file:line] Issue — Fix: ...
73
-
74
- ### Medium (cân nhắc fix)
75
- - [file:line] Issue — Fix: ...
76
-
77
- ### Low / Info (optional)
78
- - [file:line] Issue — Fix: ...
79
- ```
80
-
81
- ## Sau khi review
82
-
83
- **Nếu có Critical/High:**
84
- Liệt rõ, yêu cầu human fix. KHÔNG tiếp tục flow.
85
-
86
- **Nếu chỉ Medium/Low:**
87
- List gợi ý, hỏi human có muốn fix không, sau đó tiếp tục.
88
-
89
- **Khi human xác nhận đã fix:**
90
- 1. Tick `- [x] Code review passed` trong section `## Definition of Done` của Story
91
- 2. Hỏi: "Bạn đã tự test lại ở local chưa? Nếu OK, có muốn chuyển ticket sang Deploy Test không?"
92
- 3. Nếu Yes:
93
- a. Cập nhật `Status:` trong Story `Deploy Test`
94
- b. Thêm dòng Changelog trong Story: ngày, "Code review passed, moved to Deploy Test"
95
- c. Cập nhật `Status:` trong Feature cha → `In Progress`, update bảng Stories
96
- d. Thêm Changelog trong Feature
97
- e. Cập nhật `project-status.yaml`
98
- f. Gợi ý: chạy `/ado-update story <ado-id> --status "Deploy Test"` nếu dùng ADO
99
-
100
- ## Nguyên tắc
101
- - Review khách quan chỉ ra file:line cụ thể do
102
- - Đề xuất fix cụ thể, không chỉ nói "code xấu"
103
- - Check xem code có vi phạm ADR nào không (đọc từ Technical Notes trong Story)
104
- - KHÔNG tự động chuyển status không xác nhận của human
1
+ # /tas-review $ARGUMENTS
2
+
3
+ Review code thay đổi gần nhất hoặc một file/PR cụ thể.
4
+ Bao gồm hygiene scan, test run, và parallel multi-agent review.
5
+
6
+ ## Stack Detection
7
+ Đọc `.claude/rules/common/stack-detection.md`.
8
+
9
+ ## Hành động
10
+
11
+ ### Bước 1 — Xác định scope review
12
+ `$ARGUMENTS` có thể là: file path, Story ID, hoặc để trống (review git diff).
13
+ - Nếu trống: lấy `git diff HEAD` (staged + unstaged) hoặc last commit
14
+ - Nếu Story ID: tìm file Story tương ứng để lấy danh sách files đã thay đổi
15
+ - Nếu file path: review trực tiếp file đó
16
+
17
+ ### Bước 2 — Pre-checks (PHẢI pass mới tiếp tục)
18
+
19
+ **Hygiene scan** — scan nhanh các files trong scope:
20
+ - Debug code còn sót: `console.log`, `print(`, `Debug.WriteLine`, `debugger`
21
+ - Secrets hardcoded: password/key/token/secret gán bằng string literal
22
+ - Commented-out code block lớn (>5 dòng) không có comment lý do
23
+
24
+ → Nếu có blocker: liệt kê ngay, yêu cầu fix trước khi tiếp tục.
25
+
26
+ **Run tests** — detect từ project structure:
27
+ - `package.json` → `yarn test --ci` hoặc `npm test`
28
+ - `*.csproj` / `*.sln` → `dotnet test`
29
+ - `pytest.ini` / `pyproject.toml` → `python -m pytest`
30
+
31
+ → Nếu **FAIL**: thêm finding **"Unit Test Failure"** severity **Critical**, dừng lại, KHÔNG tiếp tục review.
32
+ → Nếu **PASS**: ghi chú "Unit Tests: PASS" vào Review Summary.
33
+ → Nếu không detect được: ghi chú "No test runner detected" và tiếp tục.
34
+
35
+ ### Bước 3 — Parallel Multi-Agent Review
36
+
37
+ Launch các agents ĐỒNG THỜI (không chờ nhau):
38
+
39
+ **Agent 1 `code-reviewer`** (luôn chạy):
40
+ > Review [scope]. Đọc `.tas/checklists/code-review.md` `.claude/rules/common/code-review.md`.
41
+ > Tập trung: naming, architecture alignment, error handling, DRY, function size, nesting depth.
42
+ > Format: findings nhóm theo Critical / High / Medium / Low, mỗi finding có file:line và fix cụ thể.
43
+
44
+ **Agent 2 `security-reviewer`** (luôn chạy):
45
+ > Security audit [scope]. Đọc `.claude/rules/common/security.md`.
46
+ > Nếu stack đã xác định, đọc thêm `.claude/rules/[stack]/security.md`.
47
+ > Tập trung: OWASP Top 10, injection, hardcoded secrets, auth/authz, data exposure.
48
+ > Format: findings nhóm theo Critical / High / Medium / Low, mỗi finding có file:line và remediation.
49
+
50
+ **Agent 3 — Language reviewer** (dựa theo `lang_agent` từ stack detection):
51
+ > Language-specific review [scope].
52
+ > Đọc `.claude/rules/[stack]/coding-style.md`, `.claude/rules/[stack]/patterns.md`, `.claude/rules/[stack]/testing.md`.
53
+ > Nếu stack có React: đọc thêm `.claude/rules/web/design-quality.md`, `.claude/rules/web/testing.md`, `.claude/rules/web/performance.md`.
54
+ > Tập trung: async/await patterns, null handling, type safety, anti-patterns đặc thù của stack.
55
+ > Format: findings theo Critical / High / Medium / Low với file:line.
56
+
57
+ **Agent 4 `aws-reviewer`** (chỉ khi `infra_agent = aws-reviewer`):
58
+ > AWS infrastructure review [scope].
59
+ > Tập trung: IAM policies, secrets trong env/config, S3 permissions, Lambda security.
60
+ > Format: findings theo Critical / High / Medium / Low.
61
+
62
+ Chờ TẤT CẢ agents hoàn thành, sau đó tổng hợp.
63
+
64
+ ### Bước 4 — Tổng hợp kết quả
65
+
66
+ Gộp findings từ tất cả agents, deduplicate (cùng file:line từ nhiều agent → gộp lại), sort theo severity:
67
+
68
+ ```
69
+ ## Review Summary
70
+
71
+ ### Critical (phải fix trước khi merge)
72
+ - [file:line] Issue — Fix: ...
73
+
74
+ ### High (nên fix trước khi merge)
75
+ - [file:line] Issue — Fix: ...
76
+
77
+ ### Medium (cân nhắc fix)
78
+ - [file:line] Issue — Fix: ...
79
+
80
+ ### Low / Info (optional)
81
+ - [file:line] Issue — Fix: ...
82
+ ```
83
+
84
+ ## Sau khi review
85
+
86
+ **Nếu có Critical/High:**
87
+ Liệt rõ, yêu cầu human fix. KHÔNG tiếp tục flow.
88
+
89
+ **Nếu chỉ Medium/Low:**
90
+ List gợi ý, hỏi human muốn fix không, sau đó tiếp tục.
91
+
92
+ **Khi human xác nhận đã fix:**
93
+ 1. Tick `- [x] Code review passed` trong section `## Definition of Done` của Story
94
+ 2. Hỏi: "Bạn đã tự test lại local chưa? Nếu OK, muốn chuyển ticket sang Deploy Test không?"
95
+ 3. Nếu Yes:
96
+ a. Cập nhật `Status:` trong Story → `Deploy Test`
97
+ b. Thêm dòng Changelog trong Story: ngày, "Code review passed, moved to Deploy Test"
98
+ c. Cập nhật `Status:` trong Feature cha `In Progress`, update bảng Stories
99
+ d. Thêm Changelog trong Feature
100
+ e. Cập nhật `project-status.yaml`
101
+ f. Gợi ý: chạy `/ado-update story <ado-id> --status "Deploy Test"` nếu dùng ADO
102
+
103
+ ## Nguyên tắc
104
+ - Review khách quan chỉ ra file:line cụ thể do
105
+ - Đề xuất fix cụ thể, không chỉ nói "code xấu"
106
+ - Check xem code có vi phạm ADR nào không (đọc từ Technical Notes trong Story)
107
+ - KHÔNG tự động chuyển status mà không có xác nhận của human
108
+
109
+ ## Bước cuối — Token Log
110
+
111
+ Invoke skill `token-logger`: ghi AI Usage Log vào file Story đang review (nếu có).
@@ -1,39 +1,43 @@
1
- # /tas-sad $ARGUMENTS
2
-
3
- Vai trò: SE - Software Engineer
4
- Tạo hoặc cập nhật Solution Architecture Document.
5
-
6
- ## Prerequisite
7
- - 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.
8
-
9
- ## Hành động
10
- 1. Cần context từ root/tas.yaml để lấy project info, workflow config
11
- 2. Cần context từ docs/prd.md để hiểu requirements
12
- 3. Nếu brownfield: cần context từ docs/codebase-overview.md nếu có
13
- 4. Kiểm tra docs/sad.md đã tồn tại chưa:
14
-
15
- ### Chế độ CREATE (file chưa tồn tại):
16
- 5. Cần context từ .tas/templates/SAD.md
17
- 6. Tạo file docs/sad.md theo template SAD của Torus
18
- 7. Cập nhật `project-status.yaml` theo `.claude/rules/common/project-status.md` — thêm `artifacts.sad`.
19
-
20
- ### Chế độ UPDATE (file đã tồn tại):
21
- 5. Cần context từ docs/sad.md hiện tại
22
- 6. $ARGUMENTS là mô tả thay đổi. Nếu không có, hỏi user cần cập nhật section nào.
23
- 7. Cập nhật file, giữ nguyên các section không thay đổi
24
- 8. Thêm dòng vào section Changelog cuối file
25
- 9. Nếu thay đổi là quyết định kiến trúc quan trọng, gợi ý user chạy /tas-adr
26
- 10. Cập nhật `project-status.yaml` theo `.claude/rules/common/project-status.md` — cập nhật `artifacts.sad`.
27
-
28
- ## Quy tắc Mermaid
29
- - Các sơ đồ C4 PHẢI dùng Mermaid flow diagram
30
- - Bắt đầu bằng :::mermaid, kết thúc bằng :::
31
- - KHÔNG dùng ký tự () trong node labels, thay bằng []
32
- - Ví dụ: A["Web App"] --> B["API Gateway"]
33
- - Bao gồm các view: System Context, Container, Component, Data, Deployment
34
-
35
- ## Nguyên tắc
36
- - SAD phải align với tech stack trong CLAUDE.md
37
- - Mỗi architectural decision quan trọng cần reference sang ADR
38
- - ERD phải dùng Mermaid erDiagram
39
- - Sequence diagram dùng Mermaid sequenceDiagram
1
+ # /tas-sad $ARGUMENTS
2
+
3
+ Vai trò: SE - Software Engineer
4
+ Tạo hoặc cập nhật Solution Architecture Document.
5
+
6
+ ## Prerequisite
7
+ - 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.
8
+
9
+ ## Hành động
10
+ 1. Cần context từ root/tas.yaml để lấy project info, workflow config
11
+ 2. Cần context từ docs/prd.md để hiểu requirements
12
+ 3. Nếu brownfield: cần context từ docs/codebase-overview.md nếu có
13
+ 4. Kiểm tra docs/sad.md đã tồn tại chưa:
14
+
15
+ ### Chế độ CREATE (file chưa tồn tại):
16
+ 5. Cần context từ .tas/templates/SAD.md
17
+ 6. Tạo file docs/sad.md theo template SAD của Torus
18
+ 7. Cập nhật `project-status.yaml` theo `.claude/rules/common/project-status.md` — thêm `artifacts.sad`.
19
+
20
+ ### Chế độ UPDATE (file đã tồn tại):
21
+ 5. Cần context từ docs/sad.md hiện tại
22
+ 6. $ARGUMENTS là mô tả thay đổi. Nếu không có, hỏi user cần cập nhật section nào.
23
+ 7. Cập nhật file, giữ nguyên các section không thay đổi
24
+ 8. Thêm dòng vào section Changelog cuối file
25
+ 9. Nếu thay đổi là quyết định kiến trúc quan trọng, gợi ý user chạy /tas-adr
26
+ 10. Cập nhật `project-status.yaml` theo `.claude/rules/common/project-status.md` — cập nhật `artifacts.sad`.
27
+
28
+ ## Quy tắc Mermaid
29
+ - Các sơ đồ C4 PHẢI dùng Mermaid flow diagram
30
+ - Bắt đầu bằng :::mermaid, kết thúc bằng :::
31
+ - KHÔNG dùng ký tự () trong node labels, thay bằng []
32
+ - Ví dụ: A["Web App"] --> B["API Gateway"]
33
+ - Bao gồm các view: System Context, Container, Component, Data, Deployment
34
+
35
+ ## Nguyên tắc
36
+ - SAD phải align với tech stack trong CLAUDE.md
37
+ - Mỗi architectural decision quan trọng cần reference sang ADR
38
+ - ERD phải dùng Mermaid erDiagram
39
+ - Sequence diagram dùng Mermaid sequenceDiagram
40
+
41
+ ## Bước cuối — Token Log
42
+
43
+ Invoke skill `token-logger`: ghi AI Usage Log vào `docs/sad.md`.
@@ -1,80 +1,81 @@
1
- # /tas-security $ARGUMENTS
2
-
3
- Kiểm tra bảo mật codebase, lưu báo cáo vào docs/security-report.md.
4
-
5
- ## Stack Detection
6
- Đọc `.claude/rules/common/stack-detection.md`.
7
-
8
- ## Hành động
9
-
10
- ### Bước 1 — Xác định scope
11
- `$ARGUMENTS` có thể là: file path, directory, hoặc để trống (scan toàn bộ codebase).
12
- Đọc `.tas/checklists/security.md` để lấy checklist.
13
-
14
- ### Bước 2 — Parallel Security Scan
15
-
16
- Launch các agents ĐỒNG THỜI dựa theo stack:
17
-
18
- **Agent 1 — `security-reviewer`** (luôn chạy):
19
- > Security audit [scope].
20
- > Đọc `.claude/rules/common/security.md`.
21
- > Kiểm tra OWASP Top 10: injection, broken auth, XSS, IDOR, security misconfiguration,
22
- > sensitive data exposure, insecure deserialization, vulnerable components, logging/monitoring.
23
- > Kiểm tra thêm: hardcoded secrets, CORS config, anti-forgery tokens, rate limiting.
24
- > Format: findings theo Critical / High / Medium / Low với file:line và remediation cụ thể.
25
- > Mỗi finding có: status = Open.
26
-
27
- **Agent 2 — `database-reviewer`** (chỉ khi `db_agent = database-reviewer`):
28
- > Database security review [scope].
29
- > Tập trung: parameterized queries vs string concatenation, ORM raw query usage,
30
- > sensitive data stored in plaintext, missing field-level encryption, excessive permissions.
31
- > Format: findings theo Critical / High / Medium / Low với file:line và remediation.
32
-
33
- **Agent 3 — `aws-reviewer`** (chỉ khi `infra_agent = aws-reviewer`):
34
- > AWS infrastructure security review [scope].
35
- > Tập trung: IAM overpermission, S3 public access, secrets trong env/config/code,
36
- > Lambda environment variables, API Gateway auth, VPC security groups.
37
- > Format: findings theo Critical / High / Medium / Low với file:line và remediation.
38
-
39
- Chờ TẤT CẢ agents hoàn thành.
40
-
41
- ### Bước 3 — Tổng hợp và lưu báo cáo
42
-
43
- Gộp findings từ tất cả agents, deduplicate (cùng file:line → gộp), sort theo severity.
44
-
45
- Kiểm tra `docs/security-report.md`:
46
- - **Chưa có**: tạo mới theo template `.tas/templates/Security-Report.md`
47
- - **Đã có**: append report mới, cập nhật status findings cũ nếu đã được fix
48
-
49
- Nội dung report bao gồm:
50
- - Scan date, scope, stack
51
- - Findings theo Critical / High / Medium / Low
52
- - Mỗi finding: file:line, tả, remediation, status (Open / Fixed / Accepted Risk)
53
- - Summary: tổng số findings mỗi severity, số đã fix vs còn open
54
-
55
- ### Bước 4 — Cập nhật project-status.yaml
56
-
57
- ```yaml
58
- artifacts:
59
- security_report:
60
- file: docs/security-report.md
61
- status: [Critical findings present | Clean]
62
- last_updated: [ngày hôm nay]
63
- ```
64
-
65
- ### Bước 5 — Hành động tiếp theo
66
-
67
- Nếu có **Critical findings**:
68
- Liệt rõ, yêu cầu fix ngay trước khi deploy bất kỳ môi trường nào.
69
-
70
- Nếu có **High findings**:
71
- Liệt kê, khuyến nghị fix trước khi merge vào main.
72
-
73
- Nếu chỉ có **Medium/Low**:
74
- Tóm tắt, gợi ý fix theo thứ tự ưu tiên.
75
-
76
- ## Nguyên tắc
77
- - Phân loại: Critical / High / Medium / Low
78
- - Mỗi finding phải recommended fix cụ thể
79
- - Finding status: Open | In Progress | Fixed | Accepted Risk
80
- - KHÔNG hardcode fix đề xuất remediation pattern, không viết code thay thế
1
+ # /tas-security $ARGUMENTS
2
+
3
+ Kiểm tra bảo mật codebase, lưu báo cáo vào docs/security-report.md.
4
+
5
+ ## Stack Detection
6
+ Đọc `.claude/rules/common/stack-detection.md`.
7
+
8
+ ## Hành động
9
+
10
+ ### Bước 1 — Xác định scope
11
+ `$ARGUMENTS` có thể là: file path, directory, hoặc để trống (scan toàn bộ codebase).
12
+ Đọc `.tas/checklists/security.md` để lấy checklist.
13
+
14
+ ### Bước 2 — Parallel Security Scan
15
+
16
+ Launch các agents ĐỒNG THỜI dựa theo stack:
17
+
18
+ **Agent 1 — `security-reviewer`** (luôn chạy):
19
+ > Security audit [scope].
20
+ > Đọc `.claude/rules/common/security.md`.
21
+ > Nếu stack đã xác định, đọc thêm `.claude/rules/[stack]/security.md`.
22
+ > Kiểm tra OWASP Top 10: injection, broken auth, XSS, IDOR, security misconfiguration,
23
+ > sensitive data exposure, insecure deserialization, vulnerable components, logging/monitoring.
24
+ > Kiểm tra thêm: hardcoded secrets, CORS config, anti-forgery tokens, rate limiting.
25
+ > Format: findings theo Critical / High / Medium / Low với file:line và remediation cụ thể.
26
+ > Mỗi finding có: status = Open.
27
+
28
+ **Agent 2 `database-reviewer`** (chỉ khi `db_agent = database-reviewer`):
29
+ > Database security review [scope].
30
+ > Tập trung: parameterized queries vs string concatenation, ORM raw query usage,
31
+ > sensitive data stored in plaintext, missing field-level encryption, excessive permissions.
32
+ > Format: findings theo Critical / High / Medium / Low với file:line và remediation.
33
+
34
+ **Agent 3 `aws-reviewer`** (chỉ khi `infra_agent = aws-reviewer`):
35
+ > AWS infrastructure security review [scope].
36
+ > Tập trung: IAM overpermission, S3 public access, secrets trong env/config/code,
37
+ > Lambda environment variables, API Gateway auth, VPC security groups.
38
+ > Format: findings theo Critical / High / Medium / Low với file:line và remediation.
39
+
40
+ Chờ TẤT CẢ agents hoàn thành.
41
+
42
+ ### Bước 3 — Tổng hợp và lưu báo cáo
43
+
44
+ Gộp findings từ tất cả agents, deduplicate (cùng file:line → gộp), sort theo severity.
45
+
46
+ Kiểm tra `docs/security-report.md`:
47
+ - **Chưa có**: tạo mới theo template `.tas/templates/Security-Report.md`
48
+ - **Đã có**: append report mới, cập nhật status findings cũ nếu đã được fix
49
+
50
+ Nội dung report bao gồm:
51
+ - Scan date, scope, stack
52
+ - Findings theo Critical / High / Medium / Low
53
+ - Mỗi finding: file:line, tả, remediation, status (Open / Fixed / Accepted Risk)
54
+ - Summary: tổng số findings mỗi severity, số đã fix vs còn open
55
+
56
+ ### Bước 4 — Cập nhật project-status.yaml
57
+
58
+ ```yaml
59
+ artifacts:
60
+ security_report:
61
+ file: docs/security-report.md
62
+ status: [Critical findings present | Clean]
63
+ last_updated: [ngày hôm nay]
64
+ ```
65
+
66
+ ### Bước 5 — Hành động tiếp theo
67
+
68
+ Nếu **Critical findings**:
69
+ → Liệt kê rõ, yêu cầu fix ngay trước khi deploy bất kỳ môi trường nào.
70
+
71
+ Nếu **High findings**:
72
+ → Liệt kê, khuyến nghị fix trước khi merge vào main.
73
+
74
+ Nếu chỉ **Medium/Low**:
75
+ → Tóm tắt, gợi ý fix theo thứ tự ưu tiên.
76
+
77
+ ## Nguyên tắc
78
+ - Phân loại: Critical / High / Medium / Low
79
+ - Mỗi finding phải recommended fix cụ thể
80
+ - Finding status: Open | In Progress | Fixed | Accepted Risk
81
+ - KHÔNG hardcode fix — đề xuất remediation pattern, không viết code thay thế