@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,99 +1,100 @@
1
- ---
2
- name: tas-implementation-complete
3
- description: |
4
- Auto-invoke khi user báo hiệu đã hoàn thành implement: "done", "xong", "finished",
5
- "đã xong", "đã implement xong", "implementation complete", "code xong rồi",
6
- "viết xong rồi", "đã code xong". Trigger parallel post-implementation review gate.
7
- allowed-tools: Read, Bash, Grep, Glob, Agent
8
- ---
9
-
10
- # TAS Implementation Complete
11
-
12
- Khi user báo hiệu implementation xong, tự động trigger post-implementation review gate.
13
- Không chờ user chạy `/tas-review-code` thủ công.
14
-
15
- ## When to Use
16
-
17
- - User vừa implement xong một Story hoặc một feature
18
- - User nói "xong", "done", "finished" sau khi viết code
19
- - KHÔNG invoke khi: user đang hỏi về trạng thái, hỏi về plan, hay chưa code thay đổi
20
-
21
- ## Always / Ask / Never
22
-
23
- | | Hành động |
24
- |---|---|
25
- | **Always** | Xác nhận scope với user trước khi launch agents |
26
- | **Always** | Launch code-reviewer + security-reviewer đồng thời |
27
- | **Always** | Báo cáo gate result ràng: pass hoặc block với lý do |
28
- | **Ask** | Khi không chắc scope review (file path? git diff? Story?) |
29
- | **Ask** | Khi >5 files thay đổi confirm user muốn review toàn bộ |
30
- | **Never** | Tự động commit sau khi review pass |
31
- | **Never** | Skip review báo "looks good" mà không chạy agents |
32
-
33
- ## Process
34
-
35
- ### Bước 1 — Xác định scope
36
- Hỏi user hoặc tự suy luận từ context:
37
- - Story ID? lấy danh sách files từ Story
38
- - Không có?dùng `git diff HEAD --name-only` để lấy files vừa thay đổi
39
-
40
- ### Bước 2 — Stack Detection
41
- Đọc `CLAUDE.md` tại root, tìm section `## Tech Stack`:
42
- - Backend chứa `.NET` / `C#` `lang_agent = csharp-reviewer`
43
- - Backend chứa `Node.js` / `TypeScript` → `lang_agent = typescript-reviewer`
44
- - Backend chứa `Python` / `FastAPI` / `Django` → `lang_agent = python-reviewer`
45
- - Frontend chứa `React` → bổ sung `typescript-reviewer`
46
-
47
- ### Bước 3 — Launch Parallel Review Gate
48
-
49
- Launch các agents ĐỒNG THỜI:
50
-
51
- **Agent 1 — `code-reviewer`** (luôn chạy):
52
- > Review [scope]. Đọc `.tas/checklists/code-review.md`.
53
- > Tập trung: acceptance criteria compliance, naming, error handling, test coverage, DRY.
54
- > Format: Critical / High / Medium / Low với file:line và fix cụ thể.
55
-
56
- **Agent 2 — `security-reviewer`** (luôn chạy):
57
- > Security audit [scope]. Đọc `.claude/rules/common/security.md`.
58
- > Nếu stack đã xác định, đọc thêm `.claude/rules/[stack]/security.md`.
59
- > Tập trung: user input handling, SQL injection, hardcoded secrets, auth checks.
60
- > Format: Critical / High / Medium / Low với file:line và remediation.
61
-
62
- **Agent 3 — Language reviewer** (theo stack detection):
63
- > Language-specific review [scope].
64
- > Đọc `.claude/rules/[stack]/coding-style.md`, `.claude/rules/[stack]/patterns.md`, `.claude/rules/[stack]/testing.md`.
65
- > Nếu stack có React: đọc thêm `.claude/rules/web/design-quality.md`, `.claude/rules/web/testing.md`, `.claude/rules/web/performance.md`.
66
- > Format: Critical / High / Medium / Low với file:line.
67
-
68
- Chờ TẤT CẢ agents hoàn thành.
69
-
70
- ### Bước 4 — Gate Decision
71
-
72
- **Có Critical/High findings:**
73
- Liệt kê rõ từng finding, DỪNG, yêu cầu fix trước khi tiếp tục.
74
- Không tick Definition of Done.
75
-
76
- **Chỉ có Medium/Low:**
77
- List gợi ý, hỏi user có muốn fix không.
78
- Sau khi user confirm: nhắc chạy `/tas-review-code` để review đầy đủ (hygiene scan + test run).
79
-
80
- ## Red Flags
81
-
82
- - User nói "xong" nhưng không có file nào thay đổi trong git diff → hỏi lại
83
- - Review gate bị skip vì "code đơn giản" không ngoại lệ, luôn chạy gate
84
- - Agent trả về "No issues found" trên codebase lớn verify agent đã đọc đúng files
85
-
86
- ## Verification
87
-
88
- - [ ] `git diff HEAD --name-only` có ít nhất 1 file thay đổi
89
- - [ ] Tất cả agents đã chạy trả về kết quả (không timeout)
90
- - [ ] Gate decision được đưa ra ràng: pass hoặc block
91
- - [ ] Nếu pass: user biết bước tiếp theo là `/tas-review-code`
92
-
93
- ## Anti-Rationalization
94
-
95
- | Rationalization | Counter |
96
- |---|---|
97
- | "Code đơn giản, không cần review" | Review gate luôn chạy — đây là safety net, không phải quality judgment |
98
- | "Security reviewer sẽ slow down workflow" | Parallel execution3 agents chạy cùng lúc, không cộng thêm thời gian |
99
- | "User chưa hỏi về review" | Skill auto-invoke khi user nói "done" đây expected behavior |
1
+ ---
2
+ name: tas-implementation-complete
3
+ description: |
4
+ Auto-invoke when user signals implementation complete: "done", "xong", "finished",
5
+ "đã xong", "đã implement xong", "implementation complete", "code xong rồi",
6
+ "viết xong rồi", "đã code xong", "completed", "code done", "finished coding".
7
+ Trigger parallel post-implementation review gate.
8
+ allowed-tools: Read, Bash, Grep, Glob, Agent
9
+ ---
10
+
11
+ # TAS Implementation Complete
12
+
13
+ When user signals implementation complete, automatically trigger post-implementation review gate.
14
+ Don't wait for user to manually run `/tas-review-code`.
15
+
16
+ ## When to Use
17
+
18
+ - User just finished implementing a Story or feature
19
+ - User says "xong", "done", "finished" after writing code
20
+ - DO NOT invoke when: user is asking about status, asking about plan, or no code changes yet
21
+
22
+ ## Always / Ask / Never
23
+
24
+ | | Action |
25
+ |---|---|
26
+ | **Always** | Confirm scope with user before launching agents |
27
+ | **Always** | Launch code-reviewer + security-reviewer simultaneously |
28
+ | **Always** | Report gate result clearly: pass or block with reason |
29
+ | **Ask** | When unsure about review scope (file path? git diff? Story?) |
30
+ | **Ask** | When >5 files changed confirm user wants full review |
31
+ | **Never** | Auto-commit after review passes |
32
+ | **Never** | Skip review and report "looks good" without running agents |
33
+
34
+ ## Process
35
+
36
+ ### Step 1 Determine scope
37
+ Ask user or infer from context:
38
+ - Story ID available? get file list from Story
39
+ - Not available? → use `git diff HEAD --name-only` to get recently changed files
40
+
41
+ ### Step 2 Stack Detection
42
+ Read `CLAUDE.md` at root, find `## Tech Stack` section:
43
+ - Backend contains `.NET` / `C#` → `lang_agent = csharp-reviewer`
44
+ - Backend contains `Node.js` / `TypeScript` → `lang_agent = typescript-reviewer`
45
+ - Backend contains `Python` / `FastAPI` / `Django` `lang_agent = python-reviewer`
46
+ - Frontend contains `React` → add `typescript-reviewer`
47
+
48
+ ### Step 3 — Launch Parallel Review Gate
49
+
50
+ Launch agents SIMULTANEOUSLY:
51
+
52
+ **Agent 1 `code-reviewer`** (always run):
53
+ > Review [scope]. Read `.tas/checklists/code-review.md`.
54
+ > Focus: acceptance criteria compliance, naming, error handling, test coverage, DRY.
55
+ > Format: Critical / High / Medium / Low with file:line and specific fix.
56
+
57
+ **Agent 2 `security-reviewer`** (always run):
58
+ > Security audit [scope]. Read `.claude/rules/common/security.md`.
59
+ > If stack identified, also read `.claude/rules/[stack]/security.md`.
60
+ > Focus: user input handling, SQL injection, hardcoded secrets, auth checks.
61
+ > Format: Critical / High / Medium / Low with file:line and remediation.
62
+
63
+ **Agent 3 — Language reviewer** (per stack detection):
64
+ > Language-specific review [scope].
65
+ > Read `.claude/rules/[stack]/coding-style.md`, `.claude/rules/[stack]/patterns.md`, `.claude/rules/[stack]/testing.md`.
66
+ > If stack has React: also read `.claude/rules/web/design-quality.md`, `.claude/rules/web/testing.md`, `.claude/rules/web/performance.md`.
67
+ > Format: Critical / High / Medium / Low with file:line.
68
+
69
+ Wait for ALL agents to complete.
70
+
71
+ ### Step 4 — Gate Decision
72
+
73
+ **Has Critical/High findings:**
74
+ List each finding clearly, STOP, require fix before continuing.
75
+ → Don't tick Definition of Done.
76
+
77
+ **Only Medium/Low:**
78
+ List suggestions, ask if user wants to fix.
79
+ → After user confirms: remind to run `/tas-review-code` for full review (hygiene scan + test run).
80
+
81
+ ## Red Flags
82
+
83
+ - User says "xong" but no files changed in git diff ask again
84
+ - Review gate skipped because "code is simple" → no exceptions, always run gate
85
+ - Agent returns "No issues found" on large codebase → verify agent read correct files
86
+
87
+ ## Verification
88
+
89
+ - [ ] `git diff HEAD --name-only` has at least 1 changed file
90
+ - [ ] All agents ran and returned results (no timeout)
91
+ - [ ] Gate decision made clearly: pass or block
92
+ - [ ] If pass: user knows next step is `/tas-review-code`
93
+
94
+ ## Anti-Rationalization
95
+
96
+ | Rationalization | Counter |
97
+ |---|---|
98
+ | "Code is simple, no need to review" | Review gate always runs this is safety net, not quality judgment |
99
+ | "Security reviewer will slow down workflow" | Parallel execution 3 agents run simultaneously, no added time |
100
+ | "User didn't ask about review" | Skill auto-invokes when user says "done" — this is expected behavior |
@@ -1,123 +1,123 @@
1
- ---
2
- name: tas-tdd
3
- description: |
4
- TDD workflow. Auto-invoke khi: user implement feature mới, viết tests,
5
- hoặc khi use_tdd=true trong tas.yaml. Enforce Red-Green-Refactor cycle
6
- với verification gates giữa mỗi phase.
7
- allowed-tools: Read, Write, Edit, Bash, Grep
8
- ---
9
-
10
- # TAS TDD Workflow
11
-
12
- Khi `use_tdd=true` trong `tas.yaml`, enforce strict Red-Green-Refactor cycle.
13
- Không ngoại lệ mọi feature đều bắt đầu từ test.
14
-
15
- ## When to Use
16
-
17
- - Implement feature mới theo Story với acceptance criteria rõ ràng
18
- - Bug fix: viết regression test trước khi fix
19
- - Refactor: đảm bảo test coverage trước khi thay đổi code
20
- - KHÔNG dùng TDD cho: config changes, documentation, migration scripts thuần data
21
-
22
- ## Always / Ask / Never
23
-
24
- | | Hành động |
25
- |---|---|
26
- | **Always** | Viết test TRƯỚC, chạy để xác nhận FAIL, sau đó mới viết code |
27
- | **Always** | Commit sau mỗi Green phase thành công |
28
- | **Always** | Chạy full test suite sau Refactor phase |
29
- | **Ask** | Khi acceptance criteria hồ làm trước khi viết test |
30
- | **Ask** | Khi test quá khó viếtcó thể interface/design cần cải thiện |
31
- | **Never** | Viết implementation trước test ( "chỉ để thử") |
32
- | **Never** | Bỏ qua Red phase "test ràng sẽ fail" |
33
- | **Never** | Viết nhiều hơn code tối thiểu cần thiết để pass test Green phase |
34
-
35
- ## Process
36
-
37
- ### Red Phase — Viết Test Trước
38
-
39
- 1. Đọc acceptance criteria trong Story
40
- 2. Viết test cases cover từng criteria theo platform:
41
-
42
- **Mobile (React Native)**:
43
- - **Unit Tests (REQUIRED)**: Jest + React Testing Library
44
- - Components: `render`, `fireEvent`, `screen` queries
45
- - Hooks: `renderHook` từ `@testing-library/react-hooks`
46
- - Services/API: Jest mocks + MSW
47
- - Utils: Pure function testing
48
- - Zustand stores: Test actions + selectors
49
- - **E2E Tests**: Detox
50
-
51
- **Web (React + Node)**:
52
- - **Unit Tests (REQUIRED)**: Vitest/Jest + React Testing Library
53
- - Components: `render`, `fireEvent`, `screen` queries
54
- - Hooks: `renderHook`
55
- - Services: Vitest/Jest mocks + MSW
56
- - Backend services: Jest
57
- - **E2E Tests**: Playwright (Chromium, Firefox, WebKit)
58
-
59
- **Backend (.NET)**:
60
- - **Unit Tests**: xUnit cho services, repositories
61
- - **Integration Tests**: xUnit + TestServer
62
- - **API Tests**: xUnit + WebApplicationFactory
63
-
64
- 3. Chạy tests: `npm test` / `yarn test` / `dotnet test` / `python -m pytest`
65
- 4. **Verify**: tests PHẢI FAIL — nếu pass ngay → test sai, viết lại
66
-
67
- ### Green Phase — Code Tối Thiểu
68
-
69
- 1. Viết code tối thiểu để pass tests
70
- 2. Không refactor, không optimize phase này
71
- 3. Chạy tests: xác nhận PASS
72
- 4. **Verify**: tất cả tests mới phải pass, không regression
73
-
74
- ### Refactor Phase — Clean Up
75
-
76
- 1. Loại bỏ duplication, cải thiện naming, giảm complexity
77
- 2. KHÔNG thay đổi behavior — tests safety net
78
- 3. Chạy full test suite sau mỗi refactor step
79
- 4. **Verify**: coverage >= 80%, tất cả tests vẫn pass
80
- 5. Commit sau khi refactor thành công
81
-
82
- ## Red Flags
83
-
84
- - Test pass ngay lần đầu khi chưa viết implementation → test không test đúng thứ cần test
85
- - Test quá broad ("everything works") → không giá trị, viết test cụ thể hơn
86
- - Green phase code quá nhiều logic → chỉ viết đủ để pass, không hơn
87
- - Refactor phase làm test fail → refactor sai, roll back từng bước
88
- - Viết nhiều test cùng lúc trước khi fix từng cái chỉ fix một test tại một thời điểm
89
-
90
- ## Verification
91
-
92
- - [ ] Red: test file tồn tại chạy ra FAIL output
93
- - [ ] Green: test output chuyển từ FAIL → PASS sau khi thêm implementation
94
- - [ ] Refactor: `npm test` / `dotnet test` / `pytest` toàn bộ suite PASS
95
- - [ ] Coverage report: >= 80% cho files vừa thay đổi
96
- - [ ] Không test nào bị skip hay comment out
97
-
98
- ## Test Naming Convention
99
-
100
- ```
101
- {PROJECT}_E{EPIC}_F{FEATURE}_S{STORY}_{TYPE}_{NUMBER}_{MODIFIER}
102
- ```
103
-
104
- | TYPE | Ý nghĩa | Layer |
105
- |------|---------|-------|
106
- | UT | Unit Test | 1 |
107
- | IT | Integration Test | 1 |
108
- | API | API Test | 1 |
109
- | FT | Functional Test | 2 |
110
- | E2E | End-to-End Test | 3 |
111
-
112
- MODIFIER: `H` (Happy), `N` (Negative), `E` (Edge), `S` (Security), `P` (Performance)
113
-
114
- ---
115
-
116
- ## Anti-Rationalization
117
-
118
- | Rationalization | Counter |
119
- |---|---|
120
- | "Test ràng sẽ fail, không cần chạy" | Bỏ qua Red phase làm mất điểm kiểm chứng luôn chạy |
121
- | "Viết test sau nhanh hơn" | TDD tiết kiệm debugging time nhiều hơn thời gian viết test trước |
122
- | "Code này quá đơn giản cần test" | Đơn giản hôm nay, phức tạp sau refactor — test bảo vệ future changes |
123
- | "Interface chưa clear, viết code trước cho " | Test khó viết signal interface cần cải thiện — Ask, không skip |
1
+ ---
2
+ name: tas-tdd
3
+ description: |
4
+ TDD workflow. Auto-invoke when: user implements new feature, writes tests,
5
+ or when use_tdd=true in tas.yaml. Enforce Red-Green-Refactor cycle
6
+ with verification gates between each phase.
7
+ allowed-tools: Read, Write, Edit, Bash, Grep
8
+ ---
9
+
10
+ # TAS TDD Workflow
11
+
12
+ When `use_tdd=true` in `tas.yaml`, enforce strict Red-Green-Refactor cycle.
13
+ No exceptionsevery feature starts with test.
14
+
15
+ ## When to Use
16
+
17
+ - Implement new feature per Story with clear acceptance criteria
18
+ - Bug fix: write regression test before fixing
19
+ - Refactor: ensure test coverage before changing code
20
+ - DON'T use TDD for: config changes, documentation, pure data migration scripts
21
+
22
+ ## Always / Ask / Never
23
+
24
+ | | Action |
25
+ |---|---|
26
+ | **Always** | Write test FIRST, run to confirm FAIL, then write code |
27
+ | **Always** | Commit after each successful Green phase |
28
+ | **Always** | Run full test suite after Refactor phase |
29
+ | **Ask** | When acceptance criteria vagueclarify before writing test |
30
+ | **Ask** | When test too hard to write — interface/design may need improvement |
31
+ | **Never** | Write implementation before test (even "just to try") |
32
+ | **Never** | Skip Red phase because "test will obviously fail" |
33
+ | **Never** | Write more than minimal code needed to pass test in Green phase |
34
+
35
+ ## Process
36
+
37
+ ### Red Phase — Write Test First
38
+
39
+ 1. Read acceptance criteria in Story
40
+ 2. Write test cases covering each criteria per platform:
41
+
42
+ **Mobile (React Native)**:
43
+ - **Unit Tests (REQUIRED)**: Jest + React Testing Library
44
+ - Components: `render`, `fireEvent`, `screen` queries
45
+ - Hooks: `renderHook` from `@testing-library/react-hooks`
46
+ - Services/API: Jest mocks + MSW
47
+ - Utils: Pure function testing
48
+ - Zustand stores: Test actions + selectors
49
+ - **E2E Tests**: Detox
50
+
51
+ **Web (React + Node)**:
52
+ - **Unit Tests (REQUIRED)**: Vitest/Jest + React Testing Library
53
+ - Components: `render`, `fireEvent`, `screen` queries
54
+ - Hooks: `renderHook`
55
+ - Services: Vitest/Jest mocks + MSW
56
+ - Backend services: Jest
57
+ - **E2E Tests**: Playwright (Chromium, Firefox, WebKit)
58
+
59
+ **Backend (.NET)**:
60
+ - **Unit Tests**: xUnit for services, repositories
61
+ - **Integration Tests**: xUnit + TestServer
62
+ - **API Tests**: xUnit + WebApplicationFactory
63
+
64
+ 3. Run tests: `npm test` / `yarn test` / `dotnet test` / `python -m pytest`
65
+ 4. **Verify**: tests MUST FAIL — if pass immediately → test is wrong, rewrite
66
+
67
+ ### Green Phase — Minimal Code
68
+
69
+ 1. Write minimal code to pass tests
70
+ 2. Don't refactor, don't optimize in this phase
71
+ 3. Run tests: confirm PASS
72
+ 4. **Verify**: all new tests pass, no regression
73
+
74
+ ### Refactor Phase — Clean Up
75
+
76
+ 1. Remove duplication, improve naming, reduce complexity
77
+ 2. DON'T change behavior — tests are safety net
78
+ 3. Run full test suite after each refactor step
79
+ 4. **Verify**: coverage >= 80%, all tests still pass
80
+ 5. Commit after successful refactor
81
+
82
+ ## Red Flags
83
+
84
+ - Test passes on first run before implementation → test doesn't test what it should
85
+ - Test too broad ("everything works") → no value, write more specific test
86
+ - Green phase has too much logic → only write enough to pass, no more
87
+ - Refactor phase makes tests fail → refactor is wrong, roll back step by step
88
+ - Writing multiple tests at once before fixing eachonly fix one test at a time
89
+
90
+ ## Verification
91
+
92
+ - [ ] Red: test file exists and runs with FAIL output
93
+ - [ ] Green: test output changes from FAIL → PASS after adding implementation
94
+ - [ ] Refactor: `npm test` / `dotnet test` / `pytest` full suite PASS
95
+ - [ ] Coverage report: >= 80% for changed files
96
+ - [ ] No tests skipped or commented out
97
+
98
+ ## Test Naming Convention
99
+
100
+ ```
101
+ {PROJECT}_E{EPIC}_F{FEATURE}_S{STORY}_{TYPE}_{NUMBER}_{MODIFIER}
102
+ ```
103
+
104
+ | TYPE | Meaning | Layer |
105
+ |------|---------|-------|
106
+ | UT | Unit Test | 1 |
107
+ | IT | Integration Test | 1 |
108
+ | API | API Test | 1 |
109
+ | FT | Functional Test | 2 |
110
+ | E2E | End-to-End Test | 3 |
111
+
112
+ MODIFIER: `H` (Happy), `N` (Negative), `E` (Edge), `S` (Security), `P` (Performance)
113
+
114
+ ---
115
+
116
+ ## Anti-Rationalization
117
+
118
+ | Rationalization | Counter |
119
+ |---|---|
120
+ | "Test will obviously fail, no need to run" | Skipping Red phase loses verification pointalways run |
121
+ | "Writing test after is faster" | TDD saves more debugging time than time spent writing tests first |
122
+ | "This code is too simple for tests" | Simple today, complex after refactor — tests protect future changes |
123
+ | "Interface not clear, write code first for clarity" | Test hard to write is signal interface needs improvement — Ask, don't skip |
@@ -1,19 +1,19 @@
1
- ---
2
- name: token-logger
3
- description: |
4
- Invoke khi TAS command hoàn thành để ghi AI Usage Log vào artifact file.
5
- Auto-invoke sau /tas-* commands khi Write/Edit vào docs/.
6
- KHÔNG invoke khi user tự tay edit file hoặc dùng non-TAS commands.
7
- allowed-tools: Read, Edit, Write
8
- ---
9
-
10
- # Token Logger
11
-
12
- Ghi `## AI Usage Log` vào artifact file sau khi TAS command hoàn thành.
13
-
14
- ## Process
15
-
16
- 1. Xác định artifact file: từ lời gọi (nếu được chỉ định) hoặc file `docs/` cuối cùng được Write/Edit trong session.
17
- 2. Đọc `.claude/rules/common/token-logging.md` để lấy format update rules.
18
- 3. Đọc artifact file — kiểm tra `## AI Usage Log` đã tồn tại chưa.
19
- 4. Ghi hoặc cập nhật section. Silent on success — không output ra conversation.
1
+ ---
2
+ name: token-logger
3
+ description: |
4
+ Invoke when TAS command completes to write AI Usage Log into artifact file.
5
+ Auto-invoke after /tas-* commands when there's Write/Edit to docs/.
6
+ DO NOT invoke when user manually edits file or uses non-TAS commands.
7
+ allowed-tools: Read, Edit, Write
8
+ ---
9
+
10
+ # Token Logger
11
+
12
+ Write `## AI Usage Log` into artifact file after TAS command completes.
13
+
14
+ ## Process
15
+
16
+ 1. Identify artifact file: from invocation (if specified) or last `docs/` file Write/Edit in session.
17
+ 2. Read `.claude/rules/common/token-logging.md` for format and update rules.
18
+ 3. Read artifact file — check if `## AI Usage Log` already exists.
19
+ 4. Write or update section. Silent on success — no output to conversation.