@torus-engineering/tas-kit 1.7.0 → 1.9.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-apitest-plan.md +173 -0
- package/.claude/commands/tas-apitest.md +143 -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/API-Test-Spec.md +400 -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 -274
- package/.tas/templates/Story.md +90 -88
- package/bin/cli.js +56 -56
- package/lib/deleted-files.json +36 -0
- package/lib/install.js +213 -176
- 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,29 +1,33 @@
|
|
|
1
|
-
# /tas-adr $ARGUMENTS
|
|
2
|
-
|
|
3
|
-
Vai trò: SE - Software Engineer
|
|
4
|
-
Tạo mới hoặc cập nhật Architecture Decision Record.
|
|
5
|
-
|
|
6
|
-
## Hành động
|
|
7
|
-
1. Cần context từ .tas/templates/ADR.md
|
|
8
|
-
2. Quét docs/adr/ để xác định các ADR hiện có
|
|
9
|
-
3. Xác định chế độ dựa vào $ARGUMENTS:
|
|
10
|
-
|
|
11
|
-
### Chế độ CREATE ($ARGUMENTS là tiêu đề mới, ví dụ: "Use CQRS for Order Service"):
|
|
12
|
-
4. Xác định số thứ tự tiếp theo (ADR-001, ADR-002...)
|
|
13
|
-
5. Nếu docs/sad.md tồn tại, cần context từ SAD để đảm bảo ADR consistent
|
|
14
|
-
6. Tạo file docs/adr/ADR-{NNN}-{slug}.md
|
|
15
|
-
7. Cập nhật `project-status.yaml` theo `.claude/rules/common/project-status.md` — thêm entry vào `adrs`.
|
|
16
|
-
|
|
17
|
-
### Chế độ UPDATE ($ARGUMENTS là ADR ID, ví dụ: "ADR-001"):
|
|
18
|
-
4. Cần context từ file ADR hiện tại
|
|
19
|
-
5. Hỏi user cần thay đổi gì (cập nhật status, thêm consequences, supersede...)
|
|
20
|
-
6. Cập nhật file, thêm changelog
|
|
21
|
-
7. Nếu supersede: cập nhật status ADR cũ thành "Superseded by ADR-{NNN}"
|
|
22
|
-
8. Cập nhật `project-status.yaml` theo `.claude/rules/common/project-status.md` — cập nhật `adrs.{ADR_ID}.status`.
|
|
23
|
-
|
|
24
|
-
## Nguyên tắc
|
|
25
|
-
- ADR phải có: Context, Decision, Rationale, Consequences, Alternatives Considered
|
|
26
|
-
- Status: Proposed | Accepted | Deprecated | Superseded
|
|
27
|
-
- Mỗi ADR độc lập, tự chứa đủ context để hiểu
|
|
28
|
-
- Link sang ADR liên quan nếu có (Supersedes, Related to)
|
|
29
|
-
- Sơ đồ Mermaid tuân thủ quy tắc: :::mermaid wrapper, không dùng ()
|
|
1
|
+
# /tas-adr $ARGUMENTS
|
|
2
|
+
|
|
3
|
+
Vai trò: SE - Software Engineer
|
|
4
|
+
Tạo mới hoặc cập nhật Architecture Decision Record.
|
|
5
|
+
|
|
6
|
+
## Hành động
|
|
7
|
+
1. Cần context từ .tas/templates/ADR.md
|
|
8
|
+
2. Quét docs/adr/ để xác định các ADR hiện có
|
|
9
|
+
3. Xác định chế độ dựa vào $ARGUMENTS:
|
|
10
|
+
|
|
11
|
+
### Chế độ CREATE ($ARGUMENTS là tiêu đề mới, ví dụ: "Use CQRS for Order Service"):
|
|
12
|
+
4. Xác định số thứ tự tiếp theo (ADR-001, ADR-002...)
|
|
13
|
+
5. Nếu docs/sad.md tồn tại, cần context từ SAD để đảm bảo ADR consistent
|
|
14
|
+
6. Tạo file docs/adr/ADR-{NNN}-{slug}.md
|
|
15
|
+
7. Cập nhật `project-status.yaml` theo `.claude/rules/common/project-status.md` — thêm entry vào `adrs`.
|
|
16
|
+
|
|
17
|
+
### Chế độ UPDATE ($ARGUMENTS là ADR ID, ví dụ: "ADR-001"):
|
|
18
|
+
4. Cần context từ file ADR hiện tại
|
|
19
|
+
5. Hỏi user cần thay đổi gì (cập nhật status, thêm consequences, supersede...)
|
|
20
|
+
6. Cập nhật file, thêm changelog
|
|
21
|
+
7. Nếu supersede: cập nhật status ADR cũ thành "Superseded by ADR-{NNN}"
|
|
22
|
+
8. Cập nhật `project-status.yaml` theo `.claude/rules/common/project-status.md` — cập nhật `adrs.{ADR_ID}.status`.
|
|
23
|
+
|
|
24
|
+
## Nguyên tắc
|
|
25
|
+
- ADR phải có: Context, Decision, Rationale, Consequences, Alternatives Considered
|
|
26
|
+
- Status: Proposed | Accepted | Deprecated | Superseded
|
|
27
|
+
- Mỗi ADR độc lập, tự chứa đủ context để hiểu
|
|
28
|
+
- Link sang ADR liên quan nếu có (Supersedes, Related to)
|
|
29
|
+
- Sơ đồ Mermaid tuân thủ quy tắc: :::mermaid wrapper, không dùng ()
|
|
30
|
+
|
|
31
|
+
## Bước cuối — Token Log
|
|
32
|
+
|
|
33
|
+
Invoke skill `token-logger`: ghi AI Usage Log vào file ADR đang làm việc.
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
# /tas-apitest-plan $ARGUMENTS
|
|
2
|
+
|
|
3
|
+
Vai trò: SE - Software Engineer
|
|
4
|
+
Generate API Test Specification (Markdown) từ API Spec (OpenAPI 3.0, Markdown, YAML) hoặc phân tích code API.
|
|
5
|
+
|
|
6
|
+
## Always / Ask / Never
|
|
7
|
+
|
|
8
|
+
| | Hành động |
|
|
9
|
+
|---|---|
|
|
10
|
+
| **Always** | Đọc toàn bộ spec hoặc phân tích code trước khi tạo test spec |
|
|
11
|
+
| **Always** | Tổ chức test cases theo API version — mỗi version một section riêng |
|
|
12
|
+
| **Always** | Append-only: không sửa sections trong version cũ đã tồn tại |
|
|
13
|
+
| **Always** | Coverage matrix: mỗi endpoint cần ≥1 happy path + ≥1 error path |
|
|
14
|
+
| **Always** | Đọc `.claude/rules/csharp/api-testing.md` để nắm convention |
|
|
15
|
+
| **Ask** | Khi spec không rõ expected response schema hoặc business rule |
|
|
16
|
+
| **Never** | Sử dụng version folder/syntax trong test spec file (dùng section headers thay vì) |
|
|
17
|
+
| **Never** | Bỏ qua error path — mỗi endpoint cần cover validation errors |
|
|
18
|
+
|
|
19
|
+
## Hành động
|
|
20
|
+
|
|
21
|
+
### Bước 1 — Locate Inputs
|
|
22
|
+
|
|
23
|
+
`$ARGUMENTS` là path đến:
|
|
24
|
+
- API Spec file (OpenAPI 3.0 JSON/YAML, Markdown)
|
|
25
|
+
- Hoặc Story ID — glob tìm `docs/epics/**/Story-{ID}*.md`
|
|
26
|
+
- Hoặc path tới project code API cần phân tích
|
|
27
|
+
|
|
28
|
+
Nếu không có → hỏi user:
|
|
29
|
+
```
|
|
30
|
+
Nhập input cho /tas-apitest-plan:
|
|
31
|
+
1. Path đến API Spec file (OpenAPI/Markdown/YAML)
|
|
32
|
+
2. Story ID (để tìm link spec trong Story)
|
|
33
|
+
3. Path đến code API cần phân tích tự động
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Bước 2 — Detect Existing Test Spec
|
|
37
|
+
|
|
38
|
+
Glob tìm `docs/tests/API-Test-Spec-*.md`.
|
|
39
|
+
|
|
40
|
+
- **Tìm thấy**: Đọc file, detect versions đã có (tìm section headers `## v{N}`)
|
|
41
|
+
- **Không tìm thấy**: Tạo mới với version v1
|
|
42
|
+
|
|
43
|
+
### Bước 3 — Parse Input
|
|
44
|
+
|
|
45
|
+
**Nếu là API Spec file:**
|
|
46
|
+
- Đọc và parse OpenAPI/Markdown/YAML
|
|
47
|
+
- Thu thập cho mỗi endpoint:
|
|
48
|
+
- HTTP method + path, path/query params, request body schema
|
|
49
|
+
- Response schemas theo từng status code
|
|
50
|
+
- Auth requirement, description/summary
|
|
51
|
+
- Tags để nhóm endpoints
|
|
52
|
+
|
|
53
|
+
**Nếu là Story:**
|
|
54
|
+
- Đọc Story để tìm link spec trong `## Technical Plan` hoặc `## Acceptance Criteria`
|
|
55
|
+
- Parse spec như trên
|
|
56
|
+
- Thêm AC mapping vào test spec
|
|
57
|
+
|
|
58
|
+
**Nếu là code path:**
|
|
59
|
+
- Glob tìm controller/handler files (`.cs`, `.ts`, `.py` tùy stack)
|
|
60
|
+
- Phân tích attributes/routes để phát hiện endpoints
|
|
61
|
+
- Extract DTO classes để biết request/response schema
|
|
62
|
+
- Hỏi user confirm nếu detect không rõ
|
|
63
|
+
|
|
64
|
+
### Bước 4 — Detect API Version
|
|
65
|
+
|
|
66
|
+
Ưu tiên theo thứ tự:
|
|
67
|
+
1. `info.version` trong OpenAPI
|
|
68
|
+
2. Prefix trong URL path (v1/, v2/)
|
|
69
|
+
3. Hỏi user
|
|
70
|
+
|
|
71
|
+
Version format: `v1`, `v2` (không có dot).
|
|
72
|
+
|
|
73
|
+
### Bước 5 — Determine Output Path
|
|
74
|
+
|
|
75
|
+
Output: `docs/tests/API-Test-Spec-{slug}.md`
|
|
76
|
+
|
|
77
|
+
**Slug generation:**
|
|
78
|
+
- Từ `api_name` trong spec → lowercase, replace spaces với dashes
|
|
79
|
+
- Hoặc hỏi user nhập slug ngắn gọn (ví dụ: `users`, `orders`, `products`)
|
|
80
|
+
|
|
81
|
+
### Bước 6 — Determine Update Mode
|
|
82
|
+
|
|
83
|
+
Nếu spec file đã tồn tại và version đã có:
|
|
84
|
+
- **Append mode** (default): thêm test cases mới vào cuối section version hiện tại
|
|
85
|
+
- Hỏi user nếu muốn tạo version mới (v2, v3...):
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
Spec file đã có với version {current}. Bạn muốn:
|
|
89
|
+
1. Append test cases vào version {current} (default)
|
|
90
|
+
2. Tạo version mới (v{next}) cho test cases
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Bước 7 — Generate Test Spec
|
|
94
|
+
|
|
95
|
+
Đọc template `.tas/templates/API-Test-Spec.md` để nắm cấu trúc.
|
|
96
|
+
|
|
97
|
+
**Phân tích endpoints để tạo coverage matrix:**
|
|
98
|
+
|
|
99
|
+
Với mỗi endpoint, generate test cases cho:
|
|
100
|
+
1. **Happy path** (2xx) — luôn có
|
|
101
|
+
2. **Unauthorized** (401) — nếu endpoint yêu cầu auth
|
|
102
|
+
3. **Forbidden** (403) — nếu có RBAC/ownership check
|
|
103
|
+
4. **Not found** (404) — nếu có path param
|
|
104
|
+
5. **Validation error** (400/422) — nếu có required fields hoặc business rules
|
|
105
|
+
6. **Business rules** — từ Story ACs hoặc spec descriptions
|
|
106
|
+
|
|
107
|
+
**Coverage matrix format:**
|
|
108
|
+
```
|
|
109
|
+
| Endpoint | Happy Path | 401 Unauthorized | 403 Forbidden | 404 Not Found | 400/422 Validation | Business Rule |
|
|
110
|
+
|----------|:---------:|:----------------:|:-------------:|:-------------:|:------------------:|:-------------:|
|
|
111
|
+
| GET /api/users | ✓ | ✓ | | | | |
|
|
112
|
+
| POST /api/users | ✓ | ✓ | | | ✓ | |
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
**Test case detail format:**
|
|
116
|
+
```
|
|
117
|
+
#### TC-XXX: {Title} — {Modifier}
|
|
118
|
+
- **Endpoint**: `{METHOD} {path}`
|
|
119
|
+
- **Auth**: Required/Not Required
|
|
120
|
+
- **Preconditions**:
|
|
121
|
+
- {List preconditions}
|
|
122
|
+
- **Request Query/Path/Body**:
|
|
123
|
+
- {Request details}
|
|
124
|
+
- **Expected Response**:
|
|
125
|
+
- Status: {code}
|
|
126
|
+
- Body: {schema}
|
|
127
|
+
- **Assertions**:
|
|
128
|
+
- {List assertions}
|
|
129
|
+
- **AC Reference**: AC-{N} (nếu có)
|
|
130
|
+
- **Test Method Name**: `{Method}_{Resource}_Returns{Status}_When{Condition}`
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Bước 8 — Write Test Spec File
|
|
134
|
+
|
|
135
|
+
**File chưa tồn tại:** Tạo mới từ template.
|
|
136
|
+
|
|
137
|
+
**File đã tồn tại (append mode):**
|
|
138
|
+
- Đọc file hiện tại
|
|
139
|
+
- Find section `## v{N}` mà đang làm việc
|
|
140
|
+
- Append test cases mới vào cuối section trước `## Version History` hoặc `## Changelog`
|
|
141
|
+
- Preserve toàn bộ content cũ
|
|
142
|
+
|
|
143
|
+
### Bước 9 — Summary
|
|
144
|
+
|
|
145
|
+
Hiển thị:
|
|
146
|
+
1. Output file path
|
|
147
|
+
2. Number of endpoints detected
|
|
148
|
+
3. Number of test cases generated
|
|
149
|
+
4. Coverage matrix
|
|
150
|
+
5. Next steps:
|
|
151
|
+
- Review test spec file
|
|
152
|
+
- Run `/tas-apitest docs/tests/API-Test-Spec-{slug}.md` để generate code
|
|
153
|
+
|
|
154
|
+
```
|
|
155
|
+
## API Test Spec Generated
|
|
156
|
+
|
|
157
|
+
**Output**: `docs/tests/API-Test-Spec-{slug}.md`
|
|
158
|
+
**Version**: v{N}
|
|
159
|
+
**Endpoints**: {N}
|
|
160
|
+
**Test Cases**: {N}
|
|
161
|
+
|
|
162
|
+
### Coverage Matrix
|
|
163
|
+
[Print coverage matrix]
|
|
164
|
+
|
|
165
|
+
### Next Steps
|
|
166
|
+
1. Review test spec: `docs/tests/API-Test-Spec-{slug}.md`
|
|
167
|
+
2. Generate test code: `/tas-apitest docs/tests/API-Test-Spec-{slug}.md`
|
|
168
|
+
3. Run tests: `dotnet test tests/ApiTests/`
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Bước cuối — Token Log
|
|
172
|
+
|
|
173
|
+
Invoke skill `token-logger`: ghi AI Usage Log vào test spec file.
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
# /tas-apitest $ARGUMENTS
|
|
2
|
+
|
|
3
|
+
Vai trò: SE - Software Engineer
|
|
4
|
+
Generate .NET xUnit automation test project cho REST API từ API Test Spec file (Markdown).
|
|
5
|
+
|
|
6
|
+
## Always / Ask / Never
|
|
7
|
+
|
|
8
|
+
| | Hành động |
|
|
9
|
+
|---|---|
|
|
10
|
+
| **Always** | Đọc toàn bộ API Test Spec file trước khi generate bất kỳ test nào |
|
|
11
|
+
| **Always** | Tổ chức tests theo API version — mỗi version một folder riêng |
|
|
12
|
+
| **Always** | Append-only: không sửa files trong version folder cũ đã tồn tại |
|
|
13
|
+
| **Always** | URL và credentials ra `appsettings.json` — không hardcode trong code |
|
|
14
|
+
| **Always** | XML doc comment trên mỗi test method |
|
|
15
|
+
| **Ask** | Khi test spec không rõ expected response schema |
|
|
16
|
+
| **Never** | Sửa hoặc xóa test files của version cũ hơn |
|
|
17
|
+
| **Never** | Hardcode base URL, API key, credentials trong test code |
|
|
18
|
+
| **Never** | Bỏ qua error path — mỗi endpoint cần ≥1 happy path + ≥1 error path |
|
|
19
|
+
|
|
20
|
+
## Hành động
|
|
21
|
+
|
|
22
|
+
### Bước 1 — Locate Input
|
|
23
|
+
|
|
24
|
+
`$ARGUMENTS` là path đến API Test Spec file: `docs/tests/API-Test-Spec-{slug}.md`.
|
|
25
|
+
|
|
26
|
+
Nếu không có → hỏi user:
|
|
27
|
+
```
|
|
28
|
+
Nhập path đến API Test Spec file (vd: docs/tests/API-Test-Spec-users.md)
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Bước 2 — Parse API Test Spec
|
|
32
|
+
|
|
33
|
+
Đọc `.claude/rules/csharp/api-testing.md` để nắm convention trước khi generate.
|
|
34
|
+
|
|
35
|
+
Từ API Test Spec file, thu thập:
|
|
36
|
+
- API version
|
|
37
|
+
- Endpoints với method, path, params
|
|
38
|
+
- Test cases theo từng endpoint (TC-XXX)
|
|
39
|
+
- Request/response schemas
|
|
40
|
+
- Auth requirements
|
|
41
|
+
- Test data requirements
|
|
42
|
+
- Setup/teardown notes
|
|
43
|
+
|
|
44
|
+
### Bước 3 — Detect Existing Test Project
|
|
45
|
+
|
|
46
|
+
Glob tìm `**/ApiTests/*.csproj`, `**/Api.Tests/*.csproj`, `**/IntegrationTests/*.csproj`.
|
|
47
|
+
|
|
48
|
+
- **Tìm thấy**: Đọc framework đang dùng (xUnit/NUnit/MSTest), glob `v*/` folders để biết versions đã có.
|
|
49
|
+
- **Không tìm thấy**: Tạo mới tại `tests/ApiTests/` với xUnit + FluentAssertions (per `csharp/testing.md`).
|
|
50
|
+
|
|
51
|
+
### Bước 4 — Get API Version from Spec
|
|
52
|
+
|
|
53
|
+
Đọc version từ API Test Spec file (tìm frontmatter `api_version` hoặc section headers `## v{N}`).
|
|
54
|
+
|
|
55
|
+
Version folder: lowercase, không có dot — `v1`, `v2` (không phải `v1.0`).
|
|
56
|
+
|
|
57
|
+
### Bước 5 — Generate Infrastructure (chỉ khi tạo project mới)
|
|
58
|
+
|
|
59
|
+
Đọc `.claude/rules/csharp/api-testing.md` section **Project Structure** và **Config Pattern** để generate:
|
|
60
|
+
- `ApiTests.csproj` với packages chuẩn
|
|
61
|
+
- `appsettings.json` (base) + `appsettings.Test.json` + `appsettings.Staging.json` với values từ spec
|
|
62
|
+
- `Shared/TestBase.cs` — load config, HttpClient, helper methods
|
|
63
|
+
- `Shared/ApiTestSettings.cs` — strongly typed settings
|
|
64
|
+
- `.gitignore` cho `appsettings.*.local.json`
|
|
65
|
+
|
|
66
|
+
### Bước 6 — Generate Test Classes từ Spec
|
|
67
|
+
|
|
68
|
+
Nhóm endpoints theo resource. Mỗi nhóm → `tests/ApiTests/{version}/{Resource}ApiTests.cs`.
|
|
69
|
+
|
|
70
|
+
Với mỗi test case (TC-XXX) trong spec:
|
|
71
|
+
1. Đọc test case details
|
|
72
|
+
2. Map sang test method với naming: `{HttpMethod}_{Resource}_Returns{Status}_When{Condition}`
|
|
73
|
+
3. Generate XML doc từ test case title
|
|
74
|
+
4. Generate assertions từ expected response
|
|
75
|
+
5. Add AC reference comment nếu có
|
|
76
|
+
|
|
77
|
+
Test class header comment:
|
|
78
|
+
```csharp
|
|
79
|
+
// ============================================================
|
|
80
|
+
// {Resource} API Tests — v{N}
|
|
81
|
+
// Spec: docs/tests/API-Test-Spec-{slug}.md
|
|
82
|
+
// Generated: {YYYY-MM-DD}
|
|
83
|
+
// Story: {ID} (if applicable)
|
|
84
|
+
// APPEND-ONLY: không sửa methods đã tồn tại.
|
|
85
|
+
// ============================================================
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Bước 7 — Append-Only Guard
|
|
89
|
+
|
|
90
|
+
Trước khi ghi file: kiểm tra file đã tồn tại chưa.
|
|
91
|
+
- **File chưa có** → tạo mới bình thường.
|
|
92
|
+
- **File đã có** trong version folder → check từng test method:
|
|
93
|
+
- Method đã tồn tại (cùng tên) → **SKIP**, không ghi đè
|
|
94
|
+
- Method chưa có → append vào cuối class
|
|
95
|
+
|
|
96
|
+
### Bước 8 — Generate Test Data Files (nếu spec yêu cầu)
|
|
97
|
+
|
|
98
|
+
Nếu spec có `test-data.{env}.json` references:
|
|
99
|
+
- Tạo `tests/ApiTests/data/test-data.Test.json` với sample data từ spec
|
|
100
|
+
- Hướng dẫn user tạo `test-data.Staging.json` và `test-data.local.json`
|
|
101
|
+
|
|
102
|
+
### Bước 9 — Post-Generate Review
|
|
103
|
+
|
|
104
|
+
Launch `csharp-reviewer` agent:
|
|
105
|
+
> Review `tests/ApiTests/{version}/`. Đọc `.claude/rules/csharp/testing.md` + `.claude/rules/csharp/api-testing.md`.
|
|
106
|
+
> Tập trung: async/await, HttpClient disposal, assertion completeness, XML doc coverage.
|
|
107
|
+
> Format: Critical / High / Medium / Low với file:line.
|
|
108
|
+
|
|
109
|
+
Gate: Critical/High → fix ngay. Medium/Low → list gợi ý.
|
|
110
|
+
|
|
111
|
+
### Bước 10 — Summary
|
|
112
|
+
|
|
113
|
+
Hiển thị:
|
|
114
|
+
1. Test project path
|
|
115
|
+
2. Number of test classes generated
|
|
116
|
+
3. Number of test methods generated
|
|
117
|
+
4. Coverage matrix (so với spec)
|
|
118
|
+
5. Next steps để chạy tests
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
## API Tests Generated
|
|
122
|
+
|
|
123
|
+
**Project**: `tests/ApiTests/`
|
|
124
|
+
**Version**: v{N}
|
|
125
|
+
**Test Classes**: {N}
|
|
126
|
+
**Test Methods**: {N}
|
|
127
|
+
|
|
128
|
+
### Generated Files
|
|
129
|
+
- tests/ApiTests/{version}/{Resource}ApiTests.cs
|
|
130
|
+
- tests/ApiTests/Shared/TestBase.cs (if new project)
|
|
131
|
+
|
|
132
|
+
### Coverage (vs Spec)
|
|
133
|
+
[Print coverage table: spec test cases vs generated methods]
|
|
134
|
+
|
|
135
|
+
### Next Steps
|
|
136
|
+
1. Configure test environment: edit tests/ApiTests/appsettings.Test.json
|
|
137
|
+
2. Add test data: tests/ApiTests/data/test-data.Test.json
|
|
138
|
+
3. Run tests: `dotnet test tests/ApiTests/`
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Bước cuối — Token Log
|
|
142
|
+
|
|
143
|
+
Invoke skill `token-logger`: ghi AI Usage Log vào API Test Spec file.
|
|
@@ -1,109 +1,113 @@
|
|
|
1
|
-
# /tas-bug $ARGUMENTS
|
|
2
|
-
|
|
3
|
-
Quản lý toàn bộ lifecycle của bug: tạo, phân tích, fix, verify.
|
|
4
|
-
Status của bug xác định bước tiếp theo — không cần khai báo role.
|
|
5
|
-
|
|
6
|
-
## Always / Ask / Never
|
|
7
|
-
|
|
8
|
-
| | Hành động |
|
|
9
|
-
|---|---|
|
|
10
|
-
| **Always** | Hiển thị status hiện tại và action tiếp theo trước khi làm gì |
|
|
11
|
-
| **Always** | Viết regression test TRƯỚC khi fix |
|
|
12
|
-
| **Always** | Launch review agent độc lập sau khi fix — không review trong cùng session |
|
|
13
|
-
| **Ask** | Khi cần đọc thêm file ngoài Bug file (Status = Committed) |
|
|
14
|
-
| **Never** | Patch symptom — phải fix root cause |
|
|
15
|
-
| **Never** | Bỏ qua bước review sau khi fix |
|
|
16
|
-
| **Never** | Tự commit hay push — đợi user test thủ công trước |
|
|
17
|
-
|
|
18
|
-
## Stack Detection
|
|
19
|
-
Đọc `.claude/rules/common/stack-detection.md`.
|
|
20
|
-
|
|
21
|
-
## Hành động
|
|
22
|
-
|
|
23
|
-
### Bước 1 — Xác định chế độ
|
|
24
|
-
|
|
25
|
-
`$ARGUMENTS` là mô tả bug mới → **Chế độ CREATE**
|
|
26
|
-
`$ARGUMENTS` là Bug ID (ví dụ: `Bug-001`) → **Chế độ UPDATE**
|
|
27
|
-
|
|
28
|
-
---
|
|
29
|
-
|
|
30
|
-
### Chế độ CREATE
|
|
31
|
-
|
|
32
|
-
Vai trò: PE hoặc SE (ai phát hiện bug)
|
|
33
|
-
|
|
34
|
-
1. Đọc `project.code` từ root/`tas.yaml`
|
|
35
|
-
2. Hỏi user:
|
|
36
|
-
- Bug thuộc Feature nào?
|
|
37
|
-
- Severity: `Critical` | `High` | `Medium` | `Low`
|
|
38
|
-
- Steps to reproduce
|
|
39
|
-
- Expected vs Actual behavior
|
|
40
|
-
- Môi trường phát hiện: Test | Staging | Production
|
|
41
|
-
3. Tạo `docs/bugs/{code}-Bug-{NNN}-{slug}.md` từ template `.tas/templates/Bug.md`
|
|
42
|
-
4. Bug status ban đầu: `New`
|
|
43
|
-
|
|
44
|
-
---
|
|
45
|
-
|
|
46
|
-
### Chế độ UPDATE
|
|
47
|
-
|
|
48
|
-
Tìm file Bug qua glob `docs/bugs/*-Bug-{ID}-*.md`, đọc status hiện tại.
|
|
49
|
-
|
|
50
|
-
**Hiển thị trước khi làm gì:**
|
|
51
|
-
> "Bug-{NNN} đang ở status: **{status}** — bước tiếp theo là {action}. Tiếp tục không?"
|
|
52
|
-
|
|
53
|
-
---
|
|
54
|
-
|
|
55
|
-
#### Status = `New` — Phân tích (SE)
|
|
56
|
-
|
|
57
|
-
1. Đọc error logs/stack trace từ Bug file
|
|
58
|
-
2. Trace code flow, xác định file và dòng gây lỗi
|
|
59
|
-
3. Ghi Root Cause Analysis vào Bug file
|
|
60
|
-
4. Viết Regression Test Cases (test reproduce bug)
|
|
61
|
-
5. Cập nhật status: `New` → `Committed`
|
|
62
|
-
|
|
63
|
-
---
|
|
64
|
-
|
|
65
|
-
#### Status = `Committed` — Fix (SE)
|
|
66
|
-
|
|
67
|
-
**Quy tắc đọc file:** CHỈ đọc Bug file. KHÔNG đọc PRD, SAD, ADR, Design-Spec, KHÔNG quét thư mục.
|
|
68
|
-
Nếu cần thêm file → hỏi user xác nhận trước.
|
|
69
|
-
|
|
70
|
-
Trước khi fix, đọc:
|
|
71
|
-
- `.claude/rules/common/security.md` — fix không tạo security risk mới
|
|
72
|
-
- `.claude/rules/common/testing.md` — pattern viết regression test
|
|
73
|
-
- `.claude/rules/[lang_agent stack]/coding-style.md` — tuân thủ conventions
|
|
74
|
-
|
|
75
|
-
**Fix workflow:**
|
|
76
|
-
a. Chạy regression test case → xác nhận **FAIL** (reproduce bug)
|
|
77
|
-
b. Fix code đúng root cause
|
|
78
|
-
c. Chạy regression test → xác nhận **PASS**
|
|
79
|
-
d. Chạy toàn bộ test suite → không có regression mới
|
|
80
|
-
→ Nếu build fail hoặc test lỗi compile: launch `build-resolver` agent với error output trước khi tiếp tục.
|
|
81
|
-
|
|
82
|
-
**Sau khi fix — Post-Fix Review (Isolated Agent):**
|
|
83
|
-
|
|
84
|
-
Thực hiện theo `.claude/rules/common/post-review-agent.md`.
|
|
85
|
-
Truyền vào: Bug file path, danh sách changed files, stack (từ CLAUDE.md), lang_agent.
|
|
86
|
-
|
|
87
|
-
Sau khi review pass:
|
|
88
|
-
- Cập nhật status: `Committed` → `Deploy Test`
|
|
89
|
-
- Output commit message gợi ý: `fix: {mô tả ngắn} - resolves Bug-{NNN}`
|
|
90
|
-
- Hỏi: "Bạn đã test thủ công chưa? Muốn commit và deploy lên Test không?"
|
|
91
|
-
|
|
92
|
-
---
|
|
93
|
-
|
|
94
|
-
#### Status = `Verify Test` / `Verify Stag` — Verify (PE)
|
|
95
|
-
|
|
96
|
-
1. PE verify trên môi trường tương ứng:
|
|
97
|
-
- Chạy lại Steps to Reproduce → xác nhận bug không còn
|
|
98
|
-
- Kiểm tra regression test case đã pass
|
|
99
|
-
2. **Pass** → cập nhật status tiếp theo (`Deploy Stag` hoặc `Done`)
|
|
100
|
-
3. **Fail** → ghi lý do, cập nhật status về `Committed`, SE fix lại
|
|
101
|
-
|
|
102
|
-
---
|
|
103
|
-
|
|
104
|
-
## Nguyên tắc
|
|
105
|
-
- KHÔNG patch symptom — phải fix root cause
|
|
106
|
-
- PHẢI có regression test case TRƯỚC khi fix
|
|
107
|
-
- Review phải chạy qua Agent độc lập — không inline trong session hiện tại
|
|
108
|
-
- Bug `Critical`/`High` phải fix trước khi Feature được Verified
|
|
109
|
-
- Flow: `New` → `Committed` → `Deploy Test` → `Verify Test` → `Deploy Stag` → `Verify Stag` → `Deploy Prod` → `Verify Prod` → `Done`
|
|
1
|
+
# /tas-bug $ARGUMENTS
|
|
2
|
+
|
|
3
|
+
Quản lý toàn bộ lifecycle của bug: tạo, phân tích, fix, verify.
|
|
4
|
+
Status của bug xác định bước tiếp theo — không cần khai báo role.
|
|
5
|
+
|
|
6
|
+
## Always / Ask / Never
|
|
7
|
+
|
|
8
|
+
| | Hành động |
|
|
9
|
+
|---|---|
|
|
10
|
+
| **Always** | Hiển thị status hiện tại và action tiếp theo trước khi làm gì |
|
|
11
|
+
| **Always** | Viết regression test TRƯỚC khi fix |
|
|
12
|
+
| **Always** | Launch review agent độc lập sau khi fix — không review trong cùng session |
|
|
13
|
+
| **Ask** | Khi cần đọc thêm file ngoài Bug file (Status = Committed) |
|
|
14
|
+
| **Never** | Patch symptom — phải fix root cause |
|
|
15
|
+
| **Never** | Bỏ qua bước review sau khi fix |
|
|
16
|
+
| **Never** | Tự commit hay push — đợi user test thủ công trước |
|
|
17
|
+
|
|
18
|
+
## Stack Detection
|
|
19
|
+
Đọc `.claude/rules/common/stack-detection.md`.
|
|
20
|
+
|
|
21
|
+
## Hành động
|
|
22
|
+
|
|
23
|
+
### Bước 1 — Xác định chế độ
|
|
24
|
+
|
|
25
|
+
`$ARGUMENTS` là mô tả bug mới → **Chế độ CREATE**
|
|
26
|
+
`$ARGUMENTS` là Bug ID (ví dụ: `Bug-001`) → **Chế độ UPDATE**
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
### Chế độ CREATE
|
|
31
|
+
|
|
32
|
+
Vai trò: PE hoặc SE (ai phát hiện bug)
|
|
33
|
+
|
|
34
|
+
1. Đọc `project.code` từ root/`tas.yaml`
|
|
35
|
+
2. Hỏi user:
|
|
36
|
+
- Bug thuộc Feature nào?
|
|
37
|
+
- Severity: `Critical` | `High` | `Medium` | `Low`
|
|
38
|
+
- Steps to reproduce
|
|
39
|
+
- Expected vs Actual behavior
|
|
40
|
+
- Môi trường phát hiện: Test | Staging | Production
|
|
41
|
+
3. Tạo `docs/bugs/{code}-Bug-{NNN}-{slug}.md` từ template `.tas/templates/Bug.md`
|
|
42
|
+
4. Bug status ban đầu: `New`
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
### Chế độ UPDATE
|
|
47
|
+
|
|
48
|
+
Tìm file Bug qua glob `docs/bugs/*-Bug-{ID}-*.md`, đọc status hiện tại.
|
|
49
|
+
|
|
50
|
+
**Hiển thị trước khi làm gì:**
|
|
51
|
+
> "Bug-{NNN} đang ở status: **{status}** — bước tiếp theo là {action}. Tiếp tục không?"
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
#### Status = `New` — Phân tích (SE)
|
|
56
|
+
|
|
57
|
+
1. Đọc error logs/stack trace từ Bug file
|
|
58
|
+
2. Trace code flow, xác định file và dòng gây lỗi
|
|
59
|
+
3. Ghi Root Cause Analysis vào Bug file
|
|
60
|
+
4. Viết Regression Test Cases (test reproduce bug)
|
|
61
|
+
5. Cập nhật status: `New` → `Committed`
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
#### Status = `Committed` — Fix (SE)
|
|
66
|
+
|
|
67
|
+
**Quy tắc đọc file:** CHỈ đọc Bug file. KHÔNG đọc PRD, SAD, ADR, Design-Spec, KHÔNG quét thư mục.
|
|
68
|
+
Nếu cần thêm file → hỏi user xác nhận trước.
|
|
69
|
+
|
|
70
|
+
Trước khi fix, đọc:
|
|
71
|
+
- `.claude/rules/common/security.md` — fix không tạo security risk mới
|
|
72
|
+
- `.claude/rules/common/testing.md` — pattern viết regression test
|
|
73
|
+
- `.claude/rules/[lang_agent stack]/coding-style.md` — tuân thủ conventions
|
|
74
|
+
|
|
75
|
+
**Fix workflow:**
|
|
76
|
+
a. Chạy regression test case → xác nhận **FAIL** (reproduce bug)
|
|
77
|
+
b. Fix code đúng root cause
|
|
78
|
+
c. Chạy regression test → xác nhận **PASS**
|
|
79
|
+
d. Chạy toàn bộ test suite → không có regression mới
|
|
80
|
+
→ Nếu build fail hoặc test lỗi compile: launch `build-resolver` agent với error output trước khi tiếp tục.
|
|
81
|
+
|
|
82
|
+
**Sau khi fix — Post-Fix Review (Isolated Agent):**
|
|
83
|
+
|
|
84
|
+
Thực hiện theo `.claude/rules/common/post-review-agent.md`.
|
|
85
|
+
Truyền vào: Bug file path, danh sách changed files, stack (từ CLAUDE.md), lang_agent.
|
|
86
|
+
|
|
87
|
+
Sau khi review pass:
|
|
88
|
+
- Cập nhật status: `Committed` → `Deploy Test`
|
|
89
|
+
- Output commit message gợi ý: `fix: {mô tả ngắn} - resolves Bug-{NNN}`
|
|
90
|
+
- Hỏi: "Bạn đã test thủ công chưa? Muốn commit và deploy lên Test không?"
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
#### Status = `Verify Test` / `Verify Stag` — Verify (PE)
|
|
95
|
+
|
|
96
|
+
1. PE verify trên môi trường tương ứng:
|
|
97
|
+
- Chạy lại Steps to Reproduce → xác nhận bug không còn
|
|
98
|
+
- Kiểm tra regression test case đã pass
|
|
99
|
+
2. **Pass** → cập nhật status tiếp theo (`Deploy Stag` hoặc `Done`)
|
|
100
|
+
3. **Fail** → ghi lý do, cập nhật status về `Committed`, SE fix lại
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Nguyên tắc
|
|
105
|
+
- KHÔNG patch symptom — phải fix root cause
|
|
106
|
+
- PHẢI có regression test case TRƯỚC khi fix
|
|
107
|
+
- Review phải chạy qua Agent độc lập — không inline trong session hiện tại
|
|
108
|
+
- Bug `Critical`/`High` phải fix trước khi Feature được Verified
|
|
109
|
+
- Flow: `New` → `Committed` → `Deploy Test` → `Verify Test` → `Deploy Stag` → `Verify Stag` → `Deploy Prod` → `Verify Prod` → `Done`
|
|
110
|
+
|
|
111
|
+
## Bước cuối — Token Log
|
|
112
|
+
|
|
113
|
+
Invoke skill `token-logger`: ghi AI Usage Log vào file Bug đang làm việc.
|
|
@@ -1,33 +1,37 @@
|
|
|
1
|
-
# /tas-design $ARGUMENTS
|
|
2
|
-
|
|
3
|
-
Vai trò: PE - Product Engineer
|
|
4
|
-
Tạo hoặc cập nhật Design Specification document (UI/UX flows, wireframe descriptions).
|
|
5
|
-
|
|
6
|
-
## Prerequisite
|
|
7
|
-
- docs/prd.md phải tồn tại
|
|
8
|
-
|
|
9
|
-
## Hành động
|
|
10
|
-
1. Cần context từ root/tas.yaml và docs/prd.md
|
|
11
|
-
2. Kiểm tra docs/design-spec.md đã tồn tại chưa:
|
|
12
|
-
|
|
13
|
-
### Chế độ CREATE (file chưa tồn tại):
|
|
14
|
-
3. Cần context từ .tas/templates/Design-Spec.md
|
|
15
|
-
4. $ARGUMENTS là mô tả scope của design. Nếu không có, dựa vào PRD.
|
|
16
|
-
5. Tạo file docs/design-spec.md chứa:
|
|
17
|
-
- User flows (Mermaid flowchart)
|
|
18
|
-
- Screen descriptions
|
|
19
|
-
- Navigation structure
|
|
20
|
-
- Interaction patterns
|
|
21
|
-
- Responsive behavior notes
|
|
22
|
-
6. Cập nhật `project-status.yaml` theo `.claude/rules/common/project-status.md` — thêm `artifacts.design_spec`.
|
|
23
|
-
|
|
24
|
-
### Chế độ UPDATE (file đã tồn tại):
|
|
25
|
-
3. Cần context từ docs/design-spec.md hiện tại
|
|
26
|
-
4. $ARGUMENTS là mô tả thay đổi. Nếu không có, hỏi user cần cập nhật section nào.
|
|
27
|
-
5. Cập nhật file, thêm changelog
|
|
28
|
-
6. Cập nhật `project-status.yaml` theo `.claude/rules/common/project-status.md` — cập nhật `artifacts.design_spec`.
|
|
29
|
-
|
|
30
|
-
## Nguyên tắc
|
|
31
|
-
- Focus vào flows và behavior, không vào pixel-perfect design
|
|
32
|
-
- Mỗi screen cần mô tả: purpose, key elements, actions available
|
|
33
|
-
- Mermaid tuân thủ: :::mermaid wrapper, không dùng ()
|
|
1
|
+
# /tas-design $ARGUMENTS
|
|
2
|
+
|
|
3
|
+
Vai trò: PE - Product Engineer
|
|
4
|
+
Tạo hoặc cập nhật Design Specification document (UI/UX flows, wireframe descriptions).
|
|
5
|
+
|
|
6
|
+
## Prerequisite
|
|
7
|
+
- docs/prd.md phải tồn tại
|
|
8
|
+
|
|
9
|
+
## Hành động
|
|
10
|
+
1. Cần context từ root/tas.yaml và docs/prd.md
|
|
11
|
+
2. Kiểm tra docs/design-spec.md đã tồn tại chưa:
|
|
12
|
+
|
|
13
|
+
### Chế độ CREATE (file chưa tồn tại):
|
|
14
|
+
3. Cần context từ .tas/templates/Design-Spec.md
|
|
15
|
+
4. $ARGUMENTS là mô tả scope của design. Nếu không có, dựa vào PRD.
|
|
16
|
+
5. Tạo file docs/design-spec.md chứa:
|
|
17
|
+
- User flows (Mermaid flowchart)
|
|
18
|
+
- Screen descriptions
|
|
19
|
+
- Navigation structure
|
|
20
|
+
- Interaction patterns
|
|
21
|
+
- Responsive behavior notes
|
|
22
|
+
6. Cập nhật `project-status.yaml` theo `.claude/rules/common/project-status.md` — thêm `artifacts.design_spec`.
|
|
23
|
+
|
|
24
|
+
### Chế độ UPDATE (file đã tồn tại):
|
|
25
|
+
3. Cần context từ docs/design-spec.md hiện tại
|
|
26
|
+
4. $ARGUMENTS là mô tả thay đổi. Nếu không có, hỏi user cần cập nhật section nào.
|
|
27
|
+
5. Cập nhật file, thêm changelog
|
|
28
|
+
6. Cập nhật `project-status.yaml` theo `.claude/rules/common/project-status.md` — cập nhật `artifacts.design_spec`.
|
|
29
|
+
|
|
30
|
+
## Nguyên tắc
|
|
31
|
+
- Focus vào flows và behavior, không vào pixel-perfect design
|
|
32
|
+
- Mỗi screen cần mô tả: purpose, key elements, actions available
|
|
33
|
+
- Mermaid tuân thủ: :::mermaid wrapper, không dùng ()
|
|
34
|
+
|
|
35
|
+
## Bước cuối — Token Log
|
|
36
|
+
|
|
37
|
+
Invoke skill `token-logger`: ghi AI Usage Log vào `docs/design-spec.md`.
|