codingbuddy-rules 4.5.0 → 5.1.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 (129) hide show
  1. package/.ai-rules/adapters/aider.md +374 -0
  2. package/.ai-rules/adapters/antigravity.md +6 -6
  3. package/.ai-rules/adapters/claude-code.md +68 -4
  4. package/.ai-rules/adapters/codex.md +5 -5
  5. package/.ai-rules/adapters/cursor.md +2 -2
  6. package/.ai-rules/adapters/kiro.md +8 -8
  7. package/.ai-rules/adapters/opencode.md +7 -7
  8. package/.ai-rules/adapters/q.md +2 -2
  9. package/.ai-rules/adapters/windsurf.md +395 -0
  10. package/.ai-rules/agents/README.md +66 -16
  11. package/.ai-rules/agents/accessibility-specialist.json +8 -1
  12. package/.ai-rules/agents/act-mode.json +8 -1
  13. package/.ai-rules/agents/agent-architect.json +14 -7
  14. package/.ai-rules/agents/ai-ml-engineer.json +7 -0
  15. package/.ai-rules/agents/architecture-specialist.json +7 -0
  16. package/.ai-rules/agents/auto-mode.json +10 -2
  17. package/.ai-rules/agents/backend-developer.json +7 -0
  18. package/.ai-rules/agents/code-quality-specialist.json +7 -0
  19. package/.ai-rules/agents/code-reviewer.json +86 -64
  20. package/.ai-rules/agents/data-engineer.json +14 -7
  21. package/.ai-rules/agents/data-scientist.json +16 -9
  22. package/.ai-rules/agents/devops-engineer.json +7 -0
  23. package/.ai-rules/agents/documentation-specialist.json +7 -0
  24. package/.ai-rules/agents/eval-mode.json +30 -19
  25. package/.ai-rules/agents/event-architecture-specialist.json +7 -0
  26. package/.ai-rules/agents/frontend-developer.json +7 -0
  27. package/.ai-rules/agents/i18n-specialist.json +8 -1
  28. package/.ai-rules/agents/integration-specialist.json +7 -0
  29. package/.ai-rules/agents/migration-specialist.json +7 -0
  30. package/.ai-rules/agents/mobile-developer.json +8 -10
  31. package/.ai-rules/agents/observability-specialist.json +7 -0
  32. package/.ai-rules/agents/parallel-orchestrator.json +352 -0
  33. package/.ai-rules/agents/performance-specialist.json +7 -0
  34. package/.ai-rules/agents/plan-mode.json +9 -1
  35. package/.ai-rules/agents/plan-reviewer.json +211 -0
  36. package/.ai-rules/agents/platform-engineer.json +7 -0
  37. package/.ai-rules/agents/security-engineer.json +15 -8
  38. package/.ai-rules/agents/security-specialist.json +8 -1
  39. package/.ai-rules/agents/seo-specialist.json +7 -0
  40. package/.ai-rules/agents/software-engineer.json +7 -0
  41. package/.ai-rules/agents/solution-architect.json +17 -10
  42. package/.ai-rules/agents/systems-developer.json +15 -8
  43. package/.ai-rules/agents/technical-planner.json +17 -10
  44. package/.ai-rules/agents/test-engineer.json +13 -6
  45. package/.ai-rules/agents/test-strategy-specialist.json +7 -0
  46. package/.ai-rules/agents/tooling-engineer.json +10 -3
  47. package/.ai-rules/agents/ui-ux-designer.json +7 -0
  48. package/.ai-rules/keyword-modes.json +4 -4
  49. package/.ai-rules/rules/clarification-guide.md +14 -14
  50. package/.ai-rules/rules/core.md +73 -0
  51. package/.ai-rules/rules/parallel-execution.md +217 -0
  52. package/.ai-rules/schemas/agent.schema.json +38 -0
  53. package/.ai-rules/skills/README.md +29 -1
  54. package/.ai-rules/skills/agent-design/SKILL.md +5 -0
  55. package/.ai-rules/skills/agent-design/examples/agent-template.json +55 -0
  56. package/.ai-rules/skills/agent-design/references/expertise-guidelines.md +112 -0
  57. package/.ai-rules/skills/agent-discussion/SKILL.md +199 -0
  58. package/.ai-rules/skills/agent-discussion-panel/SKILL.md +448 -0
  59. package/.ai-rules/skills/api-design/SKILL.md +5 -0
  60. package/.ai-rules/skills/api-design/examples/error-response.json +159 -0
  61. package/.ai-rules/skills/api-design/examples/openapi-template.yaml +393 -0
  62. package/.ai-rules/skills/build-fix/SKILL.md +234 -0
  63. package/.ai-rules/skills/code-explanation/SKILL.md +4 -0
  64. package/.ai-rules/skills/context-management/SKILL.md +1 -0
  65. package/.ai-rules/skills/cost-budget/SKILL.md +348 -0
  66. package/.ai-rules/skills/cross-repo-issues/SKILL.md +257 -0
  67. package/.ai-rules/skills/database-migration/SKILL.md +1 -0
  68. package/.ai-rules/skills/deepsearch/SKILL.md +214 -0
  69. package/.ai-rules/skills/deployment-checklist/SKILL.md +1 -0
  70. package/.ai-rules/skills/error-analysis/SKILL.md +1 -0
  71. package/.ai-rules/skills/finishing-a-development-branch/SKILL.md +281 -0
  72. package/.ai-rules/skills/frontend-design/SKILL.md +5 -0
  73. package/.ai-rules/skills/frontend-design/examples/component-template.tsx +203 -0
  74. package/.ai-rules/skills/frontend-design/references/css-patterns.md +243 -0
  75. package/.ai-rules/skills/git-master/SKILL.md +358 -0
  76. package/.ai-rules/skills/incident-response/SKILL.md +1 -0
  77. package/.ai-rules/skills/legacy-modernization/SKILL.md +1 -0
  78. package/.ai-rules/skills/mcp-builder/SKILL.md +7 -0
  79. package/.ai-rules/skills/mcp-builder/examples/resource-example.ts +233 -0
  80. package/.ai-rules/skills/mcp-builder/examples/tool-example.ts +198 -0
  81. package/.ai-rules/skills/mcp-builder/references/protocol-spec.md +215 -0
  82. package/.ai-rules/skills/onboard/SKILL.md +150 -0
  83. package/.ai-rules/skills/performance-optimization/SKILL.md +3 -0
  84. package/.ai-rules/skills/plan-and-review/SKILL.md +115 -0
  85. package/.ai-rules/skills/plan-to-issues/SKILL.md +318 -0
  86. package/.ai-rules/skills/pr-all-in-one/SKILL.md +15 -13
  87. package/.ai-rules/skills/pr-all-in-one/configuration-guide.md +7 -7
  88. package/.ai-rules/skills/pr-all-in-one/pr-templates.md +10 -10
  89. package/.ai-rules/skills/pr-review/SKILL.md +4 -0
  90. package/.ai-rules/skills/receiving-code-review/SKILL.md +347 -0
  91. package/.ai-rules/skills/refactoring/SKILL.md +1 -0
  92. package/.ai-rules/skills/requesting-code-review/SKILL.md +348 -0
  93. package/.ai-rules/skills/retrospective/SKILL.md +192 -0
  94. package/.ai-rules/skills/rule-authoring/SKILL.md +5 -0
  95. package/.ai-rules/skills/rule-authoring/examples/rule-template.md +142 -0
  96. package/.ai-rules/skills/rule-authoring/examples/trigger-patterns.md +126 -0
  97. package/.ai-rules/skills/security-audit/SKILL.md +4 -0
  98. package/.ai-rules/skills/ship/SKILL.md +242 -0
  99. package/.ai-rules/skills/skill-creator/SKILL.md +461 -0
  100. package/.ai-rules/skills/skill-creator/agents/analyzer.md +206 -0
  101. package/.ai-rules/skills/skill-creator/agents/comparator.md +167 -0
  102. package/.ai-rules/skills/skill-creator/agents/grader.md +152 -0
  103. package/.ai-rules/skills/skill-creator/assets/eval_review.html +568 -0
  104. package/.ai-rules/skills/skill-creator/assets/skill-template.md +43 -0
  105. package/.ai-rules/skills/skill-creator/eval-viewer/generate_review.py +496 -0
  106. package/.ai-rules/skills/skill-creator/references/frontmatter-guide.md +632 -0
  107. package/.ai-rules/skills/skill-creator/references/multi-tool-compat.md +480 -0
  108. package/.ai-rules/skills/skill-creator/references/schemas.md +784 -0
  109. package/.ai-rules/skills/skill-creator/scripts/aggregate_benchmark.py +302 -0
  110. package/.ai-rules/skills/skill-creator/scripts/init_skill.sh +196 -0
  111. package/.ai-rules/skills/skill-creator/scripts/run_loop.py +327 -0
  112. package/.ai-rules/skills/systematic-debugging/SKILL.md +1 -0
  113. package/.ai-rules/skills/tech-debt/SKILL.md +1 -0
  114. package/.ai-rules/skills/test-coverage-gate/SKILL.md +303 -0
  115. package/.ai-rules/skills/tmux-master/SKILL.md +491 -0
  116. package/.ai-rules/skills/using-git-worktrees/SKILL.md +368 -0
  117. package/.ai-rules/skills/verification-before-completion/SKILL.md +234 -0
  118. package/.ai-rules/skills/widget-slot-architecture/SKILL.md +6 -0
  119. package/.ai-rules/skills/widget-slot-architecture/examples/parallel-route-setup.tsx +206 -0
  120. package/.ai-rules/skills/widget-slot-architecture/examples/widget-component.tsx +250 -0
  121. package/.ai-rules/skills/writing-plans/SKILL.md +78 -0
  122. package/bin/cli.js +170 -0
  123. package/lib/init/detect-stack.js +162 -0
  124. package/lib/init/generate-config.js +31 -0
  125. package/lib/init/index.js +86 -0
  126. package/lib/init/prompt.js +60 -0
  127. package/lib/init/scaffold.js +67 -0
  128. package/lib/init/suggest-agent.js +57 -0
  129. 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 |
@@ -0,0 +1,192 @@
1
+ ---
2
+ name: retrospective
3
+ description: "Analyze recent session context archives to identify coding patterns, agent usage, TDD cycle stats, and common EVAL issues. Generates a summary report with data-driven improvement suggestions."
4
+ ---
5
+
6
+ # Session Retrospective
7
+
8
+ ## Overview
9
+
10
+ Analyze accumulated PLAN/ACT/EVAL session data from context archives to surface coding habits, recurring patterns, and actionable improvement suggestions. Transforms passive session history into data-driven growth insights.
11
+
12
+ **Core principle:** Decisions improve when informed by patterns, not just memory. Review what actually happened, not what you think happened.
13
+
14
+ ## When to Use
15
+
16
+ - After completing a sprint or milestone
17
+ - During periodic team/personal retrospectives
18
+ - When noticing repeated issues across sessions
19
+ - Before planning process improvements
20
+ - When onboarding to understand team patterns
21
+
22
+ ## When NOT to Use
23
+
24
+ - Mid-session (wait until a natural checkpoint)
25
+ - With fewer than 3 archived sessions (insufficient data)
26
+ - For real-time debugging (use `systematic-debugging` instead)
27
+
28
+ ## Prerequisites
29
+
30
+ - Context archive system enabled (#999)
31
+ - At least 3 archived sessions in `docs/codingbuddy/archive/`
32
+ - MCP tools available: `get_context_history`, `search_context_archives`
33
+
34
+ ## Process
35
+
36
+ ### Phase 1: Data Collection
37
+
38
+ Gather session archives and extract structured data.
39
+
40
+ 1. **Retrieve recent archives**
41
+ - Call `get_context_history` with appropriate limit (default: 20)
42
+ - If no archives exist, inform user and suggest running a few PLAN/ACT/EVAL sessions first
43
+ - Note the date range covered
44
+
45
+ 2. **Read archive contents**
46
+ - Read each archived context document
47
+ - Extract from each session:
48
+ - Mode transitions (PLAN, ACT, EVAL, AUTO)
49
+ - Primary agent used
50
+ - Task description and title
51
+ - Decisions made
52
+ - Notes recorded
53
+ - Progress items (ACT mode)
54
+ - Findings and recommendations (EVAL mode)
55
+ - Status (completed, in_progress, blocked)
56
+
57
+ ### Phase 2: Pattern Analysis
58
+
59
+ Analyze collected data across five dimensions.
60
+
61
+ #### 2a. Mode Usage Patterns
62
+
63
+ - Count sessions per mode (PLAN, ACT, EVAL, AUTO)
64
+ - Calculate EVAL adoption rate: `EVAL sessions / total sessions`
65
+ - Identify sessions that skipped EVAL (potential quality gaps)
66
+ - Flag AUTO mode usage frequency
67
+
68
+ #### 2b. Agent Utilization
69
+
70
+ - Rank agents by frequency of use
71
+ - Identify underutilized specialists (available but rarely used)
72
+ - Detect agent concentration (over-reliance on one agent)
73
+ - Note any specialist gaps for the project's tech stack
74
+
75
+ #### 2c. TDD Cycle Indicators
76
+
77
+ Search archives for TDD-related patterns:
78
+ - `search_context_archives` with keywords: "TDD", "test", "RED", "GREEN", "REFACTOR"
79
+ - Count sessions mentioning test-first vs test-after
80
+ - Identify sessions where tests were skipped or deferred
81
+ - Calculate approximate TDD adherence rate
82
+
83
+ #### 2d. Recurring Issues
84
+
85
+ Search for repeated problems:
86
+ - `search_context_archives` with keywords: "blocked", "failed", "error", "issue", "bug"
87
+ - Group similar issues by category (build, test, integration, deployment)
88
+ - Identify issues that appear in 2+ sessions (systemic problems)
89
+ - Note resolution patterns (same fix applied repeatedly?)
90
+
91
+ #### 2e. Decision Patterns
92
+
93
+ Analyze decisions across sessions:
94
+ - Extract all recorded decisions
95
+ - Identify decisions that were later reversed or modified
96
+ - Spot recurring decision themes (architecture, tooling, process)
97
+ - Flag decisions made without EVAL validation
98
+
99
+ ### Phase 3: Report Generation
100
+
101
+ Generate a structured markdown report.
102
+
103
+ ```markdown
104
+ # Session Retrospective Report
105
+
106
+ > Period: {start_date} - {end_date}
107
+ > Sessions analyzed: {count}
108
+ > Generated: {current_date}
109
+
110
+ ## Summary Statistics
111
+
112
+ | Metric | Value |
113
+ |--------|-------|
114
+ | Total sessions | {n} |
115
+ | PLAN sessions | {n} |
116
+ | ACT sessions | {n} |
117
+ | EVAL sessions | {n} |
118
+ | AUTO sessions | {n} |
119
+ | EVAL adoption rate | {n}% |
120
+ | Completion rate | {n}% |
121
+
122
+ ## Top Agents
123
+
124
+ | Rank | Agent | Sessions | % |
125
+ |------|-------|----------|---|
126
+ | 1 | {agent} | {n} | {n}% |
127
+ | ... | ... | ... | ... |
128
+
129
+ ## TDD Health
130
+
131
+ - Adherence rate: {n}%
132
+ - Test-first sessions: {n}
133
+ - Test-after sessions: {n}
134
+ - No-test sessions: {n}
135
+
136
+ ## Recurring Issues
137
+
138
+ ### {Issue Category}
139
+ - **Frequency**: {n} sessions
140
+ - **Pattern**: {description}
141
+ - **Impact**: {assessment}
142
+
143
+ ## Key Decisions Timeline
144
+
145
+ | Date | Decision | Mode | Validated? |
146
+ |------|----------|------|------------|
147
+ | {date} | {decision} | {mode} | {yes/no} |
148
+
149
+ ## Improvement Suggestions
150
+
151
+ ### High Priority
152
+ 1. {suggestion with rationale}
153
+
154
+ ### Medium Priority
155
+ 1. {suggestion with rationale}
156
+
157
+ ### Process Observations
158
+ 1. {observation}
159
+ ```
160
+
161
+ ### Phase 4: Improvement Suggestions
162
+
163
+ Generate actionable suggestions based on findings.
164
+
165
+ **Auto-generate suggestions for:**
166
+
167
+ | Pattern Detected | Suggestion |
168
+ |-----------------|------------|
169
+ | EVAL rate < 30% | Increase EVAL usage for quality gates |
170
+ | Single agent > 60% | Diversify specialist agents for broader coverage |
171
+ | TDD adherence < 50% | Reinforce test-first discipline with TDD skill |
172
+ | Same issue 3+ times | Create a checklist or rule to prevent recurrence |
173
+ | Blocked sessions > 20% | Investigate common blockers and add preventive steps |
174
+ | No decisions recorded | Improve decision documentation in context |
175
+ | Decisions reversed > 2x | Add EVAL validation before major decisions |
176
+
177
+ ### Phase 5: Output
178
+
179
+ 1. **Display report** in conversation
180
+ 2. **Save report** to `docs/codingbuddy/retrospective-{YYYY-MM-DD}.md`
181
+ 3. **Offer next steps:**
182
+ - "Create GitHub issues for high-priority improvements?"
183
+ - "Update project rules based on findings?"
184
+ - "Schedule recurring retrospectives?"
185
+
186
+ ## Key Principles
187
+
188
+ - **Data over opinion** - Base all observations on archive evidence
189
+ - **Patterns over incidents** - Focus on recurring themes, not one-off events
190
+ - **Actionable suggestions** - Every finding should have a clear next step
191
+ - **No blame** - Focus on process improvement, not individual mistakes
192
+ - **Incremental** - Suggest 2-3 improvements per retrospective, not a complete overhaul
@@ -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
+ ```