@torus-engineering/tas-kit 1.10.0 → 1.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/.tas/README.md +70 -70
  2. package/{.claude → .tas/_platform/claude-code}/settings.json +0 -12
  3. package/{.claude → .tas/_platform}/hooks/code-quality.js +1 -1
  4. package/{.claude → .tas/_platform}/hooks/session-end.js +20 -25
  5. package/.tas/commands/ado-create.md +28 -0
  6. package/.tas/commands/ado-delete.md +22 -0
  7. package/.tas/commands/ado-get.md +20 -0
  8. package/.tas/commands/ado-status.md +18 -0
  9. package/.tas/commands/ado-update.md +27 -0
  10. package/.tas/commands/tas-adr.md +33 -0
  11. package/.tas/commands/tas-apitest-plan.md +173 -0
  12. package/.tas/commands/tas-apitest.md +143 -0
  13. package/.tas/commands/tas-brainstorm.md +19 -0
  14. package/.tas/commands/tas-bug.md +113 -0
  15. package/.tas/commands/tas-design.md +37 -0
  16. package/.tas/commands/tas-dev.md +125 -0
  17. package/{.claude → .tas}/commands/tas-e2e-mobile.md +155 -155
  18. package/{.claude → .tas}/commands/tas-e2e-web.md +163 -163
  19. package/.tas/commands/tas-e2e.md +102 -0
  20. package/.tas/commands/tas-epic.md +35 -0
  21. package/.tas/commands/tas-feature.md +47 -0
  22. package/.tas/commands/tas-fix.md +51 -0
  23. package/.tas/commands/tas-functest-mobile.md +144 -0
  24. package/{.claude → .tas}/commands/tas-functest-web.md +192 -192
  25. package/.tas/commands/tas-functest.md +76 -0
  26. package/.tas/commands/tas-init.md +17 -0
  27. package/.tas/commands/tas-plan.md +198 -0
  28. package/.tas/commands/tas-prd.md +37 -0
  29. package/.tas/commands/tas-review.md +113 -0
  30. package/.tas/commands/tas-sad.md +43 -0
  31. package/.tas/commands/tas-security.md +87 -0
  32. package/.tas/commands/tas-spec.md +50 -0
  33. package/.tas/commands/tas-status.md +16 -0
  34. package/.tas/commands/tas-story.md +91 -0
  35. package/.tas/platforms.json +5 -0
  36. package/.tas/project-status-example.yaml +17 -17
  37. package/.tas/rules/ado-integration.md +65 -0
  38. package/{.claude/skills/api-design/SKILL.md → .tas/rules/common/api-design.md} +517 -530
  39. package/{.claude → .tas}/rules/common/code-review.md +30 -6
  40. package/.tas/rules/common/post-implementation-review.md +51 -0
  41. package/{.claude → .tas}/rules/common/project-status.md +80 -80
  42. package/.tas/rules/common/stack-detection.md +29 -0
  43. package/.tas/rules/common/story-done.md +30 -0
  44. package/.tas/rules/common/tdd.md +89 -0
  45. package/{.claude → .tas}/rules/common/testing.md +3 -8
  46. package/.tas/rules/common/token-logging.md +36 -0
  47. package/{.claude → .tas}/rules/csharp/api-testing.md +20 -20
  48. package/{.claude → .tas}/rules/csharp/coding-style.md +0 -2
  49. package/{.claude → .tas}/rules/csharp/security.md +10 -0
  50. package/{.claude → .tas}/rules/python/coding-style.md +0 -2
  51. package/{.claude → .tas}/rules/typescript/coding-style.md +0 -2
  52. package/.tas/rules/typescript/patterns.md +142 -0
  53. package/.tas/rules/typescript/security.md +88 -0
  54. package/{.claude → .tas}/rules/typescript/testing.md +0 -4
  55. package/{.claude → .tas}/rules/web/coding-style.md +0 -2
  56. package/.tas/tas-example.yaml +10 -11
  57. package/.tas/templates/ADR.md +47 -47
  58. package/.tas/templates/AGENTS.md +37 -0
  59. package/.tas/templates/API-Test-Spec.md +3 -3
  60. package/.tas/templates/Bug.md +67 -67
  61. package/.tas/templates/Design-Spec.md +36 -36
  62. package/.tas/templates/E2E-Execution-Report.md +1 -1
  63. package/.tas/templates/Epic.md +46 -46
  64. package/.tas/templates/Feature.md +10 -10
  65. package/.tas/templates/Func-Test-Spec.md +3 -3
  66. package/.tas/templates/SAD.md +106 -106
  67. package/.tas/templates/Security-Report.md +27 -27
  68. package/.tas/templates/Story.md +9 -9
  69. package/.tas/tools/tas-ado-readme.md +68 -68
  70. package/.tas/tools/tas-ado.py +621 -621
  71. package/README.md +78 -78
  72. package/bin/cli.js +91 -73
  73. package/lib/adapters/antigravity.js +137 -0
  74. package/lib/adapters/claude-code.js +35 -0
  75. package/lib/adapters/codex.js +163 -0
  76. package/lib/adapters/cursor.js +80 -0
  77. package/lib/adapters/index.js +20 -0
  78. package/lib/adapters/utils.js +81 -0
  79. package/lib/deleted-files.json +99 -0
  80. package/lib/install.js +403 -327
  81. package/package.json +4 -3
  82. package/.claude/agents/code-reviewer.md +0 -41
  83. package/.claude/agents/e2e-runner.md +0 -61
  84. package/.claude/agents/planner.md +0 -82
  85. package/.claude/agents/tdd-guide.md +0 -84
  86. package/.claude/commands/ado-create.md +0 -27
  87. package/.claude/commands/ado-delete.md +0 -21
  88. package/.claude/commands/ado-get.md +0 -20
  89. package/.claude/commands/ado-status.md +0 -18
  90. package/.claude/commands/ado-update.md +0 -26
  91. package/.claude/commands/tas-adr.md +0 -33
  92. package/.claude/commands/tas-apitest-plan.md +0 -173
  93. package/.claude/commands/tas-apitest.md +0 -143
  94. package/.claude/commands/tas-brainstorm.md +0 -19
  95. package/.claude/commands/tas-bug.md +0 -113
  96. package/.claude/commands/tas-design.md +0 -37
  97. package/.claude/commands/tas-dev.md +0 -128
  98. package/.claude/commands/tas-e2e.md +0 -102
  99. package/.claude/commands/tas-epic.md +0 -35
  100. package/.claude/commands/tas-feature.md +0 -47
  101. package/.claude/commands/tas-fix.md +0 -51
  102. package/.claude/commands/tas-functest-mobile.md +0 -144
  103. package/.claude/commands/tas-functest.md +0 -76
  104. package/.claude/commands/tas-init.md +0 -17
  105. package/.claude/commands/tas-plan.md +0 -200
  106. package/.claude/commands/tas-prd.md +0 -37
  107. package/.claude/commands/tas-review.md +0 -111
  108. package/.claude/commands/tas-sad.md +0 -43
  109. package/.claude/commands/tas-security.md +0 -87
  110. package/.claude/commands/tas-spec.md +0 -50
  111. package/.claude/commands/tas-status.md +0 -16
  112. package/.claude/commands/tas-story.md +0 -91
  113. package/.claude/commands/tas-verify.md +0 -51
  114. package/.claude/rules/common/post-review-agent.md +0 -49
  115. package/.claude/rules/common/stack-detection.md +0 -29
  116. package/.claude/rules/common/token-logging.md +0 -27
  117. package/.claude/rules/typescript/patterns.md +0 -62
  118. package/.claude/rules/typescript/security.md +0 -28
  119. package/.claude/settings.local.json +0 -38
  120. package/.claude/skills/ado-integration/SKILL.md +0 -75
  121. package/.claude/skills/ai-regression-testing/SKILL.md +0 -364
  122. package/.claude/skills/architecture-decision-records/SKILL.md +0 -184
  123. package/.claude/skills/benchmark/SKILL.md +0 -98
  124. package/.claude/skills/browser-qa/SKILL.md +0 -92
  125. package/.claude/skills/canary-watch/SKILL.md +0 -104
  126. package/.claude/skills/js-backend-patterns/SKILL.md +0 -603
  127. package/.claude/skills/tas-conventions/SKILL.md +0 -65
  128. package/.claude/skills/tas-implementation-complete/SKILL.md +0 -99
  129. package/.claude/skills/tas-tdd/SKILL.md +0 -123
  130. package/.claude/skills/token-logger/SKILL.md +0 -19
  131. package/.tas/checklists/code-review.md +0 -29
  132. package/.tas/checklists/security.md +0 -21
  133. package/.tas/checklists/story-done.md +0 -23
  134. package/CLAUDE-Example.md +0 -61
  135. /package/{.claude → .tas}/agents/architect.md +0 -0
  136. /package/{.claude → .tas}/agents/aws-reviewer.md +0 -0
  137. /package/{.claude → .tas}/agents/build-resolver.md +0 -0
  138. /package/{.claude → .tas}/agents/code-explorer.md +0 -0
  139. /package/{.claude → .tas}/agents/csharp-reviewer.md +0 -0
  140. /package/{.claude → .tas}/agents/database-reviewer.md +0 -0
  141. /package/{.claude → .tas}/agents/doc-updater.md +0 -0
  142. /package/{.claude → .tas}/agents/python-reviewer.md +0 -0
  143. /package/{.claude → .tas}/agents/security-reviewer.md +0 -0
  144. /package/{.claude → .tas}/agents/typescript-reviewer.md +0 -0
  145. /package/{.claude → .tas}/rules/.gitkeep +0 -0
  146. /package/{.claude → .tas}/rules/common/hooks.md +0 -0
  147. /package/{.claude → .tas}/rules/common/patterns.md +0 -0
  148. /package/{.claude → .tas}/rules/common/security.md +0 -0
  149. /package/{.claude → .tas}/rules/csharp/hooks.md +0 -0
  150. /package/{.claude → .tas}/rules/csharp/patterns.md +0 -0
  151. /package/{.claude → .tas}/rules/csharp/testing.md +0 -0
  152. /package/{.claude → .tas}/rules/python/hooks.md +0 -0
  153. /package/{.claude → .tas}/rules/python/patterns.md +0 -0
  154. /package/{.claude → .tas}/rules/python/security.md +0 -0
  155. /package/{.claude → .tas}/rules/python/testing.md +0 -0
  156. /package/{.claude → .tas}/rules/typescript/hooks.md +0 -0
  157. /package/{.claude → .tas}/rules/web/design-quality.md +0 -0
  158. /package/{.claude → .tas}/rules/web/hooks.md +0 -0
  159. /package/{.claude → .tas}/rules/web/patterns.md +0 -0
  160. /package/{.claude → .tas}/rules/web/performance.md +0 -0
  161. /package/{.claude → .tas}/rules/web/security.md +0 -0
  162. /package/{.claude → .tas}/rules/web/testing.md +0 -0
@@ -22,6 +22,15 @@ Before requesting review, ensure:
22
22
  - Merge conflicts are resolved
23
23
  - Branch is up to date with target branch
24
24
 
25
+ ## Review Criteria (priority order)
26
+
27
+ 1. **Security** — injection, auth bypass, data exposure, OWASP Top 10
28
+ 2. **Architecture** — violations of SAD, ADR decisions, layer boundaries
29
+ 3. **Correctness** — logic errors, edge cases, null handling
30
+ 4. **Conventions** — naming, structure, commit/branch format per CLAUDE.md
31
+ 5. **Test coverage** — missing tests for new logic
32
+ 6. **Performance** — obvious inefficiencies (N+1, unbounded loops, large allocations)
33
+
25
34
  ## Review Checklist
26
35
 
27
36
  Before marking code complete:
@@ -36,6 +45,23 @@ Before marking code complete:
36
45
  - [ ] Tests exist for new functionality
37
46
  - [ ] Test coverage meets 80% minimum
38
47
 
48
+ ## Output Format
49
+
50
+ Findings grouped by severity, skip empty categories:
51
+
52
+ ```
53
+ ### Critical
54
+ - `file.cs:42` — issue + suggested fix
55
+
56
+ ### High
57
+ - `file.cs:15` — issue + suggested fix
58
+
59
+ ### Medium / Low
60
+ - `file.cs:8` — issue
61
+ ```
62
+
63
+ Every finding MUST reference specific `file:line` + propose fix. No general comments.
64
+
39
65
  ## Security Review Triggers
40
66
 
41
67
  **STOP and use security-reviewer agent when:**
@@ -59,16 +85,16 @@ Before marking code complete:
59
85
 
60
86
  ## Agent Usage
61
87
 
62
- Use these agents for code review:
88
+ Use these agents for specialized concerns:
63
89
 
64
90
  | Agent | Purpose |
65
91
  |-------|---------|
66
- | **code-reviewer** | General code quality, patterns, best practices |
67
92
  | **security-reviewer** | Security vulnerabilities, OWASP Top 10 |
68
93
  | **typescript-reviewer** | TypeScript/JavaScript specific issues |
69
94
  | **python-reviewer** | Python specific issues |
70
- | **go-reviewer** | Go specific issues |
71
- | **rust-reviewer** | Rust specific issues |
95
+ | **csharp-reviewer** | C#/.NET specific issues |
96
+
97
+ General code review runs inline in main session reading this rule.
72
98
 
73
99
  ## Review Workflow
74
100
 
@@ -120,5 +146,3 @@ This rule works with:
120
146
 
121
147
  - [testing.md](testing.md) - Test coverage requirements
122
148
  - [security.md](security.md) - Security checklist
123
- - [git-workflow.md](git-workflow.md) - Commit standards
124
- - [agents.md](agents.md) - Agent delegation
@@ -0,0 +1,51 @@
1
+ # Post-Implementation Review (Isolated Agent)
2
+
3
+ After implementing or fixing, run review through **independent Agent** — don't use current session to avoid reviewer bias from implementation process.
4
+
5
+ ## How to use
6
+
7
+ Call `Agent` tool with following prompt (replace placeholders `{}`):
8
+
9
+ ```
10
+ You are code reviewer. No context from previous session — review completely objectively.
11
+
12
+ Artifact: {path-to-artifact-file}
13
+ Changed files: {list of files just changed}
14
+ Stack: {stack from CLAUDE.md}
15
+
16
+ Execute:
17
+ 1. Hygiene scan: leftover debug code (console.log, debugger, print), hardcoded secrets,
18
+ large commented-out blocks (>5 lines).
19
+ 1b. Silent failure scan — find following patterns:
20
+ - Swallowed exceptions: empty catch {}, catch only logs but continues like no error
21
+ - Silent async failures: fire-and-forget (unawaited task/Promise), async void (.NET),
22
+ .catch(() => {}) with no handling
23
+ - Null blindspots: .FirstOrDefault() used directly without null-check (.NET),
24
+ missing optional chaining on deeply nested object access (TS/JS),
25
+ dict.get() result used as non-None (Python)
26
+ - Error propagation wrong: HTTP calls don't check status before parse,
27
+ function returns bool/null when error instead of throwing (caller ignores result)
28
+ - Config reads don't check existence
29
+ 2. Run tests: detect test runner (package.json → npm test / *.csproj → dotnet test /
30
+ pytest.ini → python -m pytest), report results.
31
+ 3. Inline general review (this agent, read .tas/rules/common/code-review.md):
32
+ Focus: naming, architecture, error handling, DRY, function size, nesting depth.
33
+ 3b. Parallel specialized agents — launch simultaneously:
34
+ - security-reviewer: read .tas/rules/common/security.md.
35
+ Focus: OWASP Top 10, injection, hardcoded secrets, auth/authz.
36
+ - {lang_agent}: read .tas/rules/[stack]/coding-style.md + .tas/rules/[stack]/patterns.md.
37
+ Focus: async/await, null handling, type safety, stack-specific anti-patterns.
38
+ - database-reviewer (only when {db_agent} = database-reviewer AND scope touches schema/migrations/queries):
39
+ Focus: schema correctness, migration safety, missing indexes, N+1 patterns, data integrity.
40
+ 4. Synthesize findings: Critical / High / Medium / Low with file:line and specific fix.
41
+
42
+ Return full Review Summary.
43
+ ```
44
+
45
+ ## Gate Rule
46
+
47
+ | Result | Action |
48
+ |---|---|
49
+ | Has **Critical** or **High** or **Medium** | List findings, **STOP**, require fix before continuing |
50
+ | Only **Low** | List suggestions, ask if user wants to fix, then continue |
51
+ | No findings | Continue normally |
@@ -1,80 +1,80 @@
1
- # project-status.yaml — Update Convention
2
-
3
- File `project-status.yaml` project root index tổng hợp trạng thái dự án.
4
- Commands cập nhật file này sau mỗi thay đổi artifact hoặc status.
5
-
6
- ## Luôn cập nhật
7
-
8
- ```yaml
9
- last_updated: YYYY-MM-DD # ngày hiện tại, mỗi lần thay đổi
10
- ```
11
-
12
- ## Artifacts (docs đơn lẻ)
13
-
14
- Cập nhật khi tạo mới hoặc thay đổi version:
15
-
16
- ```yaml
17
- artifacts:
18
- prd:
19
- file: docs/prd.md
20
- status: Draft | Review | Approved
21
- last_updated: YYYY-MM-DD
22
- version: "1.0" # tăng minor khi update nội dung, major khi thay đổi lớn
23
- requirements_count: N # chỉ dành cho PRD — đếm số FR-xxx
24
-
25
- sad:
26
- file: docs/sad.md
27
- status: Draft | Review | Approved
28
- last_updated: YYYY-MM-DD
29
- version: "1.0"
30
-
31
- design_spec:
32
- file: docs/design-spec.md
33
- status: Draft | Review | Approved
34
- last_updated: YYYY-MM-DD
35
- version: "1.0"
36
-
37
- security_report:
38
- file: docs/security-report.md
39
- status: "Critical findings present" | "Clean"
40
- last_updated: YYYY-MM-DD
41
- ```
42
-
43
- ## Epics / Features / Stories
44
-
45
- Cập nhật khi tạo mới hoặc status thay đổi:
46
-
47
- ```yaml
48
- epics:
49
- Epic-001:
50
- path: docs/epics/{code}-Epic-001-{slug}/
51
- status: Draft | Active | Done
52
- title: "..."
53
- effort: S | M | L | XL
54
- features:
55
- Feature-001:
56
- status: New | In Progress | Ready To Verify | Verified | Done
57
- title: "..."
58
- stories:
59
- Story-001:
60
- status: New | Committed | In Progress | Deploy Test | Verify Test | Done
61
- title: "..."
62
- plan_status: pending | completed
63
- ```
64
-
65
- ## ADRs
66
-
67
- ```yaml
68
- adrs:
69
- ADR-001:
70
- file: docs/adr/ADR-001-{slug}.md
71
- status: Proposed | Accepted | Deprecated | Superseded
72
- title: "..."
73
- ```
74
-
75
- ## Quy tắc
76
-
77
- - Chỉ cập nhật key liên quan đến thay đổi vừa xảy ra không rewrite toàn bộ file
78
- - Nếu key chưa tồn tại: thêm mới
79
- - Nếu key đã tồn tại: cập nhật giá trị
80
- - Version: minor (+0.1) khi update nội dung; major (+1.0) khi thay đổi cấu trúc lớn
1
+ # project-status.yaml — Update Convention
2
+
3
+ File `project-status.yaml` at project root is aggregate index of project status.
4
+ Commands update this file after each artifact or status change.
5
+
6
+ ## Always update
7
+
8
+ ```yaml
9
+ last_updated: YYYY-MM-DD # current date, each time there's a change
10
+ ```
11
+
12
+ ## Artifacts (individual docs)
13
+
14
+ Update when creating new or changing version:
15
+
16
+ ```yaml
17
+ artifacts:
18
+ prd:
19
+ file: docs/prd.md
20
+ status: Draft | Review | Approved
21
+ last_updated: YYYY-MM-DD
22
+ version: "1.0" # increment minor when updating content, major for large changes
23
+ requirements_count: N # only for PRD — count of FR-xxx
24
+
25
+ sad:
26
+ file: docs/sad.md
27
+ status: Draft | Review | Approved
28
+ last_updated: YYYY-MM-DD
29
+ version: "1.0"
30
+
31
+ design_spec:
32
+ file: docs/design-spec.md
33
+ status: Draft | Review | Approved
34
+ last_updated: YYYY-MM-DD
35
+ version: "1.0"
36
+
37
+ security_report:
38
+ file: docs/security-report.md
39
+ status: "Critical findings present" | "Clean"
40
+ last_updated: YYYY-MM-DD
41
+ ```
42
+
43
+ ## Epics / Features / Stories
44
+
45
+ Update when creating new or changing status:
46
+
47
+ ```yaml
48
+ epics:
49
+ Epic-001:
50
+ path: docs/epics/{code}-Epic-001-{slug}/
51
+ status: Draft | Active | Done
52
+ title: "..."
53
+ effort: S | M | L | XL
54
+ features:
55
+ Feature-001:
56
+ status: New | In Progress | Ready To Verify | Verified | Done
57
+ title: "..."
58
+ stories:
59
+ Story-001:
60
+ status: New | Committed | In Progress | Deploy Test | Verify Test | Done
61
+ title: "..."
62
+ plan_status: pending | completed
63
+ ```
64
+
65
+ ## ADRs
66
+
67
+ ```yaml
68
+ adrs:
69
+ ADR-001:
70
+ file: docs/adr/ADR-001-{slug}.md
71
+ status: Proposed | Accepted | Deprecated | Superseded
72
+ title: "..."
73
+ ```
74
+
75
+ ## Rules
76
+
77
+ - Only update key related to change just occurreddon't rewrite entire file
78
+ - If key doesn't exist yet: add new
79
+ - If key exists: update value
80
+ - Version: minor (+0.1) when updating content; major (+1.0) when large structure change
@@ -0,0 +1,29 @@
1
+ # Stack Detection
2
+
3
+ Read `CLAUDE.md` at root, find `## Tech Stack` section, determine following variables for use in agent prompts and rule file lookups.
4
+
5
+ ## lang_agent — Backend
6
+
7
+ | Tech Stack contains | lang_agent |
8
+ |---|---|
9
+ | `.NET` / `C#` | `csharp-reviewer` |
10
+ | `Node.js` / `TypeScript` / `NestJS` / `Express` | `typescript-reviewer` |
11
+ | `Python` / `FastAPI` / `Django` / `Flask` | `python-reviewer` |
12
+
13
+ **Frontend addition:** if Tech Stack contains `React` → add `typescript-reviewer` to lang_agent (if not already).
14
+
15
+ ## infra_agent and db_agent — Optional
16
+
17
+ | Tech Stack contains | Variable | Value |
18
+ |---|---|---|
19
+ | `AWS` (Infrastructure) | `infra_agent` | `aws-reviewer` |
20
+ | `MySQL` / `PostgreSQL` / `MSSQL` / `SQL Server` / `SQLite` | `db_agent` | `database-reviewer` |
21
+
22
+ ## Rules directory by stack
23
+
24
+ | lang_agent | Rules directory |
25
+ |---|---|
26
+ | `csharp-reviewer` | `.tas/rules/csharp/` |
27
+ | `typescript-reviewer` | `.tas/rules/typescript/` |
28
+ | `python-reviewer` | `.tas/rules/python/` |
29
+ | Frontend / React | `.tas/rules/web/` |
@@ -0,0 +1,30 @@
1
+ # Definition of Done
2
+
3
+ Workflow gate used by `/tas-dev` Step 5 — verify each item before marking Story complete.
4
+
5
+ ## Code
6
+
7
+ - [ ] Code implemented per acceptance criteria
8
+ - [ ] Follows conventions in CLAUDE.md
9
+ - [ ] Each public method has doc comment (XML doc / JSDoc / docstring)
10
+
11
+ ## Testing
12
+
13
+ - [ ] Unit tests pass (happy path + edge cases + negative cases)
14
+ - [ ] No regression on existing tests
15
+
16
+ ## Review
17
+
18
+ - [ ] Code review passed (per `.tas/rules/common/code-review.md`)
19
+ - [ ] If `auto_review = true`, passed automated review
20
+
21
+ ## Documentation
22
+
23
+ - [ ] Technical notes in Story updated
24
+ - [ ] If API changes, corresponding docs updated
25
+
26
+ ## Status
27
+
28
+ - [ ] Story status updated in Story file
29
+ - [ ] `project-status.yaml` updated
30
+ - [ ] Commit message follows correct format
@@ -0,0 +1,89 @@
1
+ # TDD Workflow Rules
2
+
3
+ When `use_tdd=true` in `tas.yaml`, enforce strict Red-Green-Refactor cycle.
4
+ No exceptions — every feature starts with test.
5
+
6
+ ## When to Apply
7
+
8
+ - Implement new feature per Story with clear acceptance criteria
9
+ - Bug fix: write regression test before fixing
10
+ - Refactor: ensure test coverage before changing code
11
+ - DON'T use TDD for: config changes, documentation, pure data migration scripts
12
+
13
+ ## Always / Ask / Never
14
+
15
+ | | Action |
16
+ |---|---|
17
+ | **Always** | Write test FIRST, run to confirm FAIL, then write code |
18
+ | **Always** | Commit after each successful Green phase |
19
+ | **Always** | Run full test suite after Refactor phase |
20
+ | **Ask** | When acceptance criteria vague — clarify before writing test |
21
+ | **Ask** | When test too hard to write — interface/design may need improvement |
22
+ | **Never** | Write implementation before test (even "just to try") |
23
+ | **Never** | Skip Red phase because "test will obviously fail" |
24
+ | **Never** | Write more than minimal code needed to pass test in Green phase |
25
+
26
+ ## Process
27
+
28
+ ### Red Phase — Write Test First
29
+
30
+ 1. Read acceptance criteria in Story
31
+ 2. Write test cases covering each criteria (platform-specific stacks per `/tas-dev`)
32
+ 3. Run tests: `npm test` / `yarn test` / `dotnet test` / `python -m pytest`
33
+ 4. **Verify**: tests MUST FAIL — if pass immediately → test is wrong, rewrite
34
+
35
+ ### Green Phase — Minimal Code
36
+
37
+ 1. Write minimal code to pass tests
38
+ 2. Don't refactor, don't optimize in this phase
39
+ 3. Run tests: confirm PASS
40
+ 4. **Verify**: all new tests pass, no regression
41
+
42
+ ### Refactor Phase — Clean Up
43
+
44
+ 1. Remove duplication, improve naming, reduce complexity
45
+ 2. DON'T change behavior — tests are safety net
46
+ 3. Run full test suite after each refactor step
47
+ 4. **Verify**: coverage >= 80%, all tests still pass
48
+ 5. Commit after successful refactor
49
+
50
+ ## Red Flags
51
+
52
+ - Test passes on first run before implementation → test doesn't test what it should
53
+ - Test too broad ("everything works") → no value, write more specific test
54
+ - Green phase has too much logic → only write enough to pass, no more
55
+ - Refactor phase makes tests fail → refactor is wrong, roll back step by step
56
+ - Writing multiple tests at once before fixing each → only fix one test at a time
57
+
58
+ ## Verification Checklist
59
+
60
+ - [ ] Red: test file exists and runs with FAIL output
61
+ - [ ] Green: test output changes from FAIL → PASS after adding implementation
62
+ - [ ] Refactor: `npm test` / `dotnet test` / `pytest` full suite PASS
63
+ - [ ] Coverage report: >= 80% for changed files
64
+ - [ ] No tests skipped or commented out
65
+
66
+ ## Test Naming Convention
67
+
68
+ ```
69
+ {PROJECT}_E{EPIC}_F{FEATURE}_S{STORY}_{TYPE}_{NUMBER}_{MODIFIER}
70
+ ```
71
+
72
+ | TYPE | Meaning | Layer |
73
+ |------|---------|-------|
74
+ | UT | Unit Test | 1 |
75
+ | IT | Integration Test | 1 |
76
+ | API | API Test | 1 |
77
+ | FT | Functional Test | 2 |
78
+ | E2E | End-to-End Test | 3 |
79
+
80
+ MODIFIER: `H` (Happy), `N` (Negative), `E` (Edge), `S` (Security), `P` (Performance)
81
+
82
+ ## Anti-Rationalization
83
+
84
+ | Rationalization | Counter |
85
+ |---|---|
86
+ | "Test will obviously fail, no need to run" | Skipping Red phase loses verification point — always run |
87
+ | "Writing test after is faster" | TDD saves more debugging time than time spent writing tests first |
88
+ | "This code is too simple for tests" | Simple today, complex after refactor — tests protect future changes |
89
+ | "Interface not clear, write code first for clarity" | Test hard to write is signal interface needs improvement — Ask, don't skip |
@@ -19,14 +19,9 @@ MANDATORY workflow:
19
19
 
20
20
  ## Troubleshooting Test Failures
21
21
 
22
- 1. Use **tdd-guide** agent
23
- 2. Check test isolation
24
- 3. Verify mocks are correct
25
- 4. Fix implementation, not tests (unless tests are wrong)
26
-
27
- ## Agent Support
28
-
29
- - **tdd-guide** - Use PROACTIVELY for new features, enforces write-tests-first
22
+ 1. Check test isolation
23
+ 2. Verify mocks are correct
24
+ 3. Fix implementation, not tests (unless tests are wrong)
30
25
 
31
26
  ## PR Test Gap Analysis
32
27
 
@@ -0,0 +1,36 @@
1
+ # Token Usage Logging
2
+
3
+ Write `## AI Usage Log` at end of artifact file when TAS command completes.
4
+
5
+ ## Process
6
+
7
+ 1. Identify artifact file: from invocation (if specified) or last `docs/` file Write/Edit in session.
8
+ 2. Read this file for format and update rules.
9
+ 3. Read artifact file — check if `## AI Usage Log` already exists.
10
+ 4. Write or update section. Silent on success — no output to conversation.
11
+
12
+ DO NOT apply when: user manually edits file or uses non-TAS commands.
13
+
14
+ ## Token Estimation
15
+
16
+ Estimate from session awareness: character count of each file `Read` ÷ 4 ≈ tokens (English/code), ÷ 2 (Vietnamese).
17
+ Character count of artifact output ÷ 4. Always append `(est.)`. User verifies with `/cost` (CLI) or `/context` (Desktop app).
18
+
19
+ ## Format
20
+
21
+ ```markdown
22
+ ---
23
+
24
+ ## AI Usage Log
25
+
26
+ | # | Date | Command | Input (est.) | Output (est.) |
27
+ |---|------|---------|-------------|---------------|
28
+ | 1 | YYYY-MM-DD | /tas-{name} | ~{N}k | ~{N}k |
29
+ | 2 | YYYY-MM-DD | /tas-{name} (revision) | ~{N}k | ~{N}k |
30
+ | **Total** | | | **~{N}k** | **~{N}k** |
31
+ ```
32
+
33
+ ## Update Rules
34
+
35
+ - **First time**: section doesn't exist → append entire section with first row and Total row
36
+ - **Subsequent**: append new row before Total row, update Total (cumulative)
@@ -7,13 +7,13 @@ paths:
7
7
 
8
8
  # C# API Automation Testing
9
9
 
10
- > Dùng bởi `/tas-api-test`. Extends [csharp/testing.md](./testing.md).
10
+ > Used by `/tas-apitest`. Extends [csharp/testing.md](./testing.md).
11
11
 
12
12
  ## Tech Stack
13
13
 
14
- | Thành phần | Lựa chọn |
14
+ | Component | Choice |
15
15
  |---|---|
16
- | Framework | xUnit (default) — match project nếu đã dùng MSTest/NUnit |
16
+ | Framework | xUnit (default) — match project if already using MSTest/NUnit |
17
17
  | Assertions | FluentAssertions |
18
18
  | HTTP | System.Net.Http.HttpClient |
19
19
  | Config | Microsoft.Extensions.Configuration + JSON/EnvVars |
@@ -33,7 +33,7 @@ paths:
33
33
 
34
34
  ```
35
35
  tests/ApiTests/
36
- appsettings.json # base (không secrets thật)
36
+ appsettings.json # base (no real secrets)
37
37
  appsettings.Test.json # Test env override
38
38
  appsettings.Staging.json # Staging env override
39
39
  .gitignore # appsettings.*.local.json
@@ -42,7 +42,7 @@ tests/ApiTests/
42
42
  TestBase.cs
43
43
  v1/
44
44
  UsersApiTests.cs
45
- v2/ # APPEND-ONLY: không sửa v1
45
+ v2/ # APPEND-ONLY: don't modify v1
46
46
  UsersApiTests.cs
47
47
  ```
48
48
 
@@ -116,18 +116,18 @@ public abstract class TestBase : IAsyncLifetime
116
116
  }
117
117
  ```
118
118
 
119
- ## Test Class Header (bắt buộc)
119
+ ## Test Class Header (required)
120
120
 
121
121
  ```csharp
122
122
  // ============================================================
123
123
  // {Resource} API Tests — v{N}
124
124
  // Spec: {spec-file} | Generated: {YYYY-MM-DD} | Story: {ID}
125
- // APPEND-ONLY: không sửa methods đã tồn tại.
125
+ // APPEND-ONLY: don't modify existing methods.
126
126
  // ============================================================
127
127
  namespace ApiTests.V{N};
128
128
  public sealed class {Resource}ApiTests : TestBase
129
129
  {
130
- // Inline DTOs — không import từ production code
130
+ // Inline DTOs — don't import from production code
131
131
  private sealed record {Resource}Dto(Guid Id, string Name);
132
132
  private sealed record ListResponse<T>(IReadOnlyList<T> Data, int Total);
133
133
  }
@@ -139,33 +139,33 @@ public sealed class {Resource}ApiTests : TestBase
139
139
  {HttpMethod}_{Resource}_Returns{Status}_When{Condition}
140
140
  ```
141
141
 
142
- dụ: `GetById_User_Returns200_WhenExists`, `Create_Order_Returns422_WhenEmailInvalid`
142
+ Example: `GetById_User_Returns200_WhenExists`, `Create_Order_Returns422_WhenEmailInvalid`
143
143
 
144
- AC test: comment `// AC: {text}` ngay dưới XML doc.
144
+ AC test: comment `// AC: {text}` right below XML doc.
145
145
 
146
- ## XML Doc (bắt buộc trên mỗi test)
146
+ ## XML Doc (required on each test)
147
147
 
148
148
  ```csharp
149
- /// <summary>Verify {METHOD} {path} → {status} khi {condition}. Spec: {ref}</summary>
149
+ /// <summary>Verify {METHOD} {path} → {status} when {condition}. Spec: {ref}</summary>
150
150
  [Fact]
151
151
  public async Task ...
152
152
  ```
153
153
 
154
154
  ## Coverage Matrix
155
155
 
156
- | Điều kiện | Status | Khi nào |
156
+ | Condition | Status | When |
157
157
  |---|---|---|
158
- | Valid, authenticated | 2xx | Luôn |
159
- | Không token | 401 | Endpoint yêu cầu auth |
160
- | Không đủ quyền | 403 | RBAC / ownership |
161
- | `{id}` không tồn tại | 404 | path param |
162
- | Required field thiếu/sai | 400/422 | request body |
163
- | Business rule (từ AC) | 4xx | Story AC tương ứng |
158
+ | Valid, authenticated | 2xx | Always |
159
+ | No token | 401 | Endpoint requires auth |
160
+ | Insufficient permission | 403 | RBAC / ownership |
161
+ | `{id}` doesn't exist | 404 | Has path param |
162
+ | Required field missing/invalid | 400/422 | Has request body |
163
+ | Business rule (from AC) | 4xx | Story has corresponding AC |
164
164
 
165
165
  ## CI/CD Env Vars
166
166
 
167
167
  ```
168
168
  ASPNETCORE_ENVIRONMENT=Test
169
- APITEST__AUTH__USERNAME=... # double __ cho nested key
169
+ APITEST__AUTH__USERNAME=... # double __ for nested key
170
170
  APITEST__AUTH__PASSWORD=...
171
171
  ```
@@ -5,8 +5,6 @@ paths:
5
5
  ---
6
6
  # C# Coding Style
7
7
 
8
- > This file extends [common/coding-style.md](../common/coding-style.md) with C#-specific content.
9
-
10
8
  ## Standards
11
9
 
12
10
  - Follow current .NET conventions and enable nullable reference types
@@ -53,6 +53,16 @@ await connection.QueryAsync<Order>(sql, new { customerId });
53
53
  - Log detailed exceptions with structured context server-side
54
54
  - Do not expose stack traces, SQL text, or filesystem paths in API responses
55
55
 
56
+ ## Web / API Hardening
57
+
58
+ - Enforce HTTPS in production (`app.UseHttpsRedirection()`)
59
+ - Enable HSTS (`app.UseHsts()`)
60
+ - Add security headers: `X-Content-Type-Options: nosniff`, `X-Frame-Options: DENY`, `Content-Security-Policy`
61
+ - CORS policy must be restrictive — list allowed origins explicitly, never `AllowAnyOrigin()` in production
62
+ - Anti-forgery token required for state-changing form posts (`[ValidateAntiForgeryToken]`)
63
+ - File upload validation: check size limit, allowed MIME types, sanitize file name, scan for malware before persisting
64
+ - Encrypt PII at rest (column-level encryption, Always Encrypted, or transparent data encryption)
65
+
56
66
  ## References
57
67
 
58
68
  See skill: `security-review` for broader application security review checklists.
@@ -5,8 +5,6 @@ paths:
5
5
  ---
6
6
  # Python Coding Style
7
7
 
8
- > This file extends [common/coding-style.md](../common/coding-style.md) with Python specific content.
9
-
10
8
  ## Standards
11
9
 
12
10
  - Follow **PEP 8** conventions
@@ -7,8 +7,6 @@ paths:
7
7
  ---
8
8
  # TypeScript/JavaScript Coding Style
9
9
 
10
- > This file extends [common/coding-style.md](../common/coding-style.md) with TypeScript/JavaScript specific content.
11
-
12
10
  ## Types and Interfaces
13
11
 
14
12
  Use types to make public APIs, shared models, and component props explicit, readable, and reusable.