@torus-engineering/tas-kit 1.9.0 → 1.11.1

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 (68) hide show
  1. package/.claude/commands/ado-create.md +17 -17
  2. package/.claude/commands/ado-delete.md +11 -11
  3. package/.claude/commands/ado-get.md +12 -12
  4. package/.claude/commands/ado-status.md +12 -12
  5. package/.claude/commands/ado-update.md +15 -15
  6. package/.claude/commands/tas-adr.md +33 -33
  7. package/.claude/commands/tas-apitest-plan.md +173 -173
  8. package/.claude/commands/tas-apitest.md +143 -143
  9. package/.claude/commands/tas-brainstorm.md +14 -14
  10. package/.claude/commands/tas-bug.md +113 -113
  11. package/.claude/commands/tas-design.md +37 -37
  12. package/.claude/commands/tas-dev.md +128 -128
  13. package/.claude/commands/tas-e2e-mobile.md +155 -155
  14. package/.claude/commands/tas-e2e-web.md +163 -163
  15. package/.claude/commands/tas-e2e.md +102 -102
  16. package/.claude/commands/tas-epic.md +35 -35
  17. package/.claude/commands/tas-feature.md +47 -47
  18. package/.claude/commands/tas-fix.md +51 -51
  19. package/.claude/commands/tas-functest-mobile.md +144 -144
  20. package/.claude/commands/tas-functest-web.md +192 -192
  21. package/.claude/commands/tas-functest.md +76 -76
  22. package/.claude/commands/tas-init.md +14 -14
  23. package/.claude/commands/tas-plan.md +198 -200
  24. package/.claude/commands/tas-prd.md +37 -37
  25. package/.claude/commands/tas-review.md +111 -111
  26. package/.claude/commands/tas-sad.md +43 -43
  27. package/.claude/commands/tas-security.md +87 -81
  28. package/.claude/commands/tas-spec.md +20 -20
  29. package/.claude/commands/tas-status.md +13 -13
  30. package/.claude/commands/tas-story.md +91 -91
  31. package/.claude/commands/tas-verify.md +51 -51
  32. package/.claude/rules/common/post-review-agent.md +49 -49
  33. package/.claude/rules/common/project-status.md +14 -14
  34. package/.claude/rules/common/stack-detection.md +6 -6
  35. package/.claude/rules/common/token-logging.md +27 -27
  36. package/.claude/rules/csharp/api-testing.md +171 -171
  37. package/.claude/skills/ado-integration/SKILL.md +36 -36
  38. package/.claude/skills/tas-conventions/SKILL.md +32 -32
  39. package/.claude/skills/tas-implementation-complete/SKILL.md +100 -99
  40. package/.claude/skills/tas-tdd/SKILL.md +123 -123
  41. package/.claude/skills/token-logger/SKILL.md +19 -19
  42. package/.tas/README.md +266 -1520
  43. package/.tas/checklists/code-review.md +13 -13
  44. package/.tas/checklists/security.md +3 -3
  45. package/.tas/checklists/story-done.md +11 -11
  46. package/.tas/hooks/README.md +138 -0
  47. package/.tas/hooks/pre-commit +26 -0
  48. package/.tas/hooks/security-scan.js +599 -0
  49. package/.tas/project-status-example.yaml +3 -3
  50. package/.tas/tas-example.yaml +25 -8
  51. package/.tas/templates/ADR.md +16 -16
  52. package/.tas/templates/API-Test-Spec.md +3 -3
  53. package/.tas/templates/Bug.md +12 -12
  54. package/.tas/templates/Design-Spec.md +8 -8
  55. package/.tas/templates/E2E-Execution-Report.md +1 -1
  56. package/.tas/templates/Epic.md +1 -1
  57. package/.tas/templates/Feature.md +10 -10
  58. package/.tas/templates/Func-Test-Spec.md +3 -3
  59. package/.tas/templates/SAD.md +106 -106
  60. package/.tas/templates/Security-Report.md +3 -3
  61. package/.tas/templates/Story.md +9 -9
  62. package/.tas/tools/tas-ado-readme.md +169 -169
  63. package/.tas/tools/tas-ado.py +1 -1
  64. package/CLAUDE-Example.md +37 -58
  65. package/README.md +294 -42
  66. package/bin/cli.js +24 -7
  67. package/lib/install.js +161 -47
  68. package/package.json +1 -1
@@ -1,143 +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 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 expected response schema |
16
- | **Never** | Sửa hoặc xóa test files của version 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` path đến API Test Spec file: `docs/tests/API-Test-Spec-{slug}.md`.
25
-
26
- Nếu không 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 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** **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
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 → 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 `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` `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
+ # /tas-apitest $ARGUMENTS
2
+
3
+ Role: SE - Software Engineer
4
+ Generate .NET xUnit automation test project for REST API from API Test Spec file (Markdown).
5
+
6
+ ## Always / Ask / Never
7
+
8
+ | | Action |
9
+ |---|---|
10
+ | **Always** | Read entire API Test Spec file before generating any test |
11
+ | **Always** | Organize tests by API version — each version separate folder |
12
+ | **Always** | Append-only: don't modify files in existing old version folder |
13
+ | **Always** | URL and credentials in `appsettings.json` — not hardcoded in code |
14
+ | **Always** | XML doc comment on each test method |
15
+ | **Ask** | When test spec unclear about expected response schema |
16
+ | **Never** | Modify or delete old version test files |
17
+ | **Never** | Hardcode base URL, API key, credentials in test code |
18
+ | **Never** | Skip error path — each endpoint needs ≥1 happy path + ≥1 error path |
19
+
20
+ ## Actions
21
+
22
+ ### Step 1 — Locate Input
23
+
24
+ `$ARGUMENTS` is path to API Test Spec file: `docs/tests/API-Test-Spec-{slug}.md`.
25
+
26
+ If not providedask user:
27
+ ```
28
+ Enter path to API Test Spec file (e.g., docs/tests/API-Test-Spec-users.md)
29
+ ```
30
+
31
+ ### Step 2 — Parse API Test Spec
32
+
33
+ Read `.claude/rules/csharp/api-testing.md` for conventions before generating.
34
+
35
+ From API Test Spec file, collect:
36
+ - API version
37
+ - Endpoints with method, path, params
38
+ - Test cases per endpoint (TC-XXX)
39
+ - Request/response schemas
40
+ - Auth requirements
41
+ - Test data requirements
42
+ - Setup/teardown notes
43
+
44
+ ### Step 3 — Detect Existing Test Project
45
+
46
+ Glob find `**/ApiTests/*.csproj`, `**/Api.Tests/*.csproj`, `**/IntegrationTests/*.csproj`.
47
+
48
+ - **Found**: Read current framework (xUnit/NUnit/MSTest), glob `v*/` folders to know existing versions.
49
+ - **Not found**: Create new at `tests/ApiTests/` with xUnit + FluentAssertions (per `csharp/testing.md`).
50
+
51
+ ### Step 4 — Get API Version from Spec
52
+
53
+ Read version from API Test Spec file (find frontmatter `api_version` or section headers `## v{N}`).
54
+
55
+ Version folder: lowercase, no dot — `v1`, `v2` (not `v1.0`).
56
+
57
+ ### Step 5 — Generate Infrastructure (only when creating new project)
58
+
59
+ Read `.claude/rules/csharp/api-testing.md` section **Project Structure** and **Config Pattern** to generate:
60
+ - `ApiTests.csproj` with standard packages
61
+ - `appsettings.json` (base) + `appsettings.Test.json` + `appsettings.Staging.json` with values from spec
62
+ - `Shared/TestBase.cs` — load config, HttpClient, helper methods
63
+ - `Shared/ApiTestSettings.cs` — strongly typed settings
64
+ - `.gitignore` for `appsettings.*.local.json`
65
+
66
+ ### Step 6 — Generate Test Classes from Spec
67
+
68
+ Group endpoints by resource. Each group → `tests/ApiTests/{version}/{Resource}ApiTests.cs`.
69
+
70
+ For each test case (TC-XXX) in spec:
71
+ 1. Read test case details
72
+ 2. Map to test method with naming: `{HttpMethod}_{Resource}_Returns{Status}_When{Condition}`
73
+ 3. Generate XML doc from test case title
74
+ 4. Generate assertions from expected response
75
+ 5. Add AC reference comment if any
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: don't modify existing methods.
85
+ // ============================================================
86
+ ```
87
+
88
+ ### Step 7 — Append-Only Guard
89
+
90
+ Before writing file: check if file already exists.
91
+ - **File doesn't exist**create normally.
92
+ - **File exists** in version folder → check each test method:
93
+ - Method exists (same name) → **SKIP**, don't overwrite
94
+ - Method doesn't exist → append to end of class
95
+
96
+ ### Step 8 — Generate Test Data Files (if spec requires)
97
+
98
+ If spec has `test-data.{env}.json` references:
99
+ - Create `tests/ApiTests/data/test-data.Test.json` with sample data from spec
100
+ - Guide user to create `test-data.Staging.json` and `test-data.local.json`
101
+
102
+ ### Step 9 — Post-Generate Review
103
+
104
+ Launch `csharp-reviewer` agent:
105
+ > Review `tests/ApiTests/{version}/`. Read `.claude/rules/csharp/testing.md` + `.claude/rules/csharp/api-testing.md`.
106
+ > Focus: async/await, HttpClient disposal, assertion completeness, XML doc coverage.
107
+ > Format: Critical / High / Medium / Low with file:line.
108
+
109
+ Gate: Critical/High → fix immediately. Medium/Low → list suggestions.
110
+
111
+ ### Step 10 — Summary
112
+
113
+ Display:
114
+ 1. Test project path
115
+ 2. Number of test classes generated
116
+ 3. Number of test methods generated
117
+ 4. Coverage matrix (vs spec)
118
+ 5. Next steps to run 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
+ ## Final Step — Token Log
142
+
143
+ Invoke skill `token-logger`: write AI Usage Log to API Test Spec file.
@@ -1,19 +1,19 @@
1
1
  # /tas-brainstorm $ARGUMENTS
2
2
 
3
- Vai trò: Bất kỳ
4
- Brainstorm cấu trúc trước khi code hoặc thiết kế.
3
+ Role: Any
4
+ Structured brainstorming before coding or designing.
5
5
 
6
- ## Hành động
7
- 1. $ARGUMENTS chủ đề brainstorm
8
- 2. Dẫn dắt qua 4 bước:
9
- a. **Clarify**: Hỏi 3-5 câu hỏi làm vấn đề
10
- b. **Explore**: Đưa ra 3+ hướng giải quyết, mỗi hướng pros/cons
11
- c. **Evaluate**: So sánh các hướng theo tiêu chí: complexity, maintainability, cost, time
12
- d. **Decide**: Đề xuất hướng tốt nhất và lý do
6
+ ## Actions
7
+ 1. $ARGUMENTS is the brainstorming topic
8
+ 2. Guide through 4 steps:
9
+ a. **Clarify**: Ask 3-5 questions to clarify the problem
10
+ b. **Explore**: Propose 3+ solution directions, each with pros/cons
11
+ c. **Evaluate**: Compare directions by criteria: complexity, maintainability, cost, time
12
+ d. **Decide**: Recommend best direction and reasoning
13
13
 
14
- 3. Nếu kết quả brainstorm dẫn đến quyết định kiến trúc, gợi ý user chạy /tas-adr
14
+ 3. If brainstorming result leads to architecture decision, suggest user run /tas-adr
15
15
 
16
- ## Nguyên tắc
17
- - KHÔNG nhảy thẳng vào giải pháp
18
- - Hỏi trước, suggest sau
19
- - Luôn xem xét ít nhất 2 alternatives
16
+ ## Principles
17
+ - DO NOT jump straight to solution
18
+ - Ask first, suggest later
19
+ - Always consider at least 2 alternatives
@@ -1,113 +1,113 @@
1
- # /tas-bug $ARGUMENTS
2
-
3
- Quản 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 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` tả bug mới → **Chế độ CREATE**
26
- `$ARGUMENTS` Bug ID ( 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 {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 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 filehỏ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 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: { tả ngắn} - resolves Bug-{NNN}`
90
- - Hỏi: "Bạn đã test thủ công chưa? Muốn commit 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 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
+ # /tas-bug $ARGUMENTS
2
+
3
+ Manage entire bug lifecycle: create, analyze, fix, verify.
4
+ Bug status determines next stepno role declaration needed.
5
+
6
+ ## Always / Ask / Never
7
+
8
+ | | Action |
9
+ |---|---|
10
+ | **Always** | Display current status and next action before doing anything |
11
+ | **Always** | Write regression test BEFORE fixing |
12
+ | **Always** | Launch independent review agent after fix — no review in same session |
13
+ | **Ask** | When needing to read files outside Bug file (Status = Committed) |
14
+ | **Never** | Patch symptom — must fix root cause |
15
+ | **Never** | Skip review step after fix |
16
+ | **Never** | Auto-commit or push — wait for user manual testing first |
17
+
18
+ ## Stack Detection
19
+ Read `.claude/rules/common/stack-detection.md`.
20
+
21
+ ## Actions
22
+
23
+ ### Step 1 — Determine mode
24
+
25
+ `$ARGUMENTS` is new bug description → **CREATE mode**
26
+ `$ARGUMENTS` is Bug ID (e.g., `Bug-001`) → **UPDATE mode**
27
+
28
+ ---
29
+
30
+ ### CREATE mode
31
+
32
+ Role: PE or SE (whoever discovered the bug)
33
+
34
+ 1. Read `project.code` from root/`tas.yaml`
35
+ 2. Ask user:
36
+ - Which Feature does this bug belong to?
37
+ - Severity: `Critical` | `High` | `Medium` | `Low`
38
+ - Steps to reproduce
39
+ - Expected vs Actual behavior
40
+ - Environment where discovered: Test | Staging | Production
41
+ 3. Create `docs/bugs/{code}-Bug-{NNN}-{slug}.md` from template `.tas/templates/Bug.md`
42
+ 4. Initial bug status: `New`
43
+
44
+ ---
45
+
46
+ ### UPDATE mode
47
+
48
+ Find Bug file via glob `docs/bugs/*-Bug-{ID}-*.md`, read current status.
49
+
50
+ **Display before acting:**
51
+ > "Bug-{NNN} is currently at status: **{status}** — next step is {action}. Continue?"
52
+
53
+ ---
54
+
55
+ #### Status = `New` — Analyze (SE)
56
+
57
+ 1. Read error logs/stack trace from Bug file
58
+ 2. Trace code flow, identify file and line causing error
59
+ 3. Write Root Cause Analysis into Bug file
60
+ 4. Write Regression Test Cases (test that reproduces bug)
61
+ 5. Update status: `New` → `Committed`
62
+
63
+ ---
64
+
65
+ #### Status = `Committed` — Fix (SE)
66
+
67
+ **File reading rule:** ONLY read Bug file. DO NOT read PRD, SAD, ADR, Design-Spec, DO NOT scan directories.
68
+ If additional files neededask user confirmation first.
69
+
70
+ Before fixing, read:
71
+ - `.claude/rules/common/security.md` — fix must not create new security risks
72
+ - `.claude/rules/common/testing.md` — regression test writing patterns
73
+ - `.claude/rules/[lang_agent stack]/coding-style.md` — follow conventions
74
+
75
+ **Fix workflow:**
76
+ a. Run regression test case → confirm **FAIL** (reproduces bug)
77
+ b. Fix code at root cause
78
+ c. Run regression test → confirm **PASS**
79
+ d. Run full test suite → no new regressions
80
+ If build fails or test compile errors: launch `build-resolver` agent with error output before continuing.
81
+
82
+ **After fix — Post-Fix Review (Isolated Agent):**
83
+
84
+ Follow `.claude/rules/common/post-review-agent.md`.
85
+ Pass in: Bug file path, changed files list, stack (from CLAUDE.md), lang_agent.
86
+
87
+ After review passes:
88
+ - Update status: `Committed` → `Deploy Test`
89
+ - Output suggested commit message: `fix: {short description} - resolves Bug-{NNN}`
90
+ - Ask: "Have you tested manually? Want to commit and deploy to Test?"
91
+
92
+ ---
93
+
94
+ #### Status = `Verify Test` / `Verify Stag` — Verify (PE)
95
+
96
+ 1. PE verifies on corresponding environment:
97
+ - Run Steps to Reproduce again confirm bug no longer exists
98
+ - Check regression test case has passed
99
+ 2. **Pass** → update to next status (`Deploy Stag` or `Done`)
100
+ 3. **Fail** → document reason, update status back to `Committed`, SE fixes again
101
+
102
+ ---
103
+
104
+ ## Principles
105
+ - DO NOT patch symptom — must fix root cause
106
+ - MUST have regression test case BEFORE fixing
107
+ - Review must run through independent Agent — not inline in current session
108
+ - `Critical`/`High` bugs must be fixed before Feature is Verified
109
+ - Flow: `New` → `Committed` → `Deploy Test` → `Verify Test` → `Deploy Stag` → `Verify Stag` → `Deploy Prod` → `Verify Prod` → `Done`
110
+
111
+ ## Final Step — Token Log
112
+
113
+ Invoke skill `token-logger`: write AI Usage Log to working Bug file.
@@ -1,37 +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 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 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 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 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`.
1
+ # /tas-design $ARGUMENTS
2
+
3
+ Role: PE - Product Engineer
4
+ Create or update Design Specification document (UI/UX flows, wireframe descriptions).
5
+
6
+ ## Prerequisite
7
+ - docs/prd.md must exist
8
+
9
+ ## Actions
10
+ 1. Need context from root/tas.yaml and docs/prd.md
11
+ 2. Check if docs/design-spec.md already exists:
12
+
13
+ ### CREATE mode (file doesn't exist):
14
+ 3. Need context from .tas/templates/Design-Spec.md
15
+ 4. $ARGUMENTS is design scope description. If not provided, base on PRD.
16
+ 5. Create file docs/design-spec.md containing:
17
+ - User flows (Mermaid flowchart)
18
+ - Screen descriptions
19
+ - Navigation structure
20
+ - Interaction patterns
21
+ - Responsive behavior notes
22
+ 6. Update `project-status.yaml` per `.claude/rules/common/project-status.md` — add `artifacts.design_spec`.
23
+
24
+ ### UPDATE mode (file exists):
25
+ 3. Need context from current docs/design-spec.md
26
+ 4. $ARGUMENTS is change description. If not provided, ask user which section to update.
27
+ 5. Update file, add changelog
28
+ 6. Update `project-status.yaml` per `.claude/rules/common/project-status.md` — update `artifacts.design_spec`.
29
+
30
+ ## Principles
31
+ - Focus on flows and behavior, not pixel-perfect design
32
+ - Each screen needs: purpose, key elements, actions available
33
+ - Mermaid compliance: :::mermaid wrapper, no () in node labels
34
+
35
+ ## Final Step — Token Log
36
+
37
+ Invoke skill `token-logger`: write AI Usage Log to `docs/design-spec.md`.