@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.
- package/.claude/commands/tas-adr.md +33 -29
- package/.claude/commands/tas-api-test.md +95 -0
- package/.claude/commands/tas-bug.md +113 -109
- package/.claude/commands/tas-design.md +37 -33
- package/.claude/commands/tas-dev.md +128 -115
- package/.claude/commands/tas-e2e-mobile.md +155 -0
- package/.claude/commands/tas-e2e-web.md +163 -0
- package/.claude/commands/tas-e2e.md +102 -0
- package/.claude/commands/tas-epic.md +35 -31
- package/.claude/commands/tas-feature.md +47 -43
- package/.claude/commands/tas-fix.md +51 -47
- package/.claude/commands/tas-functest-mobile.md +144 -0
- package/.claude/commands/tas-functest-web.md +192 -0
- package/.claude/commands/tas-functest.md +76 -0
- package/.claude/commands/tas-plan.md +200 -184
- package/.claude/commands/tas-prd.md +37 -33
- package/.claude/commands/tas-review.md +111 -104
- package/.claude/commands/tas-sad.md +43 -39
- package/.claude/commands/tas-security.md +81 -80
- package/.claude/commands/tas-story.md +91 -87
- package/.claude/commands/tas-verify.md +51 -41
- package/.claude/rules/common/post-review-agent.md +49 -39
- package/.claude/rules/common/testing.md +24 -0
- package/.claude/rules/common/token-logging.md +27 -0
- package/.claude/rules/csharp/api-testing.md +171 -0
- package/.claude/rules/csharp/patterns.md +10 -0
- package/.claude/rules/python/patterns.md +10 -0
- package/.claude/rules/typescript/patterns.md +10 -0
- package/.claude/rules/web/performance.md +9 -0
- package/.claude/skills/api-design/SKILL.md +3 -1
- package/.claude/skills/{backend-patterns → js-backend-patterns}/SKILL.md +2 -1
- package/.claude/skills/tas-implementation-complete/SKILL.md +99 -97
- package/.claude/skills/tas-tdd/SKILL.md +123 -82
- package/.claude/skills/token-logger/SKILL.md +19 -0
- package/.tas/templates/E2E-Execution-Report.md +198 -0
- package/.tas/templates/E2E-Mobile-Spec.md +130 -0
- package/.tas/templates/E2E-Report.md +174 -0
- package/.tas/templates/E2E-Scenario.md +180 -0
- package/.tas/templates/E2E-Web-Spec.md +164 -0
- package/.tas/templates/Feature.md +55 -55
- package/.tas/templates/Func-Test-Script.md +254 -0
- package/.tas/templates/Func-Test-Spec.md +187 -0
- package/.tas/templates/SAD.md +274 -64
- package/.tas/templates/Story.md +90 -88
- package/bin/cli.js +56 -49
- package/lib/deleted-files.json +33 -0
- package/lib/install.js +213 -114
- package/package.json +34 -34
- package/.claude/agents/README.md +0 -83
- package/.claude/agents/ado-agent.md +0 -39
- package/.claude/agents/code-architect.md +0 -62
- package/.claude/agents/code-simplifier.md +0 -53
- package/.claude/agents/comment-analyzer.md +0 -59
- package/.claude/agents/conversation-analyzer.md +0 -57
- package/.claude/agents/docs-lookup.md +0 -55
- package/.claude/agents/harness-optimizer.md +0 -62
- package/.claude/agents/loop-operator.md +0 -56
- package/.claude/agents/performance-optimizer.md +0 -78
- package/.claude/agents/pr-test-analyzer.md +0 -68
- package/.claude/agents/pytorch-build-resolver.md +0 -76
- package/.claude/agents/refactor-cleaner.md +0 -70
- package/.claude/agents/seo-specialist.md +0 -75
- package/.claude/agents/silent-failure-hunter.md +0 -69
- package/.claude/agents/type-design-analyzer.md +0 -75
- package/.claude/rules/common/agents.md +0 -65
- package/.claude/rules/common/coding-style.md +0 -90
- package/.claude/rules/common/development-workflow.md +0 -44
- package/.claude/rules/common/git-workflow.md +0 -24
- package/.claude/rules/common/performance.md +0 -55
- package/.claude/skills/agent-harness-construction/SKILL.md +0 -77
- 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
|
|
32
|
-
→ Nếu
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
>
|
|
41
|
-
>
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
>
|
|
46
|
-
>
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
>
|
|
52
|
-
>
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
>
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
###
|
|
72
|
-
- [file:line] Issue — Fix: ...
|
|
73
|
-
|
|
74
|
-
###
|
|
75
|
-
- [file:line] Issue — Fix: ...
|
|
76
|
-
|
|
77
|
-
###
|
|
78
|
-
- [file:line] Issue — Fix: ...
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
**Nếu
|
|
87
|
-
→
|
|
88
|
-
|
|
89
|
-
**
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
-
|
|
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` và `.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 kê rõ, yêu cầu human fix. KHÔNG tiếp tục flow.
|
|
88
|
+
|
|
89
|
+
**Nếu chỉ có Medium/Low:**
|
|
90
|
+
→ List gợi ý, hỏi human có 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, có 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ể và lý 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
|
-
>
|
|
22
|
-
>
|
|
23
|
-
>
|
|
24
|
-
>
|
|
25
|
-
>
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
>
|
|
30
|
-
>
|
|
31
|
-
>
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
>
|
|
36
|
-
>
|
|
37
|
-
>
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
-
|
|
52
|
-
-
|
|
53
|
-
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
-
|
|
79
|
-
-
|
|
80
|
-
-
|
|
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, mô 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 có **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 có **High findings**:
|
|
72
|
+
→ Liệt kê, khuyến nghị fix trước khi merge vào main.
|
|
73
|
+
|
|
74
|
+
Nếu chỉ có **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 có recommended fix cụ thể
|
|
80
|
+
- Finding có status: Open | In Progress | Fixed | Accepted Risk
|
|
81
|
+
- KHÔNG hardcode fix — đề xuất remediation pattern, không viết code thay thế
|