@qazuor/claude-code-config 0.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 (171) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1248 -0
  3. package/dist/bin.cjs +11886 -0
  4. package/dist/bin.cjs.map +1 -0
  5. package/dist/bin.d.cts +1 -0
  6. package/dist/bin.d.ts +1 -0
  7. package/dist/bin.js +11869 -0
  8. package/dist/bin.js.map +1 -0
  9. package/dist/index.cjs +3887 -0
  10. package/dist/index.cjs.map +1 -0
  11. package/dist/index.d.cts +1325 -0
  12. package/dist/index.d.ts +1325 -0
  13. package/dist/index.js +3835 -0
  14. package/dist/index.js.map +1 -0
  15. package/package.json +86 -0
  16. package/templates/.log/notifications.log +1775 -0
  17. package/templates/agents/README.md +164 -0
  18. package/templates/agents/_registry.json +443 -0
  19. package/templates/agents/design/content-writer.md +353 -0
  20. package/templates/agents/design/ux-ui-designer.md +382 -0
  21. package/templates/agents/engineering/astro-engineer.md +293 -0
  22. package/templates/agents/engineering/db-drizzle-engineer.md +360 -0
  23. package/templates/agents/engineering/express-engineer.md +316 -0
  24. package/templates/agents/engineering/fastify-engineer.md +399 -0
  25. package/templates/agents/engineering/hono-engineer.md +263 -0
  26. package/templates/agents/engineering/mongoose-engineer.md +473 -0
  27. package/templates/agents/engineering/nestjs-engineer.md +429 -0
  28. package/templates/agents/engineering/nextjs-engineer.md +451 -0
  29. package/templates/agents/engineering/node-typescript-engineer.md +347 -0
  30. package/templates/agents/engineering/prisma-engineer.md +432 -0
  31. package/templates/agents/engineering/react-senior-dev.md +394 -0
  32. package/templates/agents/engineering/tanstack-start-engineer.md +447 -0
  33. package/templates/agents/engineering/tech-lead.md +269 -0
  34. package/templates/agents/product/product-functional.md +329 -0
  35. package/templates/agents/product/product-technical.md +578 -0
  36. package/templates/agents/quality/debugger.md +514 -0
  37. package/templates/agents/quality/qa-engineer.md +390 -0
  38. package/templates/agents/specialized/enrichment-agent.md +277 -0
  39. package/templates/agents/specialized/i18n-specialist.md +322 -0
  40. package/templates/agents/specialized/seo-ai-specialist.md +387 -0
  41. package/templates/agents/specialized/tech-writer.md +300 -0
  42. package/templates/code-style/.editorconfig +27 -0
  43. package/templates/code-style/.prettierignore +25 -0
  44. package/templates/code-style/.prettierrc +12 -0
  45. package/templates/code-style/biome.json +78 -0
  46. package/templates/code-style/commitlint.config.js +44 -0
  47. package/templates/commands/README.md +175 -0
  48. package/templates/commands/_registry.json +420 -0
  49. package/templates/commands/add-new-entity.md +211 -0
  50. package/templates/commands/audit/accessibility-audit.md +360 -0
  51. package/templates/commands/audit/performance-audit.md +290 -0
  52. package/templates/commands/audit/security-audit.md +231 -0
  53. package/templates/commands/code-check.md +127 -0
  54. package/templates/commands/five-why.md +225 -0
  55. package/templates/commands/formatting/format-markdown.md +197 -0
  56. package/templates/commands/git/commit.md +247 -0
  57. package/templates/commands/meta/create-agent.md +257 -0
  58. package/templates/commands/meta/create-command.md +312 -0
  59. package/templates/commands/meta/create-skill.md +321 -0
  60. package/templates/commands/meta/help.md +318 -0
  61. package/templates/commands/planning/check-completed-tasks.md +224 -0
  62. package/templates/commands/planning/cleanup-issues.md +248 -0
  63. package/templates/commands/planning/planning-cleanup.md +251 -0
  64. package/templates/commands/planning/sync-planning-github.md +133 -0
  65. package/templates/commands/planning/sync-todos-github.md +203 -0
  66. package/templates/commands/quality-check.md +211 -0
  67. package/templates/commands/run-tests.md +159 -0
  68. package/templates/commands/start-feature-plan.md +232 -0
  69. package/templates/commands/start-refactor-plan.md +244 -0
  70. package/templates/commands/sync-planning.md +176 -0
  71. package/templates/commands/update-docs.md +242 -0
  72. package/templates/docs/CHECKPOINT-SYSTEM.md +504 -0
  73. package/templates/docs/INDEX.md +677 -0
  74. package/templates/docs/RECOMMENDED-HOOKS.md +415 -0
  75. package/templates/docs/_registry.json +329 -0
  76. package/templates/docs/diagrams/README.md +220 -0
  77. package/templates/docs/diagrams/agent-hierarchy.mmd +55 -0
  78. package/templates/docs/diagrams/documentation-map.mmd +61 -0
  79. package/templates/docs/diagrams/tools-relationship.mmd +55 -0
  80. package/templates/docs/diagrams/workflow-decision-tree.mmd +38 -0
  81. package/templates/docs/doc-sync.md +533 -0
  82. package/templates/docs/examples/end-to-end-workflow.md +1505 -0
  83. package/templates/docs/glossary.md +495 -0
  84. package/templates/docs/guides/mockup-prompt-engineering.md +644 -0
  85. package/templates/docs/guides/mockup-setup.md +737 -0
  86. package/templates/docs/learnings/README.md +250 -0
  87. package/templates/docs/learnings/common-architectural-patterns.md +123 -0
  88. package/templates/docs/learnings/common-mistakes-to-avoid.md +149 -0
  89. package/templates/docs/learnings/markdown-formatting-standards.md +104 -0
  90. package/templates/docs/learnings/monorepo-command-execution.md +64 -0
  91. package/templates/docs/learnings/optimization-tips.md +146 -0
  92. package/templates/docs/learnings/planning-linear-sync-workflow.md +70 -0
  93. package/templates/docs/learnings/shell-compatibility-fish.md +46 -0
  94. package/templates/docs/learnings/test-organization-structure.md +68 -0
  95. package/templates/docs/mcp-installation.md +613 -0
  96. package/templates/docs/mcp-servers.md +989 -0
  97. package/templates/docs/notification-installation.md +570 -0
  98. package/templates/docs/quick-start.md +354 -0
  99. package/templates/docs/standards/architecture-patterns.md +1064 -0
  100. package/templates/docs/standards/atomic-commits.md +513 -0
  101. package/templates/docs/standards/code-standards.md +993 -0
  102. package/templates/docs/standards/design-standards.md +656 -0
  103. package/templates/docs/standards/documentation-standards.md +1160 -0
  104. package/templates/docs/standards/testing-standards.md +969 -0
  105. package/templates/docs/system-maintenance.md +604 -0
  106. package/templates/docs/templates/PDR-template.md +561 -0
  107. package/templates/docs/templates/TODOs-template.md +534 -0
  108. package/templates/docs/templates/tech-analysis-template.md +800 -0
  109. package/templates/docs/workflows/README.md +519 -0
  110. package/templates/docs/workflows/atomic-task-protocol.md +955 -0
  111. package/templates/docs/workflows/decision-tree.md +482 -0
  112. package/templates/docs/workflows/edge-cases.md +856 -0
  113. package/templates/docs/workflows/phase-1-planning.md +957 -0
  114. package/templates/docs/workflows/phase-2-implementation.md +896 -0
  115. package/templates/docs/workflows/phase-3-validation.md +792 -0
  116. package/templates/docs/workflows/phase-4-finalization.md +927 -0
  117. package/templates/docs/workflows/quick-fix-protocol.md +505 -0
  118. package/templates/docs/workflows/task-atomization.md +537 -0
  119. package/templates/docs/workflows/task-completion-protocol.md +448 -0
  120. package/templates/hooks/on-notification.sh +28 -0
  121. package/templates/schemas/checkpoint.schema.json +97 -0
  122. package/templates/schemas/code-registry.schema.json +84 -0
  123. package/templates/schemas/pdr.schema.json +314 -0
  124. package/templates/schemas/problems.schema.json +55 -0
  125. package/templates/schemas/tech-analysis.schema.json +404 -0
  126. package/templates/schemas/telemetry.schema.json +298 -0
  127. package/templates/schemas/todos.schema.json +234 -0
  128. package/templates/schemas/workflows.schema.json +69 -0
  129. package/templates/scripts/add-changelogs.sh +105 -0
  130. package/templates/scripts/generate-code-registry.ts +270 -0
  131. package/templates/scripts/health-check.sh +343 -0
  132. package/templates/scripts/sync-registry.sh +40 -0
  133. package/templates/scripts/telemetry-report.ts +36 -0
  134. package/templates/scripts/validate-docs.sh +224 -0
  135. package/templates/scripts/validate-registry.sh +225 -0
  136. package/templates/scripts/validate-schemas.ts +283 -0
  137. package/templates/scripts/validate-structure.sh +165 -0
  138. package/templates/scripts/worktree-cleanup.sh +81 -0
  139. package/templates/scripts/worktree-create.sh +63 -0
  140. package/templates/sessions/planning/.gitkeep +0 -0
  141. package/templates/sessions/planning/archived/.gitkeep +0 -0
  142. package/templates/settings.json +202 -0
  143. package/templates/settings.local.json +138 -0
  144. package/templates/skills/README.md +197 -0
  145. package/templates/skills/_registry.json +473 -0
  146. package/templates/skills/audit/accessibility-audit.md +309 -0
  147. package/templates/skills/audit/performance-audit.md +257 -0
  148. package/templates/skills/audit/security-audit.md +217 -0
  149. package/templates/skills/auth/nextauth-patterns.md +308 -0
  150. package/templates/skills/brand-guidelines.md +240 -0
  151. package/templates/skills/documentation/markdown-formatter.md +302 -0
  152. package/templates/skills/git/git-commit-helper.md +321 -0
  153. package/templates/skills/i18n/i18n-patterns.md +251 -0
  154. package/templates/skills/patterns/error-handling-patterns.md +242 -0
  155. package/templates/skills/patterns/tdd-methodology.md +342 -0
  156. package/templates/skills/qa/qa-criteria-validator.md +383 -0
  157. package/templates/skills/qa/web-app-testing.md +398 -0
  158. package/templates/skills/react/react-hook-form-patterns.md +359 -0
  159. package/templates/skills/state/redux-toolkit-patterns.md +272 -0
  160. package/templates/skills/state/tanstack-query-patterns.md +299 -0
  161. package/templates/skills/state/zustand-patterns.md +301 -0
  162. package/templates/skills/tech/mermaid-diagram-specialist.md +195 -0
  163. package/templates/skills/tech/shadcn-specialist.md +252 -0
  164. package/templates/skills/tech/vercel-specialist.md +297 -0
  165. package/templates/skills/testing/api-app-testing.md +254 -0
  166. package/templates/skills/testing/performance-testing.md +275 -0
  167. package/templates/skills/testing/security-testing.md +348 -0
  168. package/templates/skills/utils/add-memory.md +295 -0
  169. package/templates/skills/utils/json-data-auditor.md +283 -0
  170. package/templates/skills/utils/pdf-creator-editor.md +342 -0
  171. package/templates/tools/format-markdown.sh +185 -0
@@ -0,0 +1,896 @@
1
+ # Phase 2: Implementation
2
+
3
+ This document describes the implementation phase workflow.
4
+
5
+ ---
6
+
7
+ ## Table of Contents
8
+
9
+ <!-- markdownlint-disable MD051 -->
10
+
11
+ 1. [Overview](#overview)
12
+ 2. [Goals](#goals)
13
+ 3. [TDD Workflow](#tdd-workflow)
14
+ 4. [Implementation Process](#implementation-process)
15
+ 5. [Code Quality](#code-quality)
16
+ 6. [Progress Tracking](#progress-tracking)
17
+ 7. [Common Issues](#common-issues)
18
+
19
+ <!-- markdownlint-enable MD051 -->
20
+
21
+ ---
22
+
23
+ ## Overview
24
+
25
+ **Phase 2** is the implementation phase where we build the feature following Test-Driven Development (TDD) principles.
26
+
27
+ **Duration:** Varies by feature (10-50+ hours)
28
+
29
+ **Key Principle:** Write tests first, implement incrementally, maintain quality.
30
+
31
+ ---
32
+
33
+ ## Goals
34
+
35
+ ### Primary Goals
36
+
37
+ 1. **Implement Features**: Build according to PDR acceptance criteria
38
+ 2. **Follow TDD**: Red → Green → Refactor cycle
39
+ 3. **Maintain Quality**: Clean code, comprehensive tests, documentation
40
+ 4. **Track Progress**: Update TODOs.md regularly
41
+ 5. **Stay Consistent**: Follow existing patterns exactly
42
+
43
+ ### Success Metrics
44
+
45
+ - ✅ All acceptance criteria met
46
+ - ✅ 90%+ test coverage
47
+ - ✅ All tests passing
48
+ - ✅ Lint and typecheck clean
49
+ - ✅ Code follows standards
50
+ - ✅ Documentation complete
51
+
52
+ ---
53
+
54
+ ## TDD Workflow
55
+
56
+ ### Red → Green → Refactor
57
+
58
+ **Every task follows this cycle:**
59
+
60
+ ```text
61
+
62
+ 1. RED: Write failing test
63
+ - Define expected behavior
64
+ - Test should fail (no implementation yet)
65
+
66
+ 2. GREEN: Write minimum code to pass
67
+ - Implement just enough
68
+ - Make test pass
69
+
70
+ 3. REFACTOR: Improve code
71
+ - Clean up implementation
72
+ - Maintain passing tests
73
+ - Improve design
74
+
75
+ ```text
76
+
77
+ ### Example Cycle
78
+
79
+ **RED:**
80
+
81
+ ```typescript
82
+ describe('EntityService', () => {
83
+ it('should create entity with valid data', async () => {
84
+ const input = {
85
+ name: 'Beach House',
86
+ type: 'house' as const,
87
+ capacity: 6,
88
+ pricePerNight: 150,
89
+ };
90
+
91
+ const result = await service.create({ input, user: hostUser });
92
+
93
+ expect(result.entity).toBeDefined();
94
+ expect(result.entity.name).toBe('Beach House');
95
+ });
96
+ });
97
+
98
+ // Test fails - method doesn't exist yet
99
+ ```text
100
+
101
+ **GREEN:**
102
+
103
+ ```typescript
104
+ async create({ input, user }) {
105
+ const entity = await this.model.create(input);
106
+ return { entity };
107
+ }
108
+
109
+ // Test passes!
110
+ ```text
111
+
112
+ **REFACTOR:**
113
+
114
+ ```typescript
115
+ async create({ input, user }) {
116
+ // Add validation
117
+ if (user.role !== 'host') {
118
+ throw new ServiceError('Only hosts can create', ServiceErrorCode.FORBIDDEN);
119
+ }
120
+
121
+ // Add business logic
122
+ const entityData = {
123
+ ...input,
124
+ hostId: user.id,
125
+ status: 'pending',
126
+ };
127
+
128
+ const entity = await this.model.create(entityData);
129
+
130
+ return { entity };
131
+ }
132
+
133
+ // Tests still pass!
134
+ ```text
135
+
136
+ ---
137
+
138
+ ## Implementation Process
139
+
140
+ ### Step 1: Review Context
141
+
142
+ **Before Starting:**
143
+
144
+ 1. **Read PDR.md**
145
+ - Understand acceptance criteria
146
+ - Review user stories
147
+ - Check constraints
148
+
149
+ 2. **Read tech-analysis.md**
150
+ - Understand technical approach
151
+ - Review architecture decisions
152
+ - Check design patterns
153
+
154
+ 3. **Check TODOs.md**
155
+ - Find current task
156
+ - Check dependencies
157
+ - Understand context
158
+
159
+ **Don't start coding without understanding the full context!**
160
+
161
+ ---
162
+
163
+ ### Step 2: Setup
164
+
165
+ **Per Task:**
166
+
167
+ 1. **Navigate to Package**
168
+
169
+ ```bash
170
+ cd packages/db # or packages/service-core, apps/api, etc.
171
+ ```
172
+
173
+ 2. **Create Branch** (if user wants)
174
+
175
+ ```bash
176
+ git checkout -b feature/{feature-name}
177
+ ```
178
+
179
+ 3. **Verify Dependencies**
180
+
181
+ - Check if dependent tasks are complete
182
+ - If blocked, work on parallel tasks
183
+
184
+ ---
185
+
186
+ ### Step 3: TDD Implementation
187
+
188
+ **Follow entity creation order:**
189
+
190
+ #### 1. Zod Schemas (packages/schemas)
191
+
192
+ **RED:**
193
+
194
+ ```typescript
195
+ // schemas.test.ts
196
+ describe('createEntitySchema', () => {
197
+ it('should validate valid input', () => {
198
+ const input = {
199
+ name: 'Beach House',
200
+ type: 'house',
201
+ capacity: 6,
202
+ pricePerNight: 150,
203
+ };
204
+
205
+ const result = createEntitySchema.safeParse(input);
206
+ expect(result.success).toBe(true);
207
+ });
208
+
209
+ it('should reject invalid capacity', () => {
210
+ const input = {
211
+ name: 'Beach House',
212
+ type: 'house',
213
+ capacity: 0, // Invalid!
214
+ pricePerNight: 150,
215
+ };
216
+
217
+ const result = createEntitySchema.safeParse(input);
218
+ expect(result.success).toBe(false);
219
+ });
220
+ });
221
+ ```text
222
+
223
+ **GREEN:**
224
+
225
+ ```typescript
226
+ export const createEntitySchema = z.object({
227
+ name: z.string().min(1).max(200),
228
+ type: z.enum(['house', 'apartment', 'room']),
229
+ capacity: z.number().int().positive().max(50),
230
+ pricePerNight: z.number().positive(),
231
+ });
232
+ ```text
233
+
234
+ **REFACTOR:**
235
+
236
+ ```typescript
237
+ // Add more validation, better error messages
238
+ export const createEntitySchema = z.object({
239
+ name: z.string()
240
+ .min(1, 'Name is required')
241
+ .max(200, 'Name too long'),
242
+ type: z.enum(['house', 'apartment', 'room'], {
243
+ errorMap: () => ({ message: 'Invalid entity type' }),
244
+ }),
245
+ capacity: z.number()
246
+ .int('Capacity must be integer')
247
+ .positive('Capacity must be positive')
248
+ .max(50, 'Maximum capacity is 50'),
249
+ pricePerNight: z.number()
250
+ .positive('Price must be positive')
251
+ .max(100000, 'Price too high'),
252
+ });
253
+
254
+ // Infer types
255
+ export type CreateEntityInput = z.infer<typeof createEntitySchema>;
256
+ ```text
257
+
258
+ #### 2. Drizzle Schema (packages/db/schemas)
259
+
260
+ ```typescript
261
+ export const entitys = pgTable('entitys', {
262
+ id: uuid('id').primaryKey().defaultRandom(),
263
+ name: varchar('name', { length: 200 }).notNull(),
264
+ type: varchar('type', { length: 50 }).notNull(),
265
+ capacity: integer('capacity').notNull(),
266
+ pricePerNight: numeric('price_per_night', { precision: 10, scale: 2 }).notNull(),
267
+ hostId: uuid('host_id').references(() => users.id).notNull(),
268
+ createdAt: timestamp('created_at').defaultNow().notNull(),
269
+ updatedAt: timestamp('updated_at').defaultNow().notNull(),
270
+ deletedAt: timestamp('deleted_at'),
271
+ });
272
+ ```text
273
+
274
+ #### 3. Model (packages/db/models)
275
+
276
+ **RED:**
277
+
278
+ ```typescript
279
+ describe('EntityModel', () => {
280
+ it('should create entity', async () => {
281
+ const model = new EntityModel(db);
282
+ const data = {
283
+ name: 'Beach House',
284
+ type: 'house',
285
+ capacity: 6,
286
+ pricePerNight: 150,
287
+ hostId: testUser.id,
288
+ };
289
+
290
+ const result = await model.create(data);
291
+
292
+ expect(result.id).toBeDefined();
293
+ expect(result.name).toBe('Beach House');
294
+ });
295
+ });
296
+ ```text
297
+
298
+ **GREEN:**
299
+
300
+ ```typescript
301
+ export class EntityModel extends BaseModel<Entity> {
302
+ protected table = entitys;
303
+ protected entityName = 'Entity';
304
+ }
305
+ ```text
306
+
307
+ **Tests pass! BaseModel provides create() method**
308
+
309
+ #### 4. Service (packages/service-core)
310
+
311
+ **RED:**
312
+
313
+ ```typescript
314
+ describe('EntityService', () => {
315
+ it('should create entity for host user', async () => {
316
+ const service = new EntityService(ctx);
317
+ const input = createTestEntity();
318
+ const user = createTestUser({ role: 'host' });
319
+
320
+ const result = await service.create({ input, user });
321
+
322
+ expect(result.entity).toBeDefined();
323
+ expect(result.entity.hostId).toBe(user.id);
324
+ });
325
+
326
+ it('should reject non-host users', async () => {
327
+ const service = new EntityService(ctx);
328
+ const input = createTestEntity();
329
+ const user = createTestUser({ role: 'guest' }); // Not a host!
330
+
331
+ await expect(
332
+ service.create({ input, user })
333
+ ).rejects.toThrow('Only hosts');
334
+ });
335
+ });
336
+ ```text
337
+
338
+ **GREEN + REFACTOR:**
339
+
340
+ ```typescript
341
+ export class EntityService extends BaseCrudService<...> {
342
+ constructor(ctx: ServiceContext, model?: EntityModel) {
343
+ super(ctx, model ?? new EntityModel(ctx.db));
344
+ }
345
+
346
+ async create({ input, user }: CreateParams) {
347
+ return this.runWithLoggingAndValidation(
348
+ 'create',
349
+ { input, user },
350
+ async () => {
351
+ // Business rule: Only hosts can create
352
+ if (user.role !== 'host') {
353
+ throw new ServiceError(
354
+ 'Only hosts can create entitys',
355
+ ServiceErrorCode.FORBIDDEN
356
+ );
357
+ }
358
+
359
+ // Set hostId to current user
360
+ const data = {
361
+ ...input,
362
+ hostId: user.id,
363
+ status: 'pending',
364
+ };
365
+
366
+ const entity = await this.model.create(data);
367
+
368
+ return { entity };
369
+ }
370
+ );
371
+ }
372
+ }
373
+ ```text
374
+
375
+ #### 5. API Routes (apps/api)
376
+
377
+ **RED (integration test):**
378
+
379
+ ```typescript
380
+ describe('POST /api/entitys', () => {
381
+ it('should create entity', async () => {
382
+ const input = {
383
+ name: 'Beach House',
384
+ type: 'house',
385
+ capacity: 6,
386
+ pricePerNight: 150,
387
+ };
388
+
389
+ const response = await app.request('/api/entitys', {
390
+ method: 'POST',
391
+ body: JSON.stringify(input),
392
+ headers: {
393
+ 'Authorization': `Bearer ${hostToken}`,
394
+ 'Content-Type': 'application/json',
395
+ },
396
+ });
397
+
398
+ expect(response.status).toBe(201);
399
+ const body = await response.json();
400
+ expect(body.success).toBe(true);
401
+ expect(body.data.entity.name).toBe('Beach House');
402
+ });
403
+ });
404
+ ```text
405
+
406
+ **GREEN:**
407
+
408
+ ```typescript
409
+ import { createCRUDRoute } from '../../factories/route-factory';
410
+ import { EntityService } from '@repo/service-core';
411
+ import {
412
+ createEntitySchema,
413
+ updateEntitySchema,
414
+ searchEntitySchema,
415
+ } from '@repo/schemas';
416
+
417
+ const crudRoute = createCRUDRoute({
418
+ service: EntityService,
419
+ schemas: {
420
+ create: createEntitySchema,
421
+ update: updateEntitySchema,
422
+ search: searchEntitySchema,
423
+ },
424
+ options: {
425
+ skipAuth: false,
426
+ permissions: ['entity:write'],
427
+ },
428
+ });
429
+
430
+ export default crudRoute;
431
+ ```text
432
+
433
+ #### 6. Frontend (apps/web or apps/admin)
434
+
435
+ **Component with tests:**
436
+
437
+ ```typescript
438
+ // EntityCard.test.tsx
439
+ describe('EntityCard', () => {
440
+ it('should render entity details', () => {
441
+ render(<EntityCard entity={mockData} />);
442
+
443
+ expect(screen.getByText('Beach House')).toBeInTheDocument();
444
+ expect(screen.getByText('$150 / night')).toBeInTheDocument();
445
+ });
446
+ });
447
+
448
+ // EntityCard.tsx
449
+ export const EntityCard = ({ entity }) => {
450
+ return (
451
+ <Card>
452
+ <CardHeader>
453
+ <CardTitle>{entity.name}</CardTitle>
454
+ </CardHeader>
455
+ <CardContent>
456
+ <p>${entity.pricePerNight} / night</p>
457
+ </CardContent>
458
+ </Card>
459
+ );
460
+ };
461
+ ```text
462
+
463
+ ---
464
+
465
+ ### Step 4: Continuous Verification
466
+
467
+ **After Each Task:**
468
+
469
+ 1. **Run Linter**
470
+
471
+ ```bash
472
+ pnpm lint
473
+ ```
474
+
475
+ Fix any issues immediately
476
+
477
+ 2. **Run Type Check**
478
+
479
+ ```bash
480
+ pnpm typecheck
481
+ ```
482
+
483
+ Fix type errors immediately
484
+
485
+ 3. **Run Tests**
486
+
487
+ ```bash
488
+ pnpm test
489
+ ```
490
+
491
+ Ensure all tests pass
492
+
493
+ 4. **Check Coverage**
494
+
495
+ ```bash
496
+ pnpm test:coverage
497
+ ```
498
+
499
+ Ensure 90%+ coverage
500
+
501
+ **Never move to next task with failing tests or lint errors!**
502
+
503
+ ---
504
+
505
+ ### Step 4.5: Task Completion with Git Commits
506
+
507
+ **After Each Task:**
508
+
509
+ When you've completed a task (tests pass, lint clean, code meets standards):
510
+
511
+ 1. **Review Changed Files**
512
+
513
+ ```bash
514
+ git status --short
515
+ ```
516
+
517
+ Analyze what files changed during this task.
518
+
519
+ **🔥 CRITICAL: Only Commit Task-Related Files**
520
+
521
+ **Rule:** ONLY include files that were modified during THIS specific task.
522
+
523
+ If `git status` shows unrelated modified files:
524
+ - ❌ **DO NOT** include them in this commit
525
+ - ❌ **DO NOT** use `git add .` or `git add -A`
526
+ - ✅ **ONLY** use `git add <specific-file>` for task files
527
+ - ⚠️ **WARN** user about unrelated changes
528
+
529
+ **Example:**
530
+
531
+ ```bash
532
+ # Task: "Create User model"
533
+ # git status shows:
534
+ M packages/db/src/models/user.model.ts ← INCLUDE (this task)
535
+ M packages/db/test/models/user.model.test.ts ← INCLUDE (this task)
536
+ M packages/api/routes/booking.ts ← EXCLUDE (different task)
537
+ M .env.local ← EXCLUDE (local config)
538
+
539
+ # Only commit task-related files:
540
+ git add packages/db/src/models/user.model.ts
541
+ git add packages/db/test/models/user.model.test.ts
542
+ ```
543
+
544
+ **If unrelated files detected:**
545
+
546
+ ```text
547
+ ⚠️ Warning: Unrelated modified files detected:
548
+ - packages/api/routes/booking.ts (not part of current task)
549
+ - .env.local (local configuration)
550
+
551
+ I will ONLY commit files related to the current task.
552
+ Unrelated files will remain uncommitted for their respective tasks.
553
+
554
+ Proceeding with task-related files only. OK? (yes/no)
555
+ ```
556
+
557
+ 2. **Generate Commit Suggestions**
558
+
559
+ Group ONLY task-related files into logical commits:
560
+ - Schema changes
561
+ - Model + tests
562
+ - Service + tests
563
+ - API routes
564
+ - Other changes
565
+
566
+ 3. **Present to User**
567
+
568
+ ```
569
+ 🎯 Task Completed: "{task_title}"
570
+
571
+ 📝 Changed Files:
572
+ M packages/db/src/models/user.model.ts
573
+ A packages/schemas/src/entities/user.schema.ts
574
+ M packages/db/test/models/user.model.test.ts
575
+
576
+ 💾 Suggested Commits:
577
+
578
+ 1. feat(schemas): add user validation schemas
579
+ git add packages/schemas/src/entities/user.schema.ts
580
+ git commit -m "..."
581
+
582
+ 2. feat(db): implement User model with tests
583
+ git add packages/db/src/models/user.model.ts packages/db/test/...
584
+ git commit -m "..."
585
+
586
+ Would you like me to:
587
+ 1. Execute these commits and mark task as complete
588
+ 2. Modify the commits first
589
+ 3. Skip commits (NOT RECOMMENDED)
590
+ ```
591
+
592
+ 4. **Execute Based on Response**
593
+
594
+ - **Option 1**: Execute commits → Mark complete in TODOs.md & GitHub
595
+ - **Option 2**: Ask for modifications → Regenerate → Present again
596
+ - **Option 3**: Warn user → Mark complete only if confirmed
597
+
598
+ 5. **Confirm Completion**
599
+
600
+ ```
601
+ ✅ Commits created:
602
+ • abc1234 feat(schemas): add user validation schemas
603
+ • def5678 feat(db): implement User model with tests
604
+
605
+ ✅ Task marked as completed!
606
+ 📝 TODOs.md updated
607
+ 🔗 GitHub: https://github.com/your-org/your-repo/issues/124
608
+
609
+ 💡 Don't forget to push: git push
610
+ ```
611
+
612
+ **IMPORTANT**: Code MUST be committed before marking task complete.
613
+ This ensures cross-device sync works correctly.
614
+
615
+ **See**: [Task Completion Protocol](./task-completion-protocol.md) for full details
616
+
617
+ ---
618
+
619
+ ### Step 5: Documentation
620
+
621
+ **For Each Component/Function:**
622
+
623
+ 1. **Write JSDoc**
624
+ - Purpose
625
+ - Parameters
626
+ - Return value
627
+ - Examples
628
+ - Side effects
629
+ - See also links
630
+
631
+ 2. **Update Comments**
632
+ - Explain WHY, not WHAT
633
+ - Document non-obvious decisions
634
+ - Add TODOs if needed
635
+
636
+ ---
637
+
638
+ ### Step 6: Update Progress
639
+
640
+ #### 🔥 CRITICAL: Update ALL State Files After Completing Each Task
641
+
642
+ When you complete ANY task during Phase 2, you MUST immediately update all state tracking files:
643
+
644
+ **Required State Updates:**
645
+
646
+ 1. **Mark Complete in TODOs.md**
647
+
648
+ ```markdown
649
+ - [x] **[1h]** Create EntityModel
650
+ - Completed: 2024-01-15 by @db-engineer
651
+ - Actual time: 1.2h
652
+ - Notes: Added custom findAll override
653
+ ```
654
+
655
+ 2. **Update .checkpoint.json**
656
+
657
+ ```json
658
+ {
659
+ "currentPhase": "phase-2-implementation",
660
+ "tasks": {
661
+ "T-001": {
662
+ "id": "T-001",
663
+ "title": "Create EntityModel",
664
+ "status": "completed",
665
+ "started": "2024-01-15T10:00:00Z",
666
+ "completed": "2024-01-15T11:12:00Z",
667
+ "estimated": "1h",
668
+ "actual": "1.2h"
669
+ }
670
+ },
671
+ "progress": {
672
+ "total": 45,
673
+ "completed": 12,
674
+ "inProgress": 2,
675
+ "notStarted": 31,
676
+ "percentage": 26.7
677
+ },
678
+ "lastUpdated": "2024-01-15T11:12:00Z"
679
+ }
680
+ ```
681
+
682
+ 3. **Update .github-workflow/tracking.json**
683
+
684
+ ```json
685
+ {
686
+ "sessionId": "P-001-entity-system",
687
+ "issues": {
688
+ "HOSP-124": {
689
+ "id": "HOSP-124",
690
+ "linearId": "abc-123-def-456",
691
+ "status": "done",
692
+ "title": "Create EntityModel",
693
+ "lastSync": "2024-01-15T11:12:00Z",
694
+ "syncStatus": "synced"
695
+ }
696
+ },
697
+ "metadata": {
698
+ "totalIssues": 45,
699
+ "completedIssues": 12,
700
+ "lastSync": "2024-01-15T11:12:00Z"
701
+ }
702
+ }
703
+ ```
704
+
705
+ 4. **Update Progress Summary in TODOs.md**
706
+
707
+ ```markdown
708
+ ## Progress Summary
709
+
710
+ - Total: 45 tasks
711
+ - Completed: 12 (27%) ⬅️ UPDATE THIS
712
+ - In Progress: 2
713
+ - Not Started: 31
714
+
715
+ Last Updated: 2024-01-15 11:12:00
716
+ ```
717
+
718
+ 5. **Document Decisions**
719
+
720
+ ```markdown
721
+ ### YYYY-MM-DD
722
+
723
+ - Decided to use composite index instead of separate indexes
724
+ - Reason: Better query performance for common use case
725
+ ```
726
+
727
+ 6. **Commit State Updates**
728
+
729
+ ```bash
730
+ git add .claude/sessions/planning/{feature}/TODOs.md
731
+ git add .claude/sessions/planning/{feature}/.checkpoint.json
732
+ git add .github-workflow/tracking.json
733
+ git commit -m "docs: update progress - T-001 completed (12/45)"
734
+ ```
735
+
736
+ **⚠️ CRITICAL RULES:**
737
+
738
+ - Update state files **IMMEDIATELY** after completing each task
739
+ - **NEVER** batch state updates for multiple tasks
740
+ - **NEVER** skip state updates "to save time"
741
+ - **ALWAYS** commit state changes separately from code changes
742
+ - **ALWAYS** keep the three files in sync (TODOs.md, .checkpoint.json, .github-workflow/tracking.json)
743
+
744
+ **Why This Matters:**
745
+
746
+ - Enables cross-device workflow (switch machines and continue)
747
+ - Provides accurate progress tracking
748
+ - Maintains sync with GitHub
749
+ - Prevents lost work tracking
750
+ - Allows team visibility
751
+
752
+ **See Also:** [Task Completion Protocol](./task-completion-protocol.md) for full details
753
+
754
+ ---
755
+
756
+ ## Code Quality
757
+
758
+ ### Before Committing
759
+
760
+ - [ ] Code follows standards
761
+ - [ ] All exports have JSDoc
762
+ - [ ] Tests written and passing
763
+ - [ ] Coverage ≥ 90%
764
+ - [ ] Lint passing
765
+ - [ ] TypeCheck passing
766
+ - [ ] No console.logs left
767
+ - [ ] No commented code
768
+ - [ ] Files under 500 lines
769
+ - [ ] Follows existing patterns
770
+
771
+ ### Code Review Yourself
772
+
773
+ Before submitting, review your own code:
774
+
775
+ 1. Read through all changes
776
+ 2. Check for improvements
777
+ 3. Verify consistency
778
+ 4. Look for edge cases
779
+ 5. Check error handling
780
+
781
+ ---
782
+
783
+ ## Progress Tracking
784
+
785
+ ### Daily Updates
786
+
787
+ **At End of Day:**
788
+
789
+ 1. Update TODOs.md
790
+ 2. Mark completed tasks
791
+ 3. Note blockers
792
+ 4. Plan tomorrow
793
+
794
+ **Format:**
795
+
796
+ ```markdown
797
+
798
+ ### 2024-01-15
799
+
800
+ **Completed:**
801
+
802
+ - Created EntityModel
803
+ - Created EntityService base
804
+ - Wrote 15 unit tests
805
+
806
+ **In Progress:**
807
+
808
+ - Implementing availability check logic
809
+
810
+ **Blockers:**
811
+
812
+ - Need clarification on discount rules
813
+
814
+ **Next Steps:**
815
+
816
+ - Complete availability check
817
+ - Start price calculation
818
+ - Add integration tests
819
+
820
+ ```text
821
+
822
+ ---
823
+
824
+ ## Common Issues
825
+
826
+ ### Issue 1: Breaking Existing Tests
827
+
828
+ **Problem:** New code breaks unrelated tests
829
+
830
+ **Solution:**
831
+
832
+ - Run full test suite frequently
833
+ - Fix immediately
834
+ - Don't accumulate technical debt
835
+
836
+ ### Issue 2: Skipping Tests
837
+
838
+ **Problem:** "I'll add tests later"
839
+
840
+ **Consequence:** Tests never added, bugs introduced
841
+
842
+ **Solution:** TDD is mandatory. No exceptions.
843
+
844
+ ### Issue 3: Large Commits
845
+
846
+ **Problem:** Committing 10 tasks at once
847
+
848
+ **Solution:** Commit per task or per logical unit
849
+
850
+ ### Issue 4: Deviating from Plan
851
+
852
+ **Problem:** Adding unplanned features
853
+
854
+ **Solution:**
855
+
856
+ - Stick to plan
857
+ - If changes needed, update PDR and get approval
858
+ - Don't scope creep
859
+
860
+ ### Issue 5: Not Following Patterns
861
+
862
+ **Problem:** Reinventing patterns instead of reusing
863
+
864
+ **Solution:**
865
+
866
+ - Review similar code first
867
+ - Follow existing patterns exactly
868
+ - Prefer modification over reimplementation
869
+
870
+ ---
871
+
872
+ ## Summary Checklist
873
+
874
+ Per Task:
875
+
876
+ - [ ] Tests written first (RED)
877
+ - [ ] Code implements tests (GREEN)
878
+ - [ ] Code refactored (REFACTOR)
879
+ - [ ] Lint passing
880
+ - [ ] TypeCheck passing
881
+ - [ ] Coverage ≥ 90%
882
+ - [ ] JSDoc complete
883
+ - [ ] Progress updated
884
+ - [ ] No blockers
885
+
886
+ Per Day:
887
+
888
+ - [ ] All completed tasks marked
889
+ - [ ] Progress metrics updated
890
+ - [ ] Blockers documented
891
+ - [ ] Tomorrow planned
892
+
893
+ ---
894
+
895
+ **Remember: Quality > Speed. Take time to do it right the first time.**
896
+