anvil-dev-framework 0.1.6

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 (190) hide show
  1. package/README.md +719 -0
  2. package/VERSION +1 -0
  3. package/docs/ANVIL-REPO-IMPLEMENTATION-PLAN.md +441 -0
  4. package/docs/FIRST-SKILL-TUTORIAL.md +408 -0
  5. package/docs/INSTALLATION-RETRO-NOTES.md +458 -0
  6. package/docs/INSTALLATION.md +984 -0
  7. package/docs/anvil-hud.md +469 -0
  8. package/docs/anvil-init.md +255 -0
  9. package/docs/anvil-state.md +210 -0
  10. package/docs/boris-cherny-ralph-wiggum-insights.md +608 -0
  11. package/docs/command-reference.md +2022 -0
  12. package/docs/hooks-tts.md +368 -0
  13. package/docs/implementation-guide.md +810 -0
  14. package/docs/linear-github-integration.md +247 -0
  15. package/docs/local-issues.md +677 -0
  16. package/docs/patterns/README.md +419 -0
  17. package/docs/planning-responsibilities.md +139 -0
  18. package/docs/session-workflow.md +573 -0
  19. package/docs/simplification-plan-template.md +297 -0
  20. package/docs/simplification-principles.md +129 -0
  21. package/docs/specifications/CCS-RALPH-INTEGRATION-DESIGN.md +633 -0
  22. package/docs/specifications/CCS-RESEARCH-REPORT.md +169 -0
  23. package/docs/specifications/PLAN-ANV-verification-ralph-wiggum.md +403 -0
  24. package/docs/specifications/PLAN-parallel-tracks-anvil-memory-ccs.md +494 -0
  25. package/docs/specifications/SPEC-ANV-VRW/component-01-verify.md +208 -0
  26. package/docs/specifications/SPEC-ANV-VRW/component-02-stop-gate.md +226 -0
  27. package/docs/specifications/SPEC-ANV-VRW/component-03-posttooluse.md +209 -0
  28. package/docs/specifications/SPEC-ANV-VRW/component-04-ralph-wiggum.md +604 -0
  29. package/docs/specifications/SPEC-ANV-VRW/component-05-atomic-actions.md +311 -0
  30. package/docs/specifications/SPEC-ANV-VRW/component-06-verify-subagent.md +264 -0
  31. package/docs/specifications/SPEC-ANV-VRW/component-07-claude-md.md +363 -0
  32. package/docs/specifications/SPEC-ANV-VRW/index.md +182 -0
  33. package/docs/specifications/SPEC-ANV-anvil-memory.md +573 -0
  34. package/docs/specifications/SPEC-ANV-context-checkpoints.md +781 -0
  35. package/docs/specifications/SPEC-ANV-verification-ralph-wiggum.md +789 -0
  36. package/docs/sync.md +122 -0
  37. package/global/CLAUDE.md +140 -0
  38. package/global/agents/verify-app.md +164 -0
  39. package/global/commands/anvil-settings.md +527 -0
  40. package/global/commands/anvil-sync.md +121 -0
  41. package/global/commands/change.md +197 -0
  42. package/global/commands/clarify.md +252 -0
  43. package/global/commands/cleanup.md +292 -0
  44. package/global/commands/commit-push-pr.md +207 -0
  45. package/global/commands/decay-review.md +127 -0
  46. package/global/commands/discover.md +158 -0
  47. package/global/commands/doc-coverage.md +122 -0
  48. package/global/commands/evidence.md +307 -0
  49. package/global/commands/explore.md +121 -0
  50. package/global/commands/force-exit.md +135 -0
  51. package/global/commands/handoff.md +191 -0
  52. package/global/commands/healthcheck.md +302 -0
  53. package/global/commands/hud.md +84 -0
  54. package/global/commands/insights.md +319 -0
  55. package/global/commands/linear-setup.md +184 -0
  56. package/global/commands/lint-fix.md +198 -0
  57. package/global/commands/orient.md +510 -0
  58. package/global/commands/plan.md +228 -0
  59. package/global/commands/ralph.md +346 -0
  60. package/global/commands/ready.md +182 -0
  61. package/global/commands/release.md +305 -0
  62. package/global/commands/retro.md +96 -0
  63. package/global/commands/shard.md +166 -0
  64. package/global/commands/spec.md +227 -0
  65. package/global/commands/sprint.md +184 -0
  66. package/global/commands/tasks.md +228 -0
  67. package/global/commands/test-and-commit.md +151 -0
  68. package/global/commands/validate.md +132 -0
  69. package/global/commands/verify.md +251 -0
  70. package/global/commands/weekly-review.md +156 -0
  71. package/global/hooks/__pycache__/ralph_context_monitor.cpython-314.pyc +0 -0
  72. package/global/hooks/__pycache__/statusline_agent_sync.cpython-314.pyc +0 -0
  73. package/global/hooks/anvil_memory_observe.ts +322 -0
  74. package/global/hooks/anvil_memory_session.ts +166 -0
  75. package/global/hooks/anvil_memory_stop.ts +187 -0
  76. package/global/hooks/parse_transcript.py +116 -0
  77. package/global/hooks/post_merge_cleanup.sh +132 -0
  78. package/global/hooks/post_tool_format.sh +215 -0
  79. package/global/hooks/ralph_context_monitor.py +240 -0
  80. package/global/hooks/ralph_stop.sh +502 -0
  81. package/global/hooks/statusline.sh +1110 -0
  82. package/global/hooks/statusline_agent_sync.py +224 -0
  83. package/global/hooks/stop_gate.sh +250 -0
  84. package/global/lib/.claude/anvil-state.json +21 -0
  85. package/global/lib/__pycache__/agent_registry.cpython-314.pyc +0 -0
  86. package/global/lib/__pycache__/claim_service.cpython-314.pyc +0 -0
  87. package/global/lib/__pycache__/coderabbit_service.cpython-314.pyc +0 -0
  88. package/global/lib/__pycache__/config_service.cpython-314.pyc +0 -0
  89. package/global/lib/__pycache__/coordination_service.cpython-314.pyc +0 -0
  90. package/global/lib/__pycache__/doc_coverage_service.cpython-314.pyc +0 -0
  91. package/global/lib/__pycache__/gate_logger.cpython-314.pyc +0 -0
  92. package/global/lib/__pycache__/github_service.cpython-314.pyc +0 -0
  93. package/global/lib/__pycache__/hygiene_service.cpython-314.pyc +0 -0
  94. package/global/lib/__pycache__/issue_models.cpython-314.pyc +0 -0
  95. package/global/lib/__pycache__/issue_provider.cpython-314.pyc +0 -0
  96. package/global/lib/__pycache__/linear_data_service.cpython-314.pyc +0 -0
  97. package/global/lib/__pycache__/linear_provider.cpython-314.pyc +0 -0
  98. package/global/lib/__pycache__/local_provider.cpython-314.pyc +0 -0
  99. package/global/lib/__pycache__/quality_service.cpython-314.pyc +0 -0
  100. package/global/lib/__pycache__/ralph_state.cpython-314.pyc +0 -0
  101. package/global/lib/__pycache__/state_manager.cpython-314.pyc +0 -0
  102. package/global/lib/__pycache__/transcript_parser.cpython-314.pyc +0 -0
  103. package/global/lib/__pycache__/verification_runner.cpython-314.pyc +0 -0
  104. package/global/lib/__pycache__/verify_iteration.cpython-314.pyc +0 -0
  105. package/global/lib/__pycache__/verify_subagent.cpython-314.pyc +0 -0
  106. package/global/lib/agent_registry.py +995 -0
  107. package/global/lib/anvil-state.sh +435 -0
  108. package/global/lib/claim_service.py +515 -0
  109. package/global/lib/coderabbit_service.py +314 -0
  110. package/global/lib/config_service.py +423 -0
  111. package/global/lib/coordination_service.py +331 -0
  112. package/global/lib/doc_coverage_service.py +1305 -0
  113. package/global/lib/gate_logger.py +316 -0
  114. package/global/lib/github_service.py +310 -0
  115. package/global/lib/handoff_generator.py +775 -0
  116. package/global/lib/hygiene_service.py +712 -0
  117. package/global/lib/issue_models.py +257 -0
  118. package/global/lib/issue_provider.py +339 -0
  119. package/global/lib/linear_data_service.py +210 -0
  120. package/global/lib/linear_provider.py +987 -0
  121. package/global/lib/linear_provider.py.backup +671 -0
  122. package/global/lib/local_provider.py +486 -0
  123. package/global/lib/orient_fast.py +457 -0
  124. package/global/lib/quality_service.py +470 -0
  125. package/global/lib/ralph_prompt_generator.py +563 -0
  126. package/global/lib/ralph_state.py +1202 -0
  127. package/global/lib/state_manager.py +417 -0
  128. package/global/lib/transcript_parser.py +597 -0
  129. package/global/lib/verification_runner.py +557 -0
  130. package/global/lib/verify_iteration.py +490 -0
  131. package/global/lib/verify_subagent.py +250 -0
  132. package/global/skills/README.md +155 -0
  133. package/global/skills/quality-gates/SKILL.md +252 -0
  134. package/global/skills/skill-template/SKILL.md +109 -0
  135. package/global/skills/testing-strategies/SKILL.md +337 -0
  136. package/global/templates/CHANGE-template.md +105 -0
  137. package/global/templates/HANDOFF-template.md +63 -0
  138. package/global/templates/PLAN-template.md +111 -0
  139. package/global/templates/SPEC-template.md +93 -0
  140. package/global/templates/ralph/PROMPT.md.template +89 -0
  141. package/global/templates/ralph/fix_plan.md.template +31 -0
  142. package/global/templates/ralph/progress.txt.template +23 -0
  143. package/global/tests/__pycache__/test_doc_coverage.cpython-314.pyc +0 -0
  144. package/global/tests/test_doc_coverage.py +520 -0
  145. package/global/tests/test_issue_models.py +299 -0
  146. package/global/tests/test_local_provider.py +323 -0
  147. package/global/tools/README.md +178 -0
  148. package/global/tools/__pycache__/anvil-hud.cpython-314.pyc +0 -0
  149. package/global/tools/anvil-hud.py +3622 -0
  150. package/global/tools/anvil-hud.py.bak +3318 -0
  151. package/global/tools/anvil-issue.py +432 -0
  152. package/global/tools/anvil-memory/CLAUDE.md +49 -0
  153. package/global/tools/anvil-memory/README.md +42 -0
  154. package/global/tools/anvil-memory/bun.lock +25 -0
  155. package/global/tools/anvil-memory/bunfig.toml +9 -0
  156. package/global/tools/anvil-memory/package.json +23 -0
  157. package/global/tools/anvil-memory/src/__tests__/ccs/context-monitor.test.ts +535 -0
  158. package/global/tools/anvil-memory/src/__tests__/ccs/edge-cases.test.ts +645 -0
  159. package/global/tools/anvil-memory/src/__tests__/ccs/fixtures.ts +363 -0
  160. package/global/tools/anvil-memory/src/__tests__/ccs/index.ts +8 -0
  161. package/global/tools/anvil-memory/src/__tests__/ccs/integration.test.ts +417 -0
  162. package/global/tools/anvil-memory/src/__tests__/ccs/prompt-generator.test.ts +571 -0
  163. package/global/tools/anvil-memory/src/__tests__/ccs/ralph-stop.test.ts +440 -0
  164. package/global/tools/anvil-memory/src/__tests__/ccs/test-utils.ts +252 -0
  165. package/global/tools/anvil-memory/src/__tests__/commands.test.ts +657 -0
  166. package/global/tools/anvil-memory/src/__tests__/db.test.ts +641 -0
  167. package/global/tools/anvil-memory/src/__tests__/hooks.test.ts +272 -0
  168. package/global/tools/anvil-memory/src/__tests__/performance.test.ts +427 -0
  169. package/global/tools/anvil-memory/src/__tests__/test-utils.ts +113 -0
  170. package/global/tools/anvil-memory/src/commands/checkpoint.ts +197 -0
  171. package/global/tools/anvil-memory/src/commands/get.ts +115 -0
  172. package/global/tools/anvil-memory/src/commands/init.ts +94 -0
  173. package/global/tools/anvil-memory/src/commands/observe.ts +163 -0
  174. package/global/tools/anvil-memory/src/commands/search.ts +112 -0
  175. package/global/tools/anvil-memory/src/db.ts +638 -0
  176. package/global/tools/anvil-memory/src/index.ts +205 -0
  177. package/global/tools/anvil-memory/src/types.ts +122 -0
  178. package/global/tools/anvil-memory/tsconfig.json +29 -0
  179. package/global/tools/ralph-loop.sh +359 -0
  180. package/package.json +45 -0
  181. package/scripts/anvil +822 -0
  182. package/scripts/extract_patterns.py +222 -0
  183. package/scripts/init-project.sh +541 -0
  184. package/scripts/install.sh +229 -0
  185. package/scripts/postinstall.js +41 -0
  186. package/scripts/rollback.sh +188 -0
  187. package/scripts/sync.sh +623 -0
  188. package/scripts/test-statusline.sh +248 -0
  189. package/scripts/update_claude_md.py +224 -0
  190. package/scripts/verify.sh +255 -0
@@ -0,0 +1,109 @@
1
+ ---
2
+ name: [Skill Name]
3
+ description: [Brief description of what this skill provides]
4
+ triggers:
5
+ - [keyword1]
6
+ - [keyword2]
7
+ - [keyword3]
8
+ version: 1.0.0
9
+ ---
10
+
11
+ # [Skill Name]
12
+
13
+ ## Overview
14
+ [2-3 sentences describing what this skill covers and why it exists]
15
+
16
+ ## When to Use
17
+ - [Situation 1 when this skill is relevant]
18
+ - [Situation 2 when this skill is relevant]
19
+ - [Situation 3 when this skill is relevant]
20
+
21
+ ## Key Concepts
22
+
23
+ ### [Concept 1]
24
+ [Explanation of the concept]
25
+
26
+ ### [Concept 2]
27
+ [Explanation of the concept]
28
+
29
+ ### [Concept 3]
30
+ [Explanation of the concept]
31
+
32
+ ## Patterns
33
+
34
+ ### Pattern: [Pattern Name]
35
+ **When**: [When to use this pattern]
36
+ **Why**: [Why this pattern is preferred]
37
+
38
+ ```typescript
39
+ // Example implementation
40
+ [code example]
41
+ ```
42
+
43
+ ### Pattern: [Another Pattern]
44
+ **When**: [When to use]
45
+ **Why**: [Why preferred]
46
+
47
+ ```typescript
48
+ [code example]
49
+ ```
50
+
51
+ ## Decision Framework
52
+
53
+ Use this when deciding between approaches:
54
+
55
+ | Situation | Recommended Approach | Reason |
56
+ |-----------|---------------------|--------|
57
+ | [Situation 1] | [Approach] | [Reason] |
58
+ | [Situation 2] | [Approach] | [Reason] |
59
+ | [Situation 3] | [Approach] | [Reason] |
60
+
61
+ ## Anti-Patterns
62
+
63
+ ### ❌ [Anti-Pattern Name]
64
+ **Problem**: [Why this is bad]
65
+ **Instead**: [What to do instead]
66
+
67
+ ```typescript
68
+ // Bad
69
+ [bad code]
70
+
71
+ // Good
72
+ [good code]
73
+ ```
74
+
75
+ ### ❌ [Another Anti-Pattern]
76
+ **Problem**: [Why this is bad]
77
+ **Instead**: [What to do instead]
78
+
79
+ ## Checklist
80
+
81
+ Before completing work in this domain, verify:
82
+
83
+ - [ ] [Checklist item 1]
84
+ - [ ] [Checklist item 2]
85
+ - [ ] [Checklist item 3]
86
+ - [ ] [Checklist item 4]
87
+
88
+ ## Examples
89
+
90
+ ### Example 1: [Example Name]
91
+ [Description of what this example shows]
92
+
93
+ See: `examples/example-1.ts`
94
+
95
+ ### Example 2: [Example Name]
96
+ [Description]
97
+
98
+ See: `examples/example-2.ts`
99
+
100
+ ## References
101
+
102
+ - [Link to official documentation]
103
+ - [Link to relevant article]
104
+ - [Link to internal documentation]
105
+
106
+ ## Changelog
107
+
108
+ ### v1.0.0
109
+ - Initial version
@@ -0,0 +1,337 @@
1
+ ---
2
+ name: Testing Strategies
3
+ description: Comprehensive testing patterns including unit, integration, and E2E testing
4
+ triggers:
5
+ - testing
6
+ - unit test
7
+ - integration test
8
+ - e2e test
9
+ - test coverage
10
+ - test review
11
+ version: 1.0.0
12
+ ---
13
+
14
+ # Testing Strategies
15
+
16
+ Comprehensive testing patterns for AI-assisted development.
17
+
18
+ ---
19
+
20
+ ## Testing Pyramid
21
+
22
+ ```
23
+ ┌─────┐
24
+ │ E2E │ Few, slow, high confidence
25
+ ─┴─────┴─
26
+ │Integration│ Some, medium speed
27
+ ─┴───────────┴─
28
+ │ Unit Tests │ Many, fast, isolated
29
+ ─┴─────────────────┴─
30
+ ```
31
+
32
+ | Layer | Count | Speed | Scope |
33
+ |-------|-------|-------|-------|
34
+ | Unit | Many (70-80%) | Fast (<10ms) | Single function/component |
35
+ | Integration | Some (15-20%) | Medium (<1s) | Module boundaries |
36
+ | E2E | Few (5-10%) | Slow (seconds) | Full user flows |
37
+
38
+ ---
39
+
40
+ ## Unit Testing
41
+
42
+ ### When to Write Unit Tests
43
+
44
+ - Pure functions with logic
45
+ - Utility functions
46
+ - Data transformations
47
+ - Business rules
48
+ - Components with conditional rendering
49
+
50
+ ### Unit Test Structure (AAA Pattern)
51
+
52
+ ```typescript
53
+ describe('calculateTotal', () => {
54
+ it('should apply discount when quantity > 10', () => {
55
+ // Arrange
56
+ const items = [{ price: 100, quantity: 15 }];
57
+
58
+ // Act
59
+ const result = calculateTotal(items);
60
+
61
+ // Assert
62
+ expect(result).toBe(1425); // 15 * 100 * 0.95
63
+ });
64
+ });
65
+ ```
66
+
67
+ ### What to Test
68
+
69
+ - ✅ Happy path (expected inputs → expected outputs)
70
+ - ✅ Edge cases (empty, null, boundary values)
71
+ - ✅ Error cases (invalid inputs → appropriate errors)
72
+ - ✅ State transitions
73
+
74
+ ### What NOT to Unit Test
75
+
76
+ - ❌ Third-party libraries (they have their own tests)
77
+ - ❌ Simple getters/setters (no logic)
78
+ - ❌ Implementation details (test behavior, not internals)
79
+ - ❌ Framework code (React, Express, etc.)
80
+
81
+ ---
82
+
83
+ ## Integration Testing
84
+
85
+ ### When to Write Integration Tests
86
+
87
+ - API route handlers
88
+ - Database operations
89
+ - Service-to-service communication
90
+ - Authentication flows
91
+ - Data flow across module boundaries
92
+
93
+ ### Integration Test Process
94
+
95
+ **Step 1: Identify Integration Points**
96
+ ```
97
+ Component A ←→ API ←→ Database
98
+
99
+ └──→ External Service
100
+ ```
101
+
102
+ **Step 2: Test Each Boundary**
103
+
104
+ ```typescript
105
+ describe('POST /api/reservations', () => {
106
+ it('should create reservation and return confirmation', async () => {
107
+ // Setup test database state
108
+ await db.items.create({ id: 'item-1', available: true });
109
+
110
+ // Make request
111
+ const response = await request(app)
112
+ .post('/api/reservations')
113
+ .send({ itemId: 'item-1', guestEmail: 'test@example.com' });
114
+
115
+ // Verify response
116
+ expect(response.status).toBe(201);
117
+ expect(response.body.reservationId).toBeDefined();
118
+
119
+ // Verify database state
120
+ const reservation = await db.reservations.findFirst({
121
+ where: { itemId: 'item-1' }
122
+ });
123
+ expect(reservation).toBeDefined();
124
+ });
125
+ });
126
+ ```
127
+
128
+ **Step 3: Test Error Paths**
129
+
130
+ ```typescript
131
+ it('should return 409 when item already reserved', async () => {
132
+ // Setup: item already reserved
133
+ await db.reservations.create({
134
+ itemId: 'item-1',
135
+ status: 'confirmed'
136
+ });
137
+
138
+ const response = await request(app)
139
+ .post('/api/reservations')
140
+ .send({ itemId: 'item-1', guestEmail: 'test@example.com' });
141
+
142
+ expect(response.status).toBe(409);
143
+ expect(response.body.error).toContain('already reserved');
144
+ });
145
+ ```
146
+
147
+ ### Integration Test Checklist
148
+
149
+ Before PR, verify integration tests cover:
150
+
151
+ - [ ] Happy path (valid inputs → success)
152
+ - [ ] Authentication required (401 without token)
153
+ - [ ] Authorization (403 for wrong user)
154
+ - [ ] Validation errors (400 for bad input)
155
+ - [ ] Not found (404 for missing resources)
156
+ - [ ] Conflict states (409 for duplicates)
157
+ - [ ] Database state changes verified
158
+
159
+ ---
160
+
161
+ ## E2E Testing
162
+
163
+ ### When to Write E2E Tests
164
+
165
+ - Critical user journeys
166
+ - Payment flows
167
+ - Authentication flows
168
+ - Multi-step processes
169
+ - Anything that breaks = serious business impact
170
+
171
+ ### E2E Test Structure
172
+
173
+ ```typescript
174
+ test('user can complete checkout flow', async ({ page }) => {
175
+ // Setup: logged in user with items in cart
176
+ await loginAsTestUser(page);
177
+ await addItemToCart(page, 'product-123');
178
+
179
+ // Navigate to checkout
180
+ await page.click('[data-testid="checkout-button"]');
181
+
182
+ // Fill payment info
183
+ await page.fill('[data-testid="card-number"]', '4242424242424242');
184
+ await page.fill('[data-testid="expiry"]', '12/25');
185
+ await page.fill('[data-testid="cvc"]', '123');
186
+
187
+ // Submit
188
+ await page.click('[data-testid="pay-button"]');
189
+
190
+ // Verify success
191
+ await expect(page.locator('[data-testid="success-message"]'))
192
+ .toBeVisible();
193
+ await expect(page.locator('[data-testid="order-id"]'))
194
+ .toHaveText(/ORD-\d+/);
195
+ });
196
+ ```
197
+
198
+ ### E2E Best Practices
199
+
200
+ - Use data-testid attributes (not CSS classes)
201
+ - Setup known test state before each test
202
+ - Clean up after tests
203
+ - Don't test what unit/integration tests cover
204
+ - Run in CI, not just locally
205
+
206
+ ---
207
+
208
+ ## Test Review Checklist
209
+
210
+ When reviewing tests (your own or others'):
211
+
212
+ ### Coverage
213
+ - [ ] All new code has tests
214
+ - [ ] Edge cases covered
215
+ - [ ] Error paths tested
216
+ - [ ] No dead test code
217
+
218
+ ### Quality
219
+ - [ ] Tests are readable (clear names, AAA pattern)
220
+ - [ ] Tests are isolated (don't depend on each other)
221
+ - [ ] Tests are deterministic (no flaky tests)
222
+ - [ ] Tests are fast (unit <10ms, integration <1s)
223
+
224
+ ### Anti-Patterns to Catch
225
+ - [ ] No testing implementation details
226
+ - [ ] No excessive mocking
227
+ - [ ] No testing third-party code
228
+ - [ ] No duplicate test coverage
229
+ - [ ] No commented-out tests
230
+
231
+ ### Red Flags
232
+ - 🚩 Test name doesn't describe behavior
233
+ - 🚩 Multiple asserts testing unrelated things
234
+ - 🚩 Test setup is longer than test itself
235
+ - 🚩 Mock verifies implementation, not behavior
236
+ - 🚩 Test passes when code is clearly broken
237
+
238
+ ---
239
+
240
+ ## Shared Code Testing (Hooks/Utilities)
241
+
242
+ ### Testing Hooks
243
+
244
+ ```typescript
245
+ import { renderHook, act } from '@testing-library/react';
246
+ import { useCounter } from './useCounter';
247
+
248
+ describe('useCounter', () => {
249
+ it('should increment counter', () => {
250
+ const { result } = renderHook(() => useCounter());
251
+
252
+ act(() => {
253
+ result.current.increment();
254
+ });
255
+
256
+ expect(result.current.count).toBe(1);
257
+ });
258
+ });
259
+ ```
260
+
261
+ ### Testing Utilities
262
+
263
+ ```typescript
264
+ describe('formatCurrency', () => {
265
+ it.each([
266
+ [100, '$1.00'],
267
+ [1000, '$10.00'],
268
+ [1050, '$10.50'],
269
+ [0, '$0.00'],
270
+ ])('formats %i cents as %s', (cents, expected) => {
271
+ expect(formatCurrency(cents)).toBe(expected);
272
+ });
273
+ });
274
+ ```
275
+
276
+ ### Rule of Three for Shared Code
277
+
278
+ Before abstracting shared code:
279
+ 1. First use: Just write it
280
+ 2. Second use: Note the duplication
281
+ 3. Third use: NOW abstract and test thoroughly
282
+
283
+ Thoroughly tested shared code prevents bugs that cascade across the codebase.
284
+
285
+ ---
286
+
287
+ ## Test Organization
288
+
289
+ ```
290
+ src/
291
+ ├── components/
292
+ │ └── Button/
293
+ │ ├── Button.tsx
294
+ │ └── Button.test.tsx # Unit tests
295
+ ├── services/
296
+ │ └── auth/
297
+ │ ├── authService.ts
298
+ │ └── authService.test.ts # Unit tests
299
+ ├── app/
300
+ │ └── api/
301
+ │ └── reservations/
302
+ │ ├── route.ts
303
+ │ └── route.test.ts # Integration tests
304
+ └── e2e/
305
+ └── checkout.test.ts # E2E tests
306
+ ```
307
+
308
+ ---
309
+
310
+ ## AI-Specific Testing Guidance
311
+
312
+ ### When Generating Tests with AI
313
+
314
+ 1. **Start with behavior description** — Tell AI what the code SHOULD do
315
+ 2. **Review generated tests** — AI may miss edge cases or test implementation details
316
+ 3. **Run tests immediately** — Verify they actually pass/fail correctly
317
+ 4. **Check for flakiness** — Run multiple times
318
+
319
+ ### Common AI Testing Mistakes
320
+
321
+ - Testing implementation instead of behavior
322
+ - Over-mocking (mocking the thing being tested)
323
+ - Missing error cases
324
+ - Hardcoded test data that doesn't cover edge cases
325
+ - Tests that always pass (not actually testing anything)
326
+
327
+ ### Test-First with AI
328
+
329
+ When asking AI to implement features:
330
+
331
+ 1. Write test first (or have AI write test)
332
+ 2. Verify test FAILS (confirms test is working)
333
+ 3. Implement feature
334
+ 4. Verify test PASSES
335
+ 5. Refactor if needed
336
+
337
+ This ensures tests actually validate behavior.
@@ -0,0 +1,105 @@
1
+ ---
2
+ change_id: CHANGE-[NUMBER]
3
+ title: [Change Description]
4
+ status: draft
5
+ created: YYYY-MM-DD
6
+ linear_issue: [Issue Key]
7
+ risk_level: low | medium | high
8
+ ---
9
+
10
+ # Change Proposal: [Title]
11
+
12
+ ## Summary
13
+ [1-2 sentence description of the change]
14
+
15
+ ## Motivation
16
+ [Why is this change needed? What problem does it solve?]
17
+
18
+ ## Current State
19
+ [Description of how things work now]
20
+
21
+ ### Affected Files (Current)
22
+ | File | Purpose | Lines |
23
+ |------|---------|-------|
24
+ | src/components/X.tsx | [Current purpose] | ~150 |
25
+
26
+ ## Proposed Changes
27
+
28
+ ### File: src/[path]/[file].tsx
29
+
30
+ #### MODIFIED: [Function/Component Name]
31
+ ```typescript
32
+ // BEFORE (lines XX-YY)
33
+ [current code]
34
+
35
+ // AFTER
36
+ [new code with ADDED/MODIFIED/REMOVED comments]
37
+ ```
38
+
39
+ #### ADDED: [New element]
40
+ ```typescript
41
+ // ADDED at line XX
42
+ [new code]
43
+ ```
44
+
45
+ #### REMOVED: [Removed element]
46
+ ```typescript
47
+ // REMOVED from [location]
48
+ [removed code]
49
+ ```
50
+
51
+ ---
52
+
53
+ ### File: src/[path]/[another-file].ts
54
+
55
+ #### MODIFIED: [What changed]
56
+ ```typescript
57
+ // BEFORE
58
+ [old code]
59
+
60
+ // AFTER
61
+ [new code]
62
+ ```
63
+
64
+ ## New Files
65
+ | File | Purpose |
66
+ |------|---------|
67
+ | | |
68
+
69
+ ## Deleted Files
70
+ | File | Reason |
71
+ |------|--------|
72
+ | | |
73
+
74
+ ## Impact Analysis
75
+
76
+ ### Breaking Changes
77
+ - [ ] API contract changes: [Yes/No - details]
78
+ - [ ] Database schema changes: [Yes/No - details]
79
+ - [ ] Environment variable changes: [Yes/No - details]
80
+
81
+ ### Affected Consumers
82
+ | Consumer | Impact | Migration Needed |
83
+ |----------|--------|------------------|
84
+ | [Component/Service] | [Impact] | [Yes/No] |
85
+
86
+ ### Test Impact
87
+ - [ ] Existing tests need updates: [List tests]
88
+ - [ ] New tests needed: [List new tests]
89
+
90
+ ## Migration Plan
91
+ [If breaking changes, how will migration happen?]
92
+
93
+ 1. [Step 1]
94
+ 2. [Step 2]
95
+
96
+ ## Rollback Plan
97
+ [How to revert if something goes wrong]
98
+
99
+ ## Risk Assessment
100
+ | Risk | Likelihood | Impact | Mitigation |
101
+ |------|------------|--------|------------|
102
+ | [Risk] | Low/Med/High | Low/Med/High | [Mitigation] |
103
+
104
+ ## Open Questions
105
+ - [ ] [Question]
@@ -0,0 +1,63 @@
1
+ ---
2
+ session_date: YYYY-MM-DD
3
+ session_time: HH:MM
4
+ branch: [current branch]
5
+ linear_issues: [comma-separated issue keys]
6
+ ---
7
+
8
+ # Session Handoff: [Brief Description]
9
+
10
+ ## Session Summary
11
+ [1-2 sentence summary of what this session was about]
12
+
13
+ ## Completed This Session
14
+ - [x] [Issue key]: [What was done]
15
+ - [x] [Description of completed work]
16
+ - [x] [Another completed item]
17
+
18
+ ## In Progress (Not Complete)
19
+
20
+ ### [Issue Key]: [Title]
21
+ - **Current state**: [Where we left off - be specific]
22
+ - **Next steps**: [What needs to happen next]
23
+ - **Files touched**:
24
+ - `src/path/to/file.tsx` - [what was done/needs doing]
25
+ - `src/path/to/another.ts` - [what was done/needs doing]
26
+ - **Blockers**: [Any blockers, or "None"]
27
+
28
+ ### [Another Issue Key]: [Title]
29
+ - **Current state**: [Where we left off]
30
+ - **Next steps**: [What needs to happen next]
31
+ - **Files touched**: [List files]
32
+ - **Blockers**: [Any blockers]
33
+
34
+ ## Discovered Work
35
+ - [ ] [Description] → Filed as [Issue key]
36
+ - [ ] [Description] → Not yet filed (needs: [what's needed])
37
+
38
+ ## Environment State
39
+ - **Branch**: [branch name]
40
+ - **Uncommitted changes**: [Yes/No - if yes, describe briefly]
41
+ - **Last commit**: [hash] [message]
42
+ - **Tests passing**: [Yes/No]
43
+ - **Build status**: [Clean/Errors]
44
+
45
+ ## Recommended Next Task
46
+ [What should be tackled first next session and why]
47
+
48
+ **Issue**: [Issue key]
49
+ **Reason**: [Why this should be next - priority, dependencies resolved, etc.]
50
+
51
+ ## Critical Context for Next Session
52
+ [Important context that might be lost - decisions made, constraints discovered, gotchas]
53
+
54
+ 1. **[Topic]**: [Important detail]
55
+ 2. **[Topic]**: [Important detail]
56
+ 3. **[Topic]**: [Important detail]
57
+
58
+ ## Notes
59
+ [Any other relevant notes, links, or context]
60
+
61
+ ---
62
+ *Handoff created: [timestamp]*
63
+ *Next session: Start with `/orient` to pick up context*
@@ -0,0 +1,111 @@
1
+ ---
2
+ plan_id: PLAN-[SPEC-ID]
3
+ spec_ref: SPEC-[NUMBER]
4
+ status: draft
5
+ created: YYYY-MM-DD
6
+ estimated_hours: [X-Y]
7
+ ---
8
+
9
+ # Implementation Plan: [Feature Name]
10
+
11
+ ## Specification Reference
12
+ - **Spec**: SPEC-[number]
13
+ - **Linear Issue**: [Issue key]
14
+
15
+ ## Implementation Strategy
16
+ [High-level approach to implementing this feature]
17
+
18
+ ## Phases
19
+
20
+ ### Phase 1: [Phase Name]
21
+ **Estimated**: X hours
22
+ **Goal**: [What this phase accomplishes]
23
+
24
+ **Tasks**:
25
+ 1. [ ] [Task description]
26
+ 2. [ ] [Task description]
27
+ 3. [ ] [Task description]
28
+
29
+ **Files to Create/Modify**:
30
+ | File | Action | Purpose |
31
+ |------|--------|---------|
32
+ | src/components/X.tsx | Create | [Purpose] |
33
+ | src/services/y.ts | Modify | [Purpose] |
34
+
35
+ **Acceptance**: [How to verify phase is complete]
36
+
37
+ ---
38
+
39
+ ### Phase 2: [Phase Name]
40
+ **Estimated**: X hours
41
+ **Goal**: [What this phase accomplishes]
42
+ **Depends on**: Phase 1
43
+
44
+ **Tasks**:
45
+ 1. [ ] [Task description]
46
+ 2. [ ] [Task description]
47
+
48
+ **Files to Create/Modify**:
49
+ | File | Action | Purpose |
50
+ |------|--------|---------|
51
+
52
+ **Acceptance**: [How to verify phase is complete]
53
+
54
+ ---
55
+
56
+ ### Phase 3: Testing & Polish
57
+ **Estimated**: X hours
58
+ **Goal**: Verify all acceptance criteria, fix edge cases
59
+
60
+ **Tasks**:
61
+ 1. [ ] Write unit tests for [component]
62
+ 2. [ ] Write integration tests for [flow]
63
+ 3. [ ] Manual testing of acceptance scenarios
64
+ 4. [ ] Address any edge cases found
65
+
66
+ **Acceptance**: All tests pass, all Gherkin scenarios verified
67
+
68
+ ## File Change Summary
69
+
70
+ ### New Files
71
+ | Path | Purpose |
72
+ |------|---------|
73
+ | | |
74
+
75
+ ### Modified Files
76
+ | Path | Changes |
77
+ |------|---------|
78
+ | | |
79
+
80
+ ### Deleted Files
81
+ | Path | Reason |
82
+ |------|--------|
83
+ | [none expected] | |
84
+
85
+ ## Testing Strategy
86
+
87
+ ### Unit Tests
88
+ - [ ] [Component/function to test]
89
+
90
+ ### Integration Tests
91
+ - [ ] [Flow to test]
92
+
93
+ ### Manual Testing
94
+ - [ ] [Scenario to manually verify]
95
+
96
+ ## Risks and Rollback
97
+
98
+ ### Known Risks
99
+ | Risk | Mitigation |
100
+ |------|------------|
101
+ | [Risk] | [Mitigation] |
102
+
103
+ ### Rollback Plan
104
+ [How to rollback if something goes wrong]
105
+
106
+ ## Definition of Done
107
+ - [ ] All tasks complete
108
+ - [ ] All tests passing
109
+ - [ ] Code reviewed
110
+ - [ ] Acceptance criteria verified
111
+ - [ ] Documentation updated (if needed)