@torus-engineering/tas-kit 1.5.1 → 1.6.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 (110) hide show
  1. package/.claude/agents/README.md +83 -0
  2. package/.claude/agents/architect.md +53 -0
  3. package/.claude/agents/aws-reviewer.md +71 -0
  4. package/.claude/agents/build-resolver.md +59 -0
  5. package/.claude/agents/code-architect.md +62 -0
  6. package/.claude/agents/code-explorer.md +63 -0
  7. package/.claude/agents/code-simplifier.md +53 -0
  8. package/.claude/agents/comment-analyzer.md +59 -0
  9. package/.claude/agents/conversation-analyzer.md +57 -0
  10. package/.claude/agents/csharp-reviewer.md +62 -0
  11. package/.claude/agents/database-reviewer.md +73 -0
  12. package/.claude/agents/doc-updater.md +66 -0
  13. package/.claude/agents/docs-lookup.md +55 -0
  14. package/.claude/agents/e2e-runner.md +61 -0
  15. package/.claude/agents/harness-optimizer.md +62 -0
  16. package/.claude/agents/loop-operator.md +56 -0
  17. package/.claude/agents/performance-optimizer.md +78 -0
  18. package/.claude/agents/planner.md +82 -0
  19. package/.claude/agents/pr-test-analyzer.md +68 -0
  20. package/.claude/agents/python-reviewer.md +67 -0
  21. package/.claude/agents/pytorch-build-resolver.md +76 -0
  22. package/.claude/agents/refactor-cleaner.md +70 -0
  23. package/.claude/agents/security-reviewer.md +79 -0
  24. package/.claude/agents/seo-specialist.md +75 -0
  25. package/.claude/agents/silent-failure-hunter.md +69 -0
  26. package/.claude/agents/tdd-guide.md +84 -0
  27. package/.claude/agents/type-design-analyzer.md +75 -0
  28. package/.claude/agents/typescript-reviewer.md +65 -0
  29. package/.claude/commands/ado-create.md +2 -1
  30. package/.claude/commands/ado-delete.md +3 -2
  31. package/.claude/commands/ado-get.md +2 -1
  32. package/.claude/commands/ado-status.md +2 -1
  33. package/.claude/commands/ado-update.md +2 -1
  34. package/.claude/commands/tas-adr.md +13 -12
  35. package/.claude/commands/tas-bug.md +97 -50
  36. package/.claude/commands/tas-design.md +3 -1
  37. package/.claude/commands/tas-dev.md +115 -0
  38. package/.claude/commands/tas-epic.md +4 -2
  39. package/.claude/commands/tas-feature.md +5 -3
  40. package/.claude/commands/tas-fix.md +47 -0
  41. package/.claude/commands/tas-plan.md +184 -0
  42. package/.claude/commands/tas-prd.md +3 -1
  43. package/.claude/commands/tas-review.md +104 -0
  44. package/.claude/commands/tas-sad.md +3 -1
  45. package/.claude/commands/tas-security.md +80 -0
  46. package/.claude/commands/tas-spec.md +50 -0
  47. package/.claude/commands/tas-story.md +77 -40
  48. package/.claude/commands/tas-verify.md +8 -0
  49. package/.claude/hooks/code-quality.js +127 -0
  50. package/.claude/hooks/session-end.js +116 -0
  51. package/.claude/rules/.gitkeep +0 -0
  52. package/.claude/rules/common/agents.md +65 -0
  53. package/.claude/rules/common/code-review.md +124 -0
  54. package/.claude/rules/common/coding-style.md +90 -0
  55. package/.claude/rules/common/development-workflow.md +44 -0
  56. package/.claude/rules/common/git-workflow.md +24 -0
  57. package/.claude/rules/common/hooks.md +30 -0
  58. package/.claude/rules/common/patterns.md +31 -0
  59. package/.claude/rules/common/performance.md +55 -0
  60. package/.claude/rules/common/post-review-agent.md +39 -0
  61. package/.claude/rules/common/project-status.md +80 -0
  62. package/.claude/rules/common/security.md +29 -0
  63. package/.claude/rules/common/stack-detection.md +29 -0
  64. package/.claude/rules/common/testing.md +57 -0
  65. package/.claude/rules/csharp/coding-style.md +72 -0
  66. package/.claude/rules/csharp/hooks.md +25 -0
  67. package/.claude/rules/csharp/patterns.md +50 -0
  68. package/.claude/rules/csharp/security.md +58 -0
  69. package/.claude/rules/csharp/testing.md +46 -0
  70. package/.claude/rules/python/coding-style.md +42 -0
  71. package/.claude/rules/python/hooks.md +19 -0
  72. package/.claude/rules/python/patterns.md +39 -0
  73. package/.claude/rules/python/security.md +30 -0
  74. package/.claude/rules/python/testing.md +38 -0
  75. package/.claude/rules/typescript/coding-style.md +199 -0
  76. package/.claude/rules/typescript/hooks.md +22 -0
  77. package/.claude/rules/typescript/patterns.md +52 -0
  78. package/.claude/rules/typescript/security.md +28 -0
  79. package/.claude/rules/typescript/testing.md +18 -0
  80. package/.claude/rules/web/coding-style.md +96 -0
  81. package/.claude/rules/web/design-quality.md +63 -0
  82. package/.claude/rules/web/hooks.md +120 -0
  83. package/.claude/rules/web/patterns.md +79 -0
  84. package/.claude/rules/web/performance.md +64 -0
  85. package/.claude/rules/web/security.md +57 -0
  86. package/.claude/rules/web/testing.md +55 -0
  87. package/.claude/settings.json +37 -0
  88. package/.claude/settings.local.json +38 -0
  89. package/.claude/skills/ado-integration/SKILL.md +44 -1
  90. package/.claude/skills/agent-harness-construction/SKILL.md +77 -0
  91. package/.claude/skills/agent-introspection-debugging/SKILL.md +157 -0
  92. package/.claude/skills/ai-regression-testing/SKILL.md +364 -0
  93. package/.claude/skills/api-design/SKILL.md +528 -0
  94. package/.claude/skills/architecture-decision-records/SKILL.md +184 -0
  95. package/.claude/skills/backend-patterns/SKILL.md +602 -0
  96. package/.claude/skills/benchmark/SKILL.md +98 -0
  97. package/.claude/skills/browser-qa/SKILL.md +92 -0
  98. package/.claude/skills/canary-watch/SKILL.md +104 -0
  99. package/.claude/skills/tas-conventions/SKILL.md +51 -3
  100. package/.claude/skills/tas-implementation-complete/SKILL.md +97 -0
  101. package/.claude/skills/tas-tdd/SKILL.md +72 -16
  102. package/.tas/README.md +29 -24
  103. package/.tas/tas-example.yaml +2 -1
  104. package/.tas/templates/Story.md +18 -18
  105. package/CLAUDE-Example.md +1 -1
  106. package/README.md +20 -5
  107. package/package.json +1 -1
  108. package/.claude/commands/tas-dev-story.md +0 -61
  109. package/.claude/commands/tas-review-code.md +0 -42
  110. package/.claude/commands/tas-security-check.md +0 -30
@@ -0,0 +1,65 @@
1
+ # Agent Orchestration
2
+
3
+ ## Parallel Execution Pattern (TAS Commands)
4
+
5
+ TAS commands launch agents **đồng thời** — không chờ nhau. Chờ **TẤT CẢ** xong mới tổng hợp.
6
+
7
+ ### Parallel Agent Sets theo Command
8
+
9
+ | Command | Agents chạy song song | Điều kiện |
10
+ |---------|----------------------|-----------|
11
+ | `/tas-plan` (Bước 2) | code-explorer + [architect] | architect khi ảnh hưởng architecture |
12
+ | `/tas-dev` (Bước 3) | [build-resolver] | Chỉ khi tests vẫn fail sau 1 lần tự fix |
13
+ | `/tas-dev` (Bước 4) | code-reviewer + security-reviewer + [lang-reviewer] | lang theo stack |
14
+ | `/tas-bug` (fix step) | [build-resolver] | Chỉ khi build fail hoặc test lỗi compile |
15
+ | `/tas-verify` (Bước 4.5) | e2e-runner | Khi Feature có E2E test cases |
16
+ | `/tas-review` | code-reviewer + security-reviewer + [lang-reviewer] + [aws-reviewer] | lang theo stack; aws nếu có AWS |
17
+ | `/tas-security` | security-reviewer + [database-reviewer] + [aws-reviewer] | db nếu SQL; aws nếu AWS |
18
+ | `tas-implementation-complete` | code-reviewer + security-reviewer + [lang-reviewer] | Auto-invoke khi user nói "done/xong" |
19
+
20
+ ### Cách viết agent prompt trong commands
21
+
22
+ Mỗi agent trong parallel set cần prompt đủ 4 yếu tố:
23
+
24
+ ```
25
+ **Agent N — `<agent-name>`** (<điều kiện chạy>):
26
+ > [1] Scope — review/analyze cái gì (file path, git diff, directory)
27
+ > [2] Read — rule files nào phải đọc trước khi phân tích
28
+ > [3] Focus — tập trung vào những gì cụ thể
29
+ > [4] Format — Critical / High / Medium / Low với file:line
30
+ ```
31
+
32
+ **Ví dụ chuẩn:**
33
+ ```
34
+ **Agent 1 — `security-reviewer`** (luôn chạy):
35
+ > Security audit [scope]. Đọc `.claude/rules/common/security.md`.
36
+ > Tập trung: OWASP Top 10, injection, hardcoded secrets, auth/authz.
37
+ > Format: Critical / High / Medium / Low với file:line và remediation.
38
+ ```
39
+
40
+ ### Gate Rule sau khi tổng hợp
41
+
42
+ ```
43
+ Có Critical/High → Block, list findings, yêu cầu fix trước khi tiếp tục
44
+ Chỉ có Medium/Low → List gợi ý, hỏi user có muốn fix không, sau đó tiếp tục
45
+ ```
46
+
47
+ ## Rule Files — Khi Nào Agent Cần Đọc
48
+
49
+ Agents **không tự động nhận** rule files. Commands và skills phải **chủ động** chỉ định trong agent prompt.
50
+
51
+ | Rule File | Agent nên đọc | Ngữ cảnh |
52
+ |-----------|---------------|----------|
53
+ | `common/security.md` | `security-reviewer` | Mọi security audit |
54
+ | `common/code-review.md` | `code-reviewer` | Mọi code review |
55
+ | `common/testing.md` | `tdd-guide`, lang-reviewers | Review test coverage |
56
+ | `common/patterns.md` | `architect` | Đánh giá architectural choice |
57
+ | `common/development-workflow.md` | `architect`, `planner` | Plan/design phase |
58
+ | `[stack]/coding-style.md` | lang-reviewer | Language-specific review |
59
+ | `[stack]/patterns.md` | lang-reviewer | Language-specific patterns |
60
+ | `[stack]/security.md` | `security-reviewer` | Stack-specific security risks |
61
+ | `[stack]/testing.md` | lang-reviewer | Stack-specific test patterns |
62
+ | `web/design-quality.md` | Frontend reviewer | Review UI code |
63
+ | `web/performance.md` | Frontend reviewer | Review performance |
64
+
65
+ > Danh sách đầy đủ tất cả agents: xem `.claude/agents/README.md`
@@ -0,0 +1,124 @@
1
+ # Code Review Standards
2
+
3
+ ## Purpose
4
+
5
+ Code review ensures quality, security, and maintainability before code is merged. This rule defines when and how to conduct code reviews.
6
+
7
+ ## When to Review
8
+
9
+ **MANDATORY review triggers:**
10
+
11
+ - After writing or modifying code
12
+ - Before any commit to shared branches
13
+ - When security-sensitive code is changed (auth, payments, user data)
14
+ - When architectural changes are made
15
+ - Before merging pull requests
16
+
17
+ **Pre-Review Requirements:**
18
+
19
+ Before requesting review, ensure:
20
+
21
+ - All automated checks (CI/CD) are passing
22
+ - Merge conflicts are resolved
23
+ - Branch is up to date with target branch
24
+
25
+ ## Review Checklist
26
+
27
+ Before marking code complete:
28
+
29
+ - [ ] Code is readable and well-named
30
+ - [ ] Functions are focused (<50 lines)
31
+ - [ ] Files are cohesive (<800 lines)
32
+ - [ ] No deep nesting (>4 levels)
33
+ - [ ] Errors are handled explicitly
34
+ - [ ] No hardcoded secrets or credentials
35
+ - [ ] No console.log or debug statements
36
+ - [ ] Tests exist for new functionality
37
+ - [ ] Test coverage meets 80% minimum
38
+
39
+ ## Security Review Triggers
40
+
41
+ **STOP and use security-reviewer agent when:**
42
+
43
+ - Authentication or authorization code
44
+ - User input handling
45
+ - Database queries
46
+ - File system operations
47
+ - External API calls
48
+ - Cryptographic operations
49
+ - Payment or financial code
50
+
51
+ ## Review Severity Levels
52
+
53
+ | Level | Meaning | Action |
54
+ |-------|---------|--------|
55
+ | CRITICAL | Security vulnerability or data loss risk | **BLOCK** - Must fix before merge |
56
+ | HIGH | Bug or significant quality issue | **WARN** - Should fix before merge |
57
+ | MEDIUM | Maintainability concern | **INFO** - Consider fixing |
58
+ | LOW | Style or minor suggestion | **NOTE** - Optional |
59
+
60
+ ## Agent Usage
61
+
62
+ Use these agents for code review:
63
+
64
+ | Agent | Purpose |
65
+ |-------|---------|
66
+ | **code-reviewer** | General code quality, patterns, best practices |
67
+ | **security-reviewer** | Security vulnerabilities, OWASP Top 10 |
68
+ | **typescript-reviewer** | TypeScript/JavaScript specific issues |
69
+ | **python-reviewer** | Python specific issues |
70
+ | **go-reviewer** | Go specific issues |
71
+ | **rust-reviewer** | Rust specific issues |
72
+
73
+ ## Review Workflow
74
+
75
+ ```
76
+ 1. Run git diff to understand changes
77
+ 2. Check security checklist first
78
+ 3. Review code quality checklist
79
+ 4. Run relevant tests
80
+ 5. Verify coverage >= 80%
81
+ 6. Use appropriate agent for detailed review
82
+ ```
83
+
84
+ ## Common Issues to Catch
85
+
86
+ ### Security
87
+
88
+ - Hardcoded credentials (API keys, passwords, tokens)
89
+ - SQL injection (string concatenation in queries)
90
+ - XSS vulnerabilities (unescaped user input)
91
+ - Path traversal (unsanitized file paths)
92
+ - CSRF protection missing
93
+ - Authentication bypasses
94
+
95
+ ### Code Quality
96
+
97
+ - Large functions (>50 lines) - split into smaller
98
+ - Large files (>800 lines) - extract modules
99
+ - Deep nesting (>4 levels) - use early returns
100
+ - Missing error handling - handle explicitly
101
+ - Mutation patterns - prefer immutable operations
102
+ - Missing tests - add test coverage
103
+
104
+ ### Performance
105
+
106
+ - N+1 queries - use JOINs or batching
107
+ - Missing pagination - add LIMIT to queries
108
+ - Unbounded queries - add constraints
109
+ - Missing caching - cache expensive operations
110
+
111
+ ## Approval Criteria
112
+
113
+ - **Approve**: No CRITICAL or HIGH issues
114
+ - **Warning**: Only HIGH issues (merge with caution)
115
+ - **Block**: CRITICAL issues found
116
+
117
+ ## Integration with Other Rules
118
+
119
+ This rule works with:
120
+
121
+ - [testing.md](testing.md) - Test coverage requirements
122
+ - [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,90 @@
1
+ # Coding Style
2
+
3
+ ## Immutability (CRITICAL)
4
+
5
+ ALWAYS create new objects, NEVER mutate existing ones:
6
+
7
+ ```
8
+ // Pseudocode
9
+ WRONG: modify(original, field, value) → changes original in-place
10
+ CORRECT: update(original, field, value) → returns new copy with change
11
+ ```
12
+
13
+ Rationale: Immutable data prevents hidden side effects, makes debugging easier, and enables safe concurrency.
14
+
15
+ ## Core Principles
16
+
17
+ ### KISS (Keep It Simple)
18
+
19
+ - Prefer the simplest solution that actually works
20
+ - Avoid premature optimization
21
+ - Optimize for clarity over cleverness
22
+
23
+ ### DRY (Don't Repeat Yourself)
24
+
25
+ - Extract repeated logic into shared functions or utilities
26
+ - Avoid copy-paste implementation drift
27
+ - Introduce abstractions when repetition is real, not speculative
28
+
29
+ ### YAGNI (You Aren't Gonna Need It)
30
+
31
+ - Do not build features or abstractions before they are needed
32
+ - Avoid speculative generality
33
+ - Start simple, then refactor when the pressure is real
34
+
35
+ ## File Organization
36
+
37
+ MANY SMALL FILES > FEW LARGE FILES:
38
+ - High cohesion, low coupling
39
+ - 200-400 lines typical, 800 max
40
+ - Extract utilities from large modules
41
+ - Organize by feature/domain, not by type
42
+
43
+ ## Error Handling
44
+
45
+ ALWAYS handle errors comprehensively:
46
+ - Handle errors explicitly at every level
47
+ - Provide user-friendly error messages in UI-facing code
48
+ - Log detailed error context on the server side
49
+ - Never silently swallow errors
50
+
51
+ ## Input Validation
52
+
53
+ ALWAYS validate at system boundaries:
54
+ - Validate all user input before processing
55
+ - Use schema-based validation where available
56
+ - Fail fast with clear error messages
57
+ - Never trust external data (API responses, user input, file content)
58
+
59
+ ## Naming Conventions
60
+
61
+ - Variables and functions: `camelCase` with descriptive names
62
+ - Booleans: prefer `is`, `has`, `should`, or `can` prefixes
63
+ - Interfaces, types, and components: `PascalCase`
64
+ - Constants: `UPPER_SNAKE_CASE`
65
+ - Custom hooks: `camelCase` with a `use` prefix
66
+
67
+ ## Code Smells to Avoid
68
+
69
+ ### Deep Nesting
70
+
71
+ Prefer early returns over nested conditionals once the logic starts stacking.
72
+
73
+ ### Magic Numbers
74
+
75
+ Use named constants for meaningful thresholds, delays, and limits.
76
+
77
+ ### Long Functions
78
+
79
+ Split large functions into focused pieces with clear responsibilities.
80
+
81
+ ## Code Quality Checklist
82
+
83
+ Before marking work complete:
84
+ - [ ] Code is readable and well-named
85
+ - [ ] Functions are small (<50 lines)
86
+ - [ ] Files are focused (<800 lines)
87
+ - [ ] No deep nesting (>4 levels)
88
+ - [ ] Proper error handling
89
+ - [ ] No hardcoded values (use constants or config)
90
+ - [ ] No mutation (immutable patterns used)
@@ -0,0 +1,44 @@
1
+ # Development Workflow
2
+
3
+ > This file extends [common/git-workflow.md](./git-workflow.md) with the full feature development process that happens before git operations.
4
+
5
+ The Feature Implementation Workflow describes the development pipeline: research, planning, TDD, code review, and then committing to git.
6
+
7
+ ## Feature Implementation Workflow
8
+
9
+ 0. **Research & Reuse** _(mandatory before any new implementation)_
10
+ - **GitHub code search first:** Run `gh search repos` and `gh search code` to find existing implementations, templates, and patterns before writing anything new.
11
+ - **Library docs second:** Use Context7 or primary vendor docs to confirm API behavior, package usage, and version-specific details before implementing.
12
+ - **Exa only when the first two are insufficient:** Use Exa for broader web research or discovery after GitHub search and primary docs.
13
+ - **Check package registries:** Search npm, PyPI, crates.io, and other registries before writing utility code. Prefer battle-tested libraries over hand-rolled solutions.
14
+ - **Search for adaptable implementations:** Look for open-source projects that solve 80%+ of the problem and can be forked, ported, or wrapped.
15
+ - Prefer adopting or porting a proven approach over writing net-new code when it meets the requirement.
16
+
17
+ 1. **Plan First**
18
+ - Use **planner** agent to create implementation plan
19
+ - Generate planning docs before coding: PRD, architecture, system_design, tech_doc, task_list
20
+ - Identify dependencies and risks
21
+ - Break down into phases
22
+
23
+ 2. **TDD Approach**
24
+ - Use **tdd-guide** agent
25
+ - Write tests first (RED)
26
+ - Implement to pass tests (GREEN)
27
+ - Refactor (IMPROVE)
28
+ - Verify 80%+ coverage
29
+
30
+ 3. **Code Review**
31
+ - Use **code-reviewer** agent immediately after writing code
32
+ - Address CRITICAL and HIGH issues
33
+ - Fix MEDIUM issues when possible
34
+
35
+ 4. **Commit & Push**
36
+ - Detailed commit messages
37
+ - Follow conventional commits format
38
+ - See [git-workflow.md](./git-workflow.md) for commit message format and PR process
39
+
40
+ 5. **Pre-Review Checks**
41
+ - Verify all automated checks (CI/CD) are passing
42
+ - Resolve any merge conflicts
43
+ - Ensure branch is up to date with target branch
44
+ - Only request review after these checks pass
@@ -0,0 +1,24 @@
1
+ # Git Workflow
2
+
3
+ ## Commit Message Format
4
+ ```
5
+ <type>: <description>
6
+
7
+ <optional body>
8
+ ```
9
+
10
+ Types: feat, fix, refactor, docs, test, chore, perf, ci
11
+
12
+ Note: Attribution disabled globally via ~/.claude/settings.json.
13
+
14
+ ## Pull Request Workflow
15
+
16
+ When creating PRs:
17
+ 1. Analyze full commit history (not just latest commit)
18
+ 2. Use `git diff [base-branch]...HEAD` to see all changes
19
+ 3. Draft comprehensive PR summary
20
+ 4. Include test plan with TODOs
21
+ 5. Push with `-u` flag if new branch
22
+
23
+ > For the full development process (planning, TDD, code review) before git operations,
24
+ > see [development-workflow.md](./development-workflow.md).
@@ -0,0 +1,30 @@
1
+ # Hooks System
2
+
3
+ ## Hook Types
4
+
5
+ - **PreToolUse**: Before tool execution (validation, parameter modification)
6
+ - **PostToolUse**: After tool execution (auto-format, checks)
7
+ - **Stop**: When session ends (final verification)
8
+
9
+ ## Auto-Accept Permissions
10
+
11
+ Use with caution:
12
+ - Enable for trusted, well-defined plans
13
+ - Disable for exploratory work
14
+ - Never use dangerously-skip-permissions flag
15
+ - Configure `allowedTools` in `~/.claude.json` instead
16
+
17
+ ## TodoWrite Best Practices
18
+
19
+ Use TodoWrite tool to:
20
+ - Track progress on multi-step tasks
21
+ - Verify understanding of instructions
22
+ - Enable real-time steering
23
+ - Show granular implementation steps
24
+
25
+ Todo list reveals:
26
+ - Out of order steps
27
+ - Missing items
28
+ - Extra unnecessary items
29
+ - Wrong granularity
30
+ - Misinterpreted requirements
@@ -0,0 +1,31 @@
1
+ # Common Patterns
2
+
3
+ ## Skeleton Projects
4
+
5
+ When implementing new functionality:
6
+ 1. Search for battle-tested skeleton projects
7
+ 2. Use parallel agents to evaluate options:
8
+ - Security assessment
9
+ - Extensibility analysis
10
+ - Relevance scoring
11
+ - Implementation planning
12
+ 3. Clone best match as foundation
13
+ 4. Iterate within proven structure
14
+
15
+ ## Design Patterns
16
+
17
+ ### Repository Pattern
18
+
19
+ Encapsulate data access behind a consistent interface:
20
+ - Define standard operations: findAll, findById, create, update, delete
21
+ - Concrete implementations handle storage details (database, API, file, etc.)
22
+ - Business logic depends on the abstract interface, not the storage mechanism
23
+ - Enables easy swapping of data sources and simplifies testing with mocks
24
+
25
+ ### API Response Format
26
+
27
+ Use a consistent envelope for all API responses:
28
+ - Include a success/status indicator
29
+ - Include the data payload (nullable on error)
30
+ - Include an error message field (nullable on success)
31
+ - Include metadata for paginated responses (total, page, limit)
@@ -0,0 +1,55 @@
1
+ # Performance Optimization
2
+
3
+ ## Model Selection Strategy
4
+
5
+ **Haiku 4.5** (90% of Sonnet capability, 3x cost savings):
6
+ - Lightweight agents with frequent invocation
7
+ - Pair programming and code generation
8
+ - Worker agents in multi-agent systems
9
+
10
+ **Sonnet 4.6** (Best coding model):
11
+ - Main development work
12
+ - Orchestrating multi-agent workflows
13
+ - Complex coding tasks
14
+
15
+ **Opus 4.5** (Deepest reasoning):
16
+ - Complex architectural decisions
17
+ - Maximum reasoning requirements
18
+ - Research and analysis tasks
19
+
20
+ ## Context Window Management
21
+
22
+ Avoid last 20% of context window for:
23
+ - Large-scale refactoring
24
+ - Feature implementation spanning multiple files
25
+ - Debugging complex interactions
26
+
27
+ Lower context sensitivity tasks:
28
+ - Single-file edits
29
+ - Independent utility creation
30
+ - Documentation updates
31
+ - Simple bug fixes
32
+
33
+ ## Extended Thinking + Plan Mode
34
+
35
+ Extended thinking is enabled by default, reserving up to 31,999 tokens for internal reasoning.
36
+
37
+ Control extended thinking via:
38
+ - **Toggle**: Option+T (macOS) / Alt+T (Windows/Linux)
39
+ - **Config**: Set `alwaysThinkingEnabled` in `~/.claude/settings.json`
40
+ - **Budget cap**: `export MAX_THINKING_TOKENS=10000`
41
+ - **Verbose mode**: Ctrl+O to see thinking output
42
+
43
+ For complex tasks requiring deep reasoning:
44
+ 1. Ensure extended thinking is enabled (on by default)
45
+ 2. Enable **Plan Mode** for structured approach
46
+ 3. Use multiple critique rounds for thorough analysis
47
+ 4. Use split role sub-agents for diverse perspectives
48
+
49
+ ## Build Troubleshooting
50
+
51
+ If build fails:
52
+ 1. Use **build-error-resolver** agent
53
+ 2. Analyze error messages
54
+ 3. Fix incrementally
55
+ 4. Verify after each fix
@@ -0,0 +1,39 @@
1
+ # Post-Implementation Review (Isolated Agent)
2
+
3
+ Sau khi implement hoặc fix xong, chạy review qua **Agent độc lập** — không dùng session hiện tại để tránh reviewer bias từ quá trình implement.
4
+
5
+ ## Cách dùng
6
+
7
+ Gọi `Agent` tool với prompt sau (thay thế các placeholder `{}`):
8
+
9
+ ```
10
+ Bạn là code reviewer. Không có context từ session trước — hãy review hoàn toàn khách quan.
11
+
12
+ Artifact: {path-to-artifact-file}
13
+ Changed files: {danh sách files vừa thay đổi}
14
+ Stack: {stack từ CLAUDE.md}
15
+
16
+ Thực hiện:
17
+ 1. Hygiene scan: debug code còn sót (console.log, debugger, print), secrets hardcoded,
18
+ commented-out blocks lớn (>5 dòng).
19
+ 2. Chạy tests: detect test runner (package.json → npm test / *.csproj → dotnet test /
20
+ pytest.ini → python -m pytest), report kết quả.
21
+ 3. Parallel review — launch đồng thời:
22
+ - code-reviewer: đọc .tas/checklists/code-review.md + .claude/rules/common/code-review.md.
23
+ Tập trung: naming, architecture, error handling, DRY, function size, nesting depth.
24
+ - security-reviewer: đọc .claude/rules/common/security.md.
25
+ Tập trung: OWASP Top 10, injection, hardcoded secrets, auth/authz.
26
+ - {lang_agent}: đọc .claude/rules/[stack]/coding-style.md + .claude/rules/[stack]/patterns.md.
27
+ Tập trung: async/await, null handling, type safety, anti-patterns của stack.
28
+ 4. Tổng hợp findings: Critical / High / Medium / Low với file:line và fix cụ thể.
29
+
30
+ Trả về Review Summary đầy đủ.
31
+ ```
32
+
33
+ ## Gate Rule
34
+
35
+ | Kết quả | Hành động |
36
+ |---|---|
37
+ | Có **Critical** hoặc **High** | List findings, **DỪNG**, yêu cầu fix trước khi tiếp tục |
38
+ | Chỉ có **Medium** / **Low** | List gợi ý, hỏi user có muốn fix không, sau đó tiếp tục |
39
+ | Không có findings | Tiếp tục bình thường |
@@ -0,0 +1,80 @@
1
+ # project-status.yaml — Update Convention
2
+
3
+ File `project-status.yaml` ở project root là 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 có 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
@@ -0,0 +1,29 @@
1
+ # Security Guidelines
2
+
3
+ ## Mandatory Security Checks
4
+
5
+ Before ANY commit:
6
+ - [ ] No hardcoded secrets (API keys, passwords, tokens)
7
+ - [ ] All user inputs validated
8
+ - [ ] SQL injection prevention (parameterized queries)
9
+ - [ ] XSS prevention (sanitized HTML)
10
+ - [ ] CSRF protection enabled
11
+ - [ ] Authentication/authorization verified
12
+ - [ ] Rate limiting on all endpoints
13
+ - [ ] Error messages don't leak sensitive data
14
+
15
+ ## Secret Management
16
+
17
+ - NEVER hardcode secrets in source code
18
+ - ALWAYS use environment variables or a secret manager
19
+ - Validate that required secrets are present at startup
20
+ - Rotate any secrets that may have been exposed
21
+
22
+ ## Security Response Protocol
23
+
24
+ If security issue found:
25
+ 1. STOP immediately
26
+ 2. Use **security-reviewer** agent
27
+ 3. Fix CRITICAL issues before continuing
28
+ 4. Rotate any exposed secrets
29
+ 5. Review entire codebase for similar issues
@@ -0,0 +1,29 @@
1
+ # Stack Detection
2
+
3
+ Đọc `CLAUDE.md` tại root, tìm section `## Tech Stack`, xác định các biến sau để dùng trong agent prompts và rule file lookups.
4
+
5
+ ## lang_agent — Backend
6
+
7
+ | Tech Stack chứa | 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 bổ sung:** nếu Tech Stack chứa `React` → thêm `typescript-reviewer` vào lang_agent (nếu chưa có).
14
+
15
+ ## infra_agent và db_agent — Tùy chọn
16
+
17
+ | Tech Stack chứa | Biến | Value |
18
+ |---|---|---|
19
+ | `AWS` (Infrastructure) | `infra_agent` | `aws-reviewer` |
20
+ | `MySQL` / `PostgreSQL` / `MSSQL` / `SQL Server` / `SQLite` | `db_agent` | `database-reviewer` |
21
+
22
+ ## Rules directory theo stack
23
+
24
+ | lang_agent | Rules directory |
25
+ |---|---|
26
+ | `csharp-reviewer` | `.claude/rules/csharp/` |
27
+ | `typescript-reviewer` | `.claude/rules/typescript/` |
28
+ | `python-reviewer` | `.claude/rules/python/` |
29
+ | Frontend / React | `.claude/rules/web/` |