codingbuddy-rules 4.5.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.ai-rules/adapters/antigravity.md +6 -6
- package/.ai-rules/adapters/claude-code.md +68 -4
- package/.ai-rules/adapters/codex.md +5 -5
- package/.ai-rules/adapters/cursor.md +2 -2
- package/.ai-rules/adapters/kiro.md +8 -8
- package/.ai-rules/adapters/opencode.md +7 -7
- package/.ai-rules/adapters/q.md +2 -2
- package/.ai-rules/agents/README.md +66 -16
- package/.ai-rules/agents/accessibility-specialist.json +2 -1
- package/.ai-rules/agents/act-mode.json +2 -1
- package/.ai-rules/agents/agent-architect.json +8 -7
- package/.ai-rules/agents/ai-ml-engineer.json +1 -0
- package/.ai-rules/agents/architecture-specialist.json +1 -0
- package/.ai-rules/agents/auto-mode.json +4 -2
- package/.ai-rules/agents/backend-developer.json +1 -0
- package/.ai-rules/agents/code-quality-specialist.json +1 -0
- package/.ai-rules/agents/code-reviewer.json +65 -64
- package/.ai-rules/agents/data-engineer.json +8 -7
- package/.ai-rules/agents/data-scientist.json +10 -9
- package/.ai-rules/agents/devops-engineer.json +1 -0
- package/.ai-rules/agents/documentation-specialist.json +1 -0
- package/.ai-rules/agents/eval-mode.json +20 -19
- package/.ai-rules/agents/event-architecture-specialist.json +1 -0
- package/.ai-rules/agents/frontend-developer.json +1 -0
- package/.ai-rules/agents/i18n-specialist.json +2 -1
- package/.ai-rules/agents/integration-specialist.json +1 -0
- package/.ai-rules/agents/migration-specialist.json +1 -0
- package/.ai-rules/agents/mobile-developer.json +8 -7
- package/.ai-rules/agents/observability-specialist.json +1 -0
- package/.ai-rules/agents/parallel-orchestrator.json +346 -0
- package/.ai-rules/agents/performance-specialist.json +1 -0
- package/.ai-rules/agents/plan-mode.json +3 -1
- package/.ai-rules/agents/plan-reviewer.json +208 -0
- package/.ai-rules/agents/platform-engineer.json +1 -0
- package/.ai-rules/agents/security-engineer.json +9 -8
- package/.ai-rules/agents/security-specialist.json +2 -1
- package/.ai-rules/agents/seo-specialist.json +1 -0
- package/.ai-rules/agents/software-engineer.json +1 -0
- package/.ai-rules/agents/solution-architect.json +11 -10
- package/.ai-rules/agents/systems-developer.json +9 -8
- package/.ai-rules/agents/technical-planner.json +11 -10
- package/.ai-rules/agents/test-engineer.json +7 -6
- package/.ai-rules/agents/test-strategy-specialist.json +1 -0
- package/.ai-rules/agents/tooling-engineer.json +4 -3
- package/.ai-rules/agents/ui-ux-designer.json +1 -0
- package/.ai-rules/keyword-modes.json +4 -4
- package/.ai-rules/rules/clarification-guide.md +14 -14
- package/.ai-rules/rules/core.md +73 -0
- package/.ai-rules/rules/parallel-execution.md +217 -0
- package/.ai-rules/skills/README.md +23 -1
- package/.ai-rules/skills/agent-design/SKILL.md +5 -0
- package/.ai-rules/skills/agent-design/examples/agent-template.json +58 -0
- package/.ai-rules/skills/agent-design/references/expertise-guidelines.md +112 -0
- package/.ai-rules/skills/agent-discussion/SKILL.md +199 -0
- package/.ai-rules/skills/agent-discussion-panel/SKILL.md +448 -0
- package/.ai-rules/skills/api-design/SKILL.md +5 -0
- package/.ai-rules/skills/api-design/examples/error-response.json +159 -0
- package/.ai-rules/skills/api-design/examples/openapi-template.yaml +393 -0
- package/.ai-rules/skills/build-fix/SKILL.md +234 -0
- package/.ai-rules/skills/code-explanation/SKILL.md +4 -0
- package/.ai-rules/skills/context-management/SKILL.md +1 -0
- package/.ai-rules/skills/cost-budget/SKILL.md +348 -0
- package/.ai-rules/skills/cross-repo-issues/SKILL.md +257 -0
- package/.ai-rules/skills/database-migration/SKILL.md +1 -0
- package/.ai-rules/skills/deepsearch/SKILL.md +214 -0
- package/.ai-rules/skills/deployment-checklist/SKILL.md +1 -0
- package/.ai-rules/skills/error-analysis/SKILL.md +1 -0
- package/.ai-rules/skills/finishing-a-development-branch/SKILL.md +281 -0
- package/.ai-rules/skills/frontend-design/SKILL.md +5 -0
- package/.ai-rules/skills/frontend-design/examples/component-template.tsx +203 -0
- package/.ai-rules/skills/frontend-design/references/css-patterns.md +243 -0
- package/.ai-rules/skills/git-master/SKILL.md +358 -0
- package/.ai-rules/skills/incident-response/SKILL.md +1 -0
- package/.ai-rules/skills/legacy-modernization/SKILL.md +1 -0
- package/.ai-rules/skills/mcp-builder/SKILL.md +7 -0
- package/.ai-rules/skills/mcp-builder/examples/resource-example.ts +233 -0
- package/.ai-rules/skills/mcp-builder/examples/tool-example.ts +203 -0
- package/.ai-rules/skills/mcp-builder/references/protocol-spec.md +215 -0
- package/.ai-rules/skills/performance-optimization/SKILL.md +3 -0
- package/.ai-rules/skills/plan-and-review/SKILL.md +115 -0
- package/.ai-rules/skills/pr-all-in-one/SKILL.md +15 -13
- package/.ai-rules/skills/pr-all-in-one/configuration-guide.md +7 -7
- package/.ai-rules/skills/pr-all-in-one/pr-templates.md +10 -10
- package/.ai-rules/skills/pr-review/SKILL.md +4 -0
- package/.ai-rules/skills/receiving-code-review/SKILL.md +347 -0
- package/.ai-rules/skills/refactoring/SKILL.md +1 -0
- package/.ai-rules/skills/requesting-code-review/SKILL.md +348 -0
- package/.ai-rules/skills/rule-authoring/SKILL.md +5 -0
- package/.ai-rules/skills/rule-authoring/examples/rule-template.md +142 -0
- package/.ai-rules/skills/rule-authoring/examples/trigger-patterns.md +126 -0
- package/.ai-rules/skills/security-audit/SKILL.md +4 -0
- package/.ai-rules/skills/skill-creator/SKILL.md +461 -0
- package/.ai-rules/skills/skill-creator/agents/analyzer.md +206 -0
- package/.ai-rules/skills/skill-creator/agents/comparator.md +167 -0
- package/.ai-rules/skills/skill-creator/agents/grader.md +152 -0
- package/.ai-rules/skills/skill-creator/assets/eval_review.html +289 -0
- package/.ai-rules/skills/skill-creator/assets/skill-template.md +43 -0
- package/.ai-rules/skills/skill-creator/eval-viewer/generate_review.py +496 -0
- package/.ai-rules/skills/skill-creator/references/frontmatter-guide.md +632 -0
- package/.ai-rules/skills/skill-creator/references/multi-tool-compat.md +480 -0
- package/.ai-rules/skills/skill-creator/references/schemas.md +784 -0
- package/.ai-rules/skills/skill-creator/scripts/aggregate_benchmark.py +302 -0
- package/.ai-rules/skills/skill-creator/scripts/init_skill.sh +196 -0
- package/.ai-rules/skills/skill-creator/scripts/run_loop.py +327 -0
- package/.ai-rules/skills/systematic-debugging/SKILL.md +1 -0
- package/.ai-rules/skills/tech-debt/SKILL.md +1 -0
- package/.ai-rules/skills/test-coverage-gate/SKILL.md +303 -0
- package/.ai-rules/skills/tmux-master/SKILL.md +491 -0
- package/.ai-rules/skills/using-git-worktrees/SKILL.md +368 -0
- package/.ai-rules/skills/verification-before-completion/SKILL.md +234 -0
- package/.ai-rules/skills/widget-slot-architecture/SKILL.md +6 -0
- package/.ai-rules/skills/widget-slot-architecture/examples/parallel-route-setup.tsx +206 -0
- package/.ai-rules/skills/widget-slot-architecture/examples/widget-component.tsx +250 -0
- package/.ai-rules/skills/writing-plans/SKILL.md +78 -0
- package/bin/cli.js +178 -0
- package/lib/init/detect-stack.js +148 -0
- package/lib/init/generate-config.js +31 -0
- package/lib/init/index.js +86 -0
- package/lib/init/prompt.js +60 -0
- package/lib/init/scaffold.js +67 -0
- package/lib/init/suggest-agent.js +46 -0
- package/package.json +10 -2
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: requesting-code-review
|
|
3
|
+
description: Use when preparing code for review before submitting PRs — covers pre-flight validation, change summary generation, test evidence collection, review focus areas, and structured review request formatting
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Requesting Code Review
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
Prepare your code for review before asking others to look at it. A well-prepared review request gets faster, higher-quality feedback and respects the reviewer's time.
|
|
12
|
+
|
|
13
|
+
**Core principle:** The author's job is to make the reviewer's job easy. Every minute you spend preparing saves ten minutes of back-and-forth.
|
|
14
|
+
|
|
15
|
+
**Violating the letter of this process is violating the spirit of code review.**
|
|
16
|
+
|
|
17
|
+
## When to Use
|
|
18
|
+
|
|
19
|
+
**Always use for:**
|
|
20
|
+
- New feature PRs
|
|
21
|
+
- Bug fix PRs
|
|
22
|
+
- Refactoring PRs
|
|
23
|
+
- Any PR touching security-sensitive code
|
|
24
|
+
- Any PR with breaking changes
|
|
25
|
+
|
|
26
|
+
**Lighter preparation acceptable for:**
|
|
27
|
+
- Documentation-only changes
|
|
28
|
+
- Configuration tweaks
|
|
29
|
+
- Single-line fixes with obvious intent
|
|
30
|
+
|
|
31
|
+
**Never skip:**
|
|
32
|
+
- Pre-Flight Checks (Phase 1) — takes 2 minutes, catches 80% of review round-trips
|
|
33
|
+
|
|
34
|
+
## The Iron Law
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
NO REVIEW REQUEST WITHOUT PASSING TESTS AND SELF-REVIEW
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
If tests fail, fix them. If you haven't read your own diff, read it. Requesting review on broken or unreviewed code wastes everyone's time.
|
|
41
|
+
|
|
42
|
+
## Quick Reference
|
|
43
|
+
|
|
44
|
+
| Phase | Purpose | Time |
|
|
45
|
+
|-------|---------|------|
|
|
46
|
+
| 1. Pre-Flight Checks | Validate code is review-ready | ~2 min |
|
|
47
|
+
| 2. Self-Review | Catch issues before the reviewer does | ~5-15 min |
|
|
48
|
+
| 3. Change Summary | Explain what, why, and impact | ~5 min |
|
|
49
|
+
| 4. Test Evidence | Prove it works | ~2 min |
|
|
50
|
+
| 5. Review Focus Areas | Guide the reviewer's attention | ~3 min |
|
|
51
|
+
| 6. Review Request Assembly | Format the PR description | ~5 min |
|
|
52
|
+
|
|
53
|
+
## Phase 1: Pre-Flight Checks
|
|
54
|
+
|
|
55
|
+
**Run before anything else. All must pass.**
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# Tests passing
|
|
59
|
+
npm test
|
|
60
|
+
# Expected: all green, zero failures
|
|
61
|
+
|
|
62
|
+
# TypeScript compilation
|
|
63
|
+
npx tsc --noEmit
|
|
64
|
+
# Expected: no errors
|
|
65
|
+
|
|
66
|
+
# Linting
|
|
67
|
+
npx eslint .
|
|
68
|
+
# Expected: no errors (warnings acceptable)
|
|
69
|
+
|
|
70
|
+
# Formatting
|
|
71
|
+
npx prettier --check .
|
|
72
|
+
# Expected: all files formatted
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Automated Check
|
|
76
|
+
|
|
77
|
+
If the project has a validate script, use it:
|
|
78
|
+
```bash
|
|
79
|
+
npm run validate
|
|
80
|
+
# Runs all checks in one command
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Diff Hygiene
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
# No TODO/FIXME in your changes
|
|
87
|
+
git diff --cached | grep -n "TODO\|FIXME\|HACK\|XXX"
|
|
88
|
+
# Expected: no matches (or documented exceptions)
|
|
89
|
+
|
|
90
|
+
# No unintended files
|
|
91
|
+
git diff --cached --name-only
|
|
92
|
+
# Review: every file should be intentional
|
|
93
|
+
|
|
94
|
+
# No debug artifacts
|
|
95
|
+
git diff --cached | grep -n "console\.log\|debugger\|\.only("
|
|
96
|
+
# Expected: no matches
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**If ANY check fails → fix before proceeding. No exceptions.**
|
|
100
|
+
|
|
101
|
+
## Phase 2: Self-Review
|
|
102
|
+
|
|
103
|
+
**Read your own diff as if you are the reviewer.**
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
# View the full diff
|
|
107
|
+
git diff main...HEAD
|
|
108
|
+
# Or for staged changes:
|
|
109
|
+
git diff --cached
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Self-Review Checklist
|
|
113
|
+
|
|
114
|
+
```
|
|
115
|
+
- [ ] Every changed file is intentional (no accidental modifications)
|
|
116
|
+
- [ ] Variable and function names are clear without context
|
|
117
|
+
- [ ] No hardcoded values that should be constants or config
|
|
118
|
+
- [ ] Error cases handled (not just happy path)
|
|
119
|
+
- [ ] Edge cases considered (null, empty, boundary values)
|
|
120
|
+
- [ ] No copy-pasted code that should be extracted
|
|
121
|
+
- [ ] Comments explain "why", not "what"
|
|
122
|
+
- [ ] No leftover debugging code
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Common Issues to Catch
|
|
126
|
+
|
|
127
|
+
| Issue | Detection | Fix |
|
|
128
|
+
|-------|-----------|-----|
|
|
129
|
+
| Forgotten console.log | `grep -rn "console.log" src/` | Remove or replace with proper logging |
|
|
130
|
+
| Hardcoded secrets | `grep -rn "password\|secret\|token\|apiKey" src/` | Move to environment variables |
|
|
131
|
+
| Missing error handling | Look for unhandled promises, bare try/catch | Add specific error handling |
|
|
132
|
+
| Overly large diff | `git diff --stat` shows 500+ lines | Split into smaller PRs |
|
|
133
|
+
|
|
134
|
+
## Phase 3: Change Summary Generation
|
|
135
|
+
|
|
136
|
+
**Answer three questions:**
|
|
137
|
+
|
|
138
|
+
### 1. What Changed?
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
# File-level summary
|
|
142
|
+
git diff main...HEAD --stat
|
|
143
|
+
|
|
144
|
+
# Logical grouping of changes
|
|
145
|
+
git log main..HEAD --oneline
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Categorize changes:
|
|
149
|
+
- **Added:** New files, functions, components, tests
|
|
150
|
+
- **Modified:** Changed behavior, updated logic, fixed bugs
|
|
151
|
+
- **Removed:** Deleted code, deprecated features
|
|
152
|
+
- **Refactored:** Structural changes without behavior change
|
|
153
|
+
|
|
154
|
+
### 2. Why Did It Change?
|
|
155
|
+
|
|
156
|
+
Link to the motivation:
|
|
157
|
+
- Issue/ticket reference (e.g., "Closes #123")
|
|
158
|
+
- Problem statement (what was broken or missing)
|
|
159
|
+
- Business context (why this matters now)
|
|
160
|
+
|
|
161
|
+
### 3. What Could Break?
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
# Find direct dependents of changed files
|
|
165
|
+
git diff main...HEAD --name-only | while read file; do
|
|
166
|
+
echo "=== $file ==="
|
|
167
|
+
grep -rn "from.*$(basename $file .ts)" src/ --include="*.ts" | head -5
|
|
168
|
+
done
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Assess impact radius:
|
|
172
|
+
- **Direct:** Files importing your changed modules
|
|
173
|
+
- **Indirect:** Consumers of your module's public API
|
|
174
|
+
- **External:** API contracts, database schemas, config formats
|
|
175
|
+
|
|
176
|
+
## Phase 4: Test Evidence
|
|
177
|
+
|
|
178
|
+
**Show, don't tell. Include actual output.**
|
|
179
|
+
|
|
180
|
+
### Test Results
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
# Run tests with verbose output
|
|
184
|
+
npm test -- --reporter=verbose 2>&1 | tail -20
|
|
185
|
+
|
|
186
|
+
# Example output to include:
|
|
187
|
+
# ✓ should create user with valid email (3ms)
|
|
188
|
+
# ✓ should reject duplicate email (2ms)
|
|
189
|
+
# ✓ should handle network timeout (15ms)
|
|
190
|
+
# Tests: 47 passed, 0 failed
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Coverage Delta
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
# Generate coverage report
|
|
197
|
+
npm run test:coverage 2>&1 | grep -A 5 "Coverage summary"
|
|
198
|
+
|
|
199
|
+
# Example output:
|
|
200
|
+
# Statements : 92.3% (+1.2%)
|
|
201
|
+
# Branches : 87.5% (+3.0%)
|
|
202
|
+
# Functions : 95.0% (+0.5%)
|
|
203
|
+
# Lines : 91.8% (+1.1%)
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
If coverage decreased, explain why:
|
|
207
|
+
- Removed well-tested dead code
|
|
208
|
+
- Added error handling paths not yet fully tested
|
|
209
|
+
- New feature has planned follow-up test PR
|
|
210
|
+
|
|
211
|
+
### New Tests Written
|
|
212
|
+
|
|
213
|
+
List new test cases with descriptions:
|
|
214
|
+
```
|
|
215
|
+
New tests:
|
|
216
|
+
- "should validate email format before creating user"
|
|
217
|
+
- "should return 409 when email already exists"
|
|
218
|
+
- "should retry on transient network failure"
|
|
219
|
+
- "should timeout after 5 seconds"
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## Phase 5: Review Focus Areas
|
|
223
|
+
|
|
224
|
+
**Guide the reviewer to what matters most.**
|
|
225
|
+
|
|
226
|
+
### Highlight Categories
|
|
227
|
+
|
|
228
|
+
| Category | What to Flag | Example |
|
|
229
|
+
|----------|-------------|---------|
|
|
230
|
+
| **Complex logic** | Algorithms, state machines, tricky conditions | "The retry logic in `fetchWithBackoff` handles 5 failure modes" |
|
|
231
|
+
| **Security-sensitive** | Auth, input validation, data exposure | "New endpoint requires auth — please verify middleware chain" |
|
|
232
|
+
| **Breaking changes** | API changes, schema migrations, config changes | "Response format changed from array to paginated object" |
|
|
233
|
+
| **Uncertainty** | Code you're not confident about | "Not sure if this caching strategy handles concurrent writes correctly" |
|
|
234
|
+
| **Trade-offs** | Deliberate compromises | "Chose N+1 query for readability; volume is < 100 items" |
|
|
235
|
+
|
|
236
|
+
### Format
|
|
237
|
+
|
|
238
|
+
```markdown
|
|
239
|
+
### Review Focus Areas
|
|
240
|
+
|
|
241
|
+
1. **[Complex]** `src/services/retry.ts:25-60` — Exponential backoff
|
|
242
|
+
with jitter. Please verify the max delay calculation.
|
|
243
|
+
|
|
244
|
+
2. **[Security]** `src/middleware/auth.ts:15` — Added rate limiting.
|
|
245
|
+
Check if the window size is appropriate.
|
|
246
|
+
|
|
247
|
+
3. **[Breaking]** `src/api/users.ts:42` — Changed response from
|
|
248
|
+
`User[]` to `{ data: User[], pagination: Pagination }`.
|
|
249
|
+
All consumers need to update.
|
|
250
|
+
|
|
251
|
+
4. **[Uncertain]** `src/cache/store.ts:78` — Cache invalidation
|
|
252
|
+
on concurrent writes. Would appreciate a second opinion.
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
## Phase 6: Review Request Assembly
|
|
256
|
+
|
|
257
|
+
**Combine all phases into a structured PR description.**
|
|
258
|
+
|
|
259
|
+
### PR Description Template
|
|
260
|
+
|
|
261
|
+
```markdown
|
|
262
|
+
## Summary
|
|
263
|
+
|
|
264
|
+
[1-3 sentences: what this PR does and why]
|
|
265
|
+
|
|
266
|
+
Closes #[issue-number]
|
|
267
|
+
|
|
268
|
+
## Changes
|
|
269
|
+
|
|
270
|
+
- [Categorized list from Phase 3]
|
|
271
|
+
|
|
272
|
+
## Test Evidence
|
|
273
|
+
|
|
274
|
+
- All tests passing: [X] passed, 0 failed
|
|
275
|
+
- Coverage: [X]% (+/-Y%)
|
|
276
|
+
- New tests: [count] added
|
|
277
|
+
|
|
278
|
+
## Review Focus Areas
|
|
279
|
+
|
|
280
|
+
1. **[Category]** `file:line` — [Description]
|
|
281
|
+
2. **[Category]** `file:line` — [Description]
|
|
282
|
+
|
|
283
|
+
## Impact
|
|
284
|
+
|
|
285
|
+
- **Breaking changes:** [Yes/No — details if yes]
|
|
286
|
+
- **Dependencies affected:** [list or "none"]
|
|
287
|
+
- **Migration needed:** [Yes/No — steps if yes]
|
|
288
|
+
|
|
289
|
+
## Checklist
|
|
290
|
+
|
|
291
|
+
- [ ] Tests passing
|
|
292
|
+
- [ ] Lint clean
|
|
293
|
+
- [ ] No TODO/FIXME in diff
|
|
294
|
+
- [ ] Self-reviewed
|
|
295
|
+
- [ ] Documentation updated (if needed)
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### PR Title Convention
|
|
299
|
+
|
|
300
|
+
```
|
|
301
|
+
<type>(<scope>): <description>
|
|
302
|
+
|
|
303
|
+
Examples:
|
|
304
|
+
feat(auth): add JWT refresh token rotation
|
|
305
|
+
fix(api): handle timeout in user creation endpoint
|
|
306
|
+
refactor(db): extract query builder from repository
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
## Verification Checklist
|
|
310
|
+
|
|
311
|
+
Before submitting the review request:
|
|
312
|
+
|
|
313
|
+
```
|
|
314
|
+
- [ ] All pre-flight checks passing (Phase 1)
|
|
315
|
+
- [ ] Self-review completed, no issues found (Phase 2)
|
|
316
|
+
- [ ] Change summary includes what, why, and impact (Phase 3)
|
|
317
|
+
- [ ] Test evidence shows actual output, not "tests pass" (Phase 4)
|
|
318
|
+
- [ ] At least one review focus area identified (Phase 5)
|
|
319
|
+
- [ ] PR description follows template (Phase 6)
|
|
320
|
+
- [ ] PR title follows convention
|
|
321
|
+
- [ ] No TODO/FIXME in diff
|
|
322
|
+
- [ ] No debug artifacts in diff
|
|
323
|
+
- [ ] Branch is up-to-date with base
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
**Cannot check all boxes? Do not submit the review request.**
|
|
327
|
+
|
|
328
|
+
## Red Flags — STOP
|
|
329
|
+
|
|
330
|
+
| Thought | Reality |
|
|
331
|
+
|---------|---------|
|
|
332
|
+
| "Tests are probably passing" | Run them. "Probably" is not evidence. |
|
|
333
|
+
| "The diff is small, no need to self-review" | Small diffs cause big bugs. 2 minutes to check. |
|
|
334
|
+
| "I'll add test evidence later" | Reviewers need it NOW to evaluate correctness. |
|
|
335
|
+
| "The reviewer will figure out what changed" | That's YOUR job. Respect their time. |
|
|
336
|
+
| "No breaking changes... I think" | Check consumers. "I think" is not analysis. |
|
|
337
|
+
| "I'll just describe what I did" | Describe WHY, not just WHAT. |
|
|
338
|
+
| "This is urgent, skip preparation" | Urgency increases risk. Preparation prevents rework. |
|
|
339
|
+
| "The PR is too big to summarize" | Split it. If you can't summarize it, reviewers can't review it. |
|
|
340
|
+
|
|
341
|
+
## Related Skills
|
|
342
|
+
|
|
343
|
+
| Skill | Relationship |
|
|
344
|
+
|-------|-------------|
|
|
345
|
+
| `pr-review` | Complement — pr-review is for CONDUCTING reviews; this skill is for REQUESTING them |
|
|
346
|
+
| `deployment-checklist` | Sequential — deploy after review approval |
|
|
347
|
+
| `test-driven-development` | Supporting — TDD produces the test evidence this skill requires |
|
|
348
|
+
| `security-audit` | Supporting — security audit informs review focus areas |
|
|
@@ -271,3 +271,8 @@ NEVER / MUST NOT → Prohibited
|
|
|
271
271
|
| "The existing rule covers this" | Check carefully — overlap causes conflicts |
|
|
272
272
|
| "Rules don't need testing" | Test with each target AI tool |
|
|
273
273
|
| "Abstract rules are more flexible" | Abstract rules are ignored or misapplied |
|
|
274
|
+
|
|
275
|
+
## Additional resources
|
|
276
|
+
|
|
277
|
+
- [Rule template](examples/rule-template.md) — Copy-and-adapt template with filled example and pre-commit checklist
|
|
278
|
+
- [Trigger patterns](examples/trigger-patterns.md) — Catalog of clear trigger patterns, ambiguity antipatterns, and strength vocabulary
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# Rule Template
|
|
2
|
+
|
|
3
|
+
Copy this template when writing new AI coding rules for `.ai-rules/rules/`.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Rule File Template
|
|
8
|
+
|
|
9
|
+
```markdown
|
|
10
|
+
# <Category Name>
|
|
11
|
+
|
|
12
|
+
<Brief description of what rules in this file govern and why they matter.>
|
|
13
|
+
|
|
14
|
+
## Rules
|
|
15
|
+
|
|
16
|
+
### <Rule Name>
|
|
17
|
+
|
|
18
|
+
**When:** <Specific trigger condition — when does this rule activate?>
|
|
19
|
+
|
|
20
|
+
**Do:** <Concrete action in imperative mood. One sentence.>
|
|
21
|
+
|
|
22
|
+
**Don't:** <Specific anti-pattern to avoid. One sentence.>
|
|
23
|
+
|
|
24
|
+
**Check:** <How to verify the rule was followed — must be testable.>
|
|
25
|
+
|
|
26
|
+
**Example:**
|
|
27
|
+
|
|
28
|
+
\`\`\`typescript
|
|
29
|
+
// Good
|
|
30
|
+
<correct code example>
|
|
31
|
+
|
|
32
|
+
// Bad
|
|
33
|
+
<incorrect code example>
|
|
34
|
+
\`\`\`
|
|
35
|
+
|
|
36
|
+
**Why:** <One-sentence rationale linking to a real consequence.>
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
### <Next Rule Name>
|
|
41
|
+
|
|
42
|
+
...
|
|
43
|
+
|
|
44
|
+
## Rationale
|
|
45
|
+
|
|
46
|
+
<Why these rules exist for this project. Link to incidents, standards, or team decisions.>
|
|
47
|
+
|
|
48
|
+
## Exceptions
|
|
49
|
+
|
|
50
|
+
<Cases where these rules do not apply. Keep this list short — fewer exceptions = less ambiguity.>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Filled Example
|
|
56
|
+
|
|
57
|
+
```markdown
|
|
58
|
+
# TypeScript Strictness
|
|
59
|
+
|
|
60
|
+
Rules for maintaining type safety across the codebase.
|
|
61
|
+
|
|
62
|
+
## Rules
|
|
63
|
+
|
|
64
|
+
### No `any` Type
|
|
65
|
+
|
|
66
|
+
**When:** Writing or modifying TypeScript code.
|
|
67
|
+
|
|
68
|
+
**Do:** Use explicit types for all function parameters and return values. Use `unknown` for truly unknown types, then narrow with type guards.
|
|
69
|
+
|
|
70
|
+
**Don't:** Use `any` — it disables the compiler's ability to catch errors.
|
|
71
|
+
|
|
72
|
+
**Check:** `npx tsc --noEmit` passes with `noImplicitAny: true` in tsconfig.json.
|
|
73
|
+
|
|
74
|
+
**Example:**
|
|
75
|
+
|
|
76
|
+
\`\`\`typescript
|
|
77
|
+
// Good
|
|
78
|
+
function parseInput(raw: unknown): ParsedData {
|
|
79
|
+
if (typeof raw !== 'string') throw new TypeError('Expected string');
|
|
80
|
+
return JSON.parse(raw) as ParsedData;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Bad
|
|
84
|
+
function parseInput(raw: any): any {
|
|
85
|
+
return JSON.parse(raw);
|
|
86
|
+
}
|
|
87
|
+
\`\`\`
|
|
88
|
+
|
|
89
|
+
**Why:** `any` silently propagates through the type system and causes runtime errors that the compiler should have caught.
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
### Explicit Return Types on Exported Functions
|
|
94
|
+
|
|
95
|
+
**When:** Defining a function that is exported from a module.
|
|
96
|
+
|
|
97
|
+
**Do:** Annotate the return type explicitly.
|
|
98
|
+
|
|
99
|
+
**Don't:** Rely on type inference for public API boundaries.
|
|
100
|
+
|
|
101
|
+
**Check:** ESLint rule `@typescript-eslint/explicit-function-return-type` on exported functions.
|
|
102
|
+
|
|
103
|
+
**Example:**
|
|
104
|
+
|
|
105
|
+
\`\`\`typescript
|
|
106
|
+
// Good
|
|
107
|
+
export function calculateTotal(items: LineItem[]): number {
|
|
108
|
+
return items.reduce((sum, item) => sum + item.price, 0);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Bad
|
|
112
|
+
export function calculateTotal(items: LineItem[]) {
|
|
113
|
+
return items.reduce((sum, item) => sum + item.price, 0);
|
|
114
|
+
}
|
|
115
|
+
\`\`\`
|
|
116
|
+
|
|
117
|
+
**Why:** Explicit return types act as documentation and prevent accidental API changes when internal implementation changes.
|
|
118
|
+
|
|
119
|
+
## Rationale
|
|
120
|
+
|
|
121
|
+
TypeScript strict mode catches ~40% of bugs at compile time. These rules ensure we get the full benefit of the type system.
|
|
122
|
+
|
|
123
|
+
## Exceptions
|
|
124
|
+
|
|
125
|
+
- Test files (`.test.ts`, `.spec.ts`) may use `as` casting for test fixtures.
|
|
126
|
+
- Third-party library type augmentation files may require `any` in `.d.ts` declarations.
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Checklist Before Committing a New Rule
|
|
132
|
+
|
|
133
|
+
```
|
|
134
|
+
- [ ] "When" trigger is specific (not "always" or "when appropriate")
|
|
135
|
+
- [ ] "Do" action is imperative and unambiguous
|
|
136
|
+
- [ ] "Don't" anti-pattern is concrete
|
|
137
|
+
- [ ] "Check" criterion is automatable or clearly verifiable
|
|
138
|
+
- [ ] Example shows both correct and incorrect code
|
|
139
|
+
- [ ] "Why" links to a real consequence (not "best practice")
|
|
140
|
+
- [ ] Rule doesn't duplicate an existing rule
|
|
141
|
+
- [ ] Rule works with all target AI tools (Claude, Cursor, Copilot, Q, Kiro)
|
|
142
|
+
```
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# Rule Trigger Patterns
|
|
2
|
+
|
|
3
|
+
Patterns for writing clear, unambiguous trigger conditions in AI coding rules. A trigger defines **when** a rule activates — ambiguous triggers cause inconsistent AI behavior.
|
|
4
|
+
|
|
5
|
+
## Trigger Anatomy
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
**When:** <scope> + <condition> + <qualifier (optional)>
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
| Part | Purpose | Example |
|
|
12
|
+
|------|---------|---------|
|
|
13
|
+
| Scope | What code area | "In TypeScript files" |
|
|
14
|
+
| Condition | What is happening | "writing a new function" |
|
|
15
|
+
| Qualifier | Narrows further | "that is exported" |
|
|
16
|
+
|
|
17
|
+
## Pattern Catalog
|
|
18
|
+
|
|
19
|
+
### File-Scoped Triggers
|
|
20
|
+
|
|
21
|
+
```markdown
|
|
22
|
+
**When:** Creating or modifying a TypeScript file (.ts, .tsx)
|
|
23
|
+
**When:** Adding a new test file
|
|
24
|
+
**When:** Editing files in the `src/api/` directory
|
|
25
|
+
**When:** Working with migration files (`*.migration.ts`)
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Action-Scoped Triggers
|
|
29
|
+
|
|
30
|
+
```markdown
|
|
31
|
+
**When:** Writing a new function or method
|
|
32
|
+
**When:** Adding a dependency to package.json
|
|
33
|
+
**When:** Creating a new React component
|
|
34
|
+
**When:** Defining an API endpoint
|
|
35
|
+
**When:** Writing a database query
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Context-Scoped Triggers
|
|
39
|
+
|
|
40
|
+
```markdown
|
|
41
|
+
**When:** Implementing a feature that handles user input
|
|
42
|
+
**When:** Adding authentication or authorization logic
|
|
43
|
+
**When:** Modifying shared utility code used by 3+ modules
|
|
44
|
+
**When:** Changing code that runs in a CI/CD pipeline
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Negation Triggers (When NOT to Apply)
|
|
48
|
+
|
|
49
|
+
```markdown
|
|
50
|
+
**When:** NOT applicable:
|
|
51
|
+
- Prototype or spike code (marked with `// SPIKE:`)
|
|
52
|
+
- Generated code (auto-generated files)
|
|
53
|
+
- Third-party type definitions (`.d.ts`)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Ambiguity Antipatterns
|
|
57
|
+
|
|
58
|
+
| Ambiguous Trigger | Problem | Fixed Trigger |
|
|
59
|
+
|-------------------|---------|---------------|
|
|
60
|
+
| "When appropriate" | Who decides? | "When the function has > 3 parameters" |
|
|
61
|
+
| "When necessary" | Always unclear | "When the module is imported by 2+ files" |
|
|
62
|
+
| "When writing code" | Too broad | "When writing exported functions" |
|
|
63
|
+
| "When dealing with errors" | Vague scope | "When implementing catch blocks in async functions" |
|
|
64
|
+
| "When it makes sense" | Subjective | "When the function performs I/O operations" |
|
|
65
|
+
| "In complex scenarios" | Undefined threshold | "When cyclomatic complexity exceeds 10" |
|
|
66
|
+
|
|
67
|
+
## Combining Triggers
|
|
68
|
+
|
|
69
|
+
### AND (all conditions must be true)
|
|
70
|
+
|
|
71
|
+
```markdown
|
|
72
|
+
**When:** Writing a new API endpoint AND the endpoint accepts user input
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### OR (any condition activates)
|
|
76
|
+
|
|
77
|
+
```markdown
|
|
78
|
+
**When:** Creating a new module OR modifying a module's public API (exported types/functions)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Conditional (if-then)
|
|
82
|
+
|
|
83
|
+
```markdown
|
|
84
|
+
**When:** Adding a new dependency
|
|
85
|
+
- IF the dependency has no TypeScript types → also add `@types/<pkg>`
|
|
86
|
+
- IF the dependency is > 50KB → document the size justification
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Trigger Strength Vocabulary
|
|
90
|
+
|
|
91
|
+
| Keyword | Strength | Meaning |
|
|
92
|
+
|---------|----------|---------|
|
|
93
|
+
| ALWAYS / MUST | Mandatory | No exceptions — rule fires every time |
|
|
94
|
+
| SHOULD / PREFER | Default | Rule fires unless there's a documented reason not to |
|
|
95
|
+
| CONSIDER / MAY | Advisory | Rule is a suggestion, not a requirement |
|
|
96
|
+
| NEVER / MUST NOT | Prohibition | Rule prevents an action unconditionally |
|
|
97
|
+
|
|
98
|
+
### Using Strength in Context
|
|
99
|
+
|
|
100
|
+
```markdown
|
|
101
|
+
### Input Validation
|
|
102
|
+
|
|
103
|
+
**When:** Writing a function that accepts external input (API request, form data, URL params)
|
|
104
|
+
|
|
105
|
+
**Do:** ALWAYS validate and sanitize input before processing.
|
|
106
|
+
|
|
107
|
+
**When:** Writing internal utility functions called only by trusted code
|
|
108
|
+
|
|
109
|
+
**Do:** CONSIDER adding input validation for defense-in-depth.
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Testing Your Triggers
|
|
113
|
+
|
|
114
|
+
For each trigger, ask:
|
|
115
|
+
|
|
116
|
+
1. **Can I give 3 concrete examples where this trigger fires?**
|
|
117
|
+
- If not, the trigger is too vague.
|
|
118
|
+
|
|
119
|
+
2. **Can I give 3 concrete examples where this trigger does NOT fire?**
|
|
120
|
+
- If not, the trigger is too broad.
|
|
121
|
+
|
|
122
|
+
3. **Would two different AI tools interpret this the same way?**
|
|
123
|
+
- If not, add more specificity.
|
|
124
|
+
|
|
125
|
+
4. **Is the trigger observable from the code?**
|
|
126
|
+
- Triggers based on intent ("when optimizing") are weaker than triggers based on observable state ("when the file contains a database query").
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: security-audit
|
|
3
3
|
description: Use when reviewing code for security vulnerabilities, before shipping features, or conducting security assessments. Covers OWASP Top 10, secrets exposure, authentication, and authorization flaws.
|
|
4
|
+
context: fork
|
|
5
|
+
agent: general-purpose
|
|
6
|
+
allowed-tools: Read, Grep, Glob, Bash(git:*)
|
|
7
|
+
argument-hint: [scope-or-path]
|
|
4
8
|
---
|
|
5
9
|
|
|
6
10
|
# Security Audit
|