@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,800 @@
1
+ # Technical Analysis
2
+
3
+ ## {Feature Name}
4
+
5
+ **Date**: YYYY-MM-DD
6
+ **Related PDR**: [PDR.md](./PDR.md)
7
+ **Status**: Draft | In Review | Approved | Implemented
8
+ **Tech Lead**: {Name}
9
+
10
+ ---
11
+
12
+ ## 1. Executive Summary
13
+
14
+ **Feature Overview:**
15
+ {1-2 paragraph summary of what we're building}
16
+
17
+ **Technical Approach:**
18
+ {High-level summary of the technical solution}
19
+
20
+ **Key Decisions:**
21
+
22
+ 1. {Decision 1}
23
+ 2. {Decision 2}
24
+ 3. {Decision 3}
25
+
26
+ **Estimated Complexity**: Low | Medium | High | Very High
27
+
28
+ **Estimated Timeline**: {X} days/weeks
29
+
30
+ ---
31
+
32
+ ## 2. Architecture Overview
33
+
34
+ ### 2.1 System Architecture
35
+
36
+ ```mermaid
37
+ graph TB
38
+ Client[Client Apps]
39
+ API[API Layer]
40
+ Service[Service Layer]
41
+ DB[(Database)]
42
+
43
+ Client -->|HTTP/REST| API
44
+ API -->|Business Logic| Service
45
+ Service -->|Drizzle ORM| DB
46
+
47
+ subgraph "Apps"
48
+ Web[Web - Astro]
49
+ Admin[Admin - TanStack Start]
50
+ end
51
+
52
+ subgraph "Backend"
53
+ Hono[Hono Routes]
54
+ Services[Services]
55
+ Models[Models]
56
+ end
57
+
58
+ Client --> Web
59
+ Client --> Admin
60
+ API --> Hono
61
+ Service --> Services
62
+ Service --> Models
63
+ ```text
64
+
65
+ **Description:**
66
+ {Explain the architecture and how components interact}
67
+
68
+ ### 2.2 Data Flow
69
+
70
+ ```mermaid
71
+ sequenceDiagram
72
+ participant User
73
+ participant Frontend
74
+ participant API
75
+ participant Service
76
+ participant Database
77
+
78
+ User->>Frontend: Action
79
+ Frontend->>API: HTTP Request
80
+ API->>Service: Business Logic
81
+ Service->>Database: Query
82
+ Database-->>Service: Result
83
+ Service-->>API: Response
84
+ API-->>Frontend: JSON
85
+ Frontend-->>User: UI Update
86
+ ```text
87
+
88
+ **Flow Description:**
89
+ {Explain the data flow step by step}
90
+
91
+ ---
92
+
93
+ ## 3. Technical Stack
94
+
95
+ ### 3.1 Technologies Used
96
+
97
+ | Layer | Technology | Version | Why Chosen |
98
+ |-------|-----------|---------|------------|
99
+ | Frontend (Web) | Astro | {version} | {reason} |
100
+ | Frontend (Admin) | TanStack Start | {version} | {reason} |
101
+ | UI Components | React 19 | {version} | {reason} |
102
+ | Styling | Tailwind + Shadcn | {version} | {reason} |
103
+ | Backend | Hono | {version} | {reason} |
104
+ | Database | PostgreSQL | {version} | {reason} |
105
+ | ORM | Drizzle | {version} | {reason} |
106
+ | Validation | Zod | {version} | {reason} |
107
+
108
+ ### 3.2 New Dependencies
109
+
110
+ **Packages to Add:**
111
+
112
+ ```json
113
+ {
114
+ "dependencies": {
115
+ "{package-name}": "{version}"
116
+ },
117
+ "devDependencies": {
118
+ "{package-name}": "{version}"
119
+ }
120
+ }
121
+ ```text
122
+
123
+ **Justification:**
124
+
125
+ - **{package-name}**: {Why needed, alternatives considered, bundle size impact}
126
+
127
+ **Bundle Impact:**
128
+
129
+ - Current size: {X} KB
130
+ - After additions: {Y} KB
131
+ - Increase: {Z} KB ({percentage}%)
132
+
133
+ ---
134
+
135
+ ## 4. Database Design
136
+
137
+ ### 4.1 Schema Changes
138
+
139
+ #### New Tables
140
+
141
+ ```typescript
142
+ // packages/db/src/schemas/{entity}/{entity}.schema.ts
143
+
144
+ export const {tableName} = pgTable("{table_name}", {
145
+ id: uuid("id").primaryKey().defaultRandom(),
146
+ {field1}: varchar("{field1}", { length: 255 }).notNull(),
147
+ {field2}: integer("{field2}").notNull(),
148
+ {field3}: text("{field3}"),
149
+
150
+ // Relationships
151
+ {foreignKey}: uuid("{foreign_key}").references(() => {otherTable}.id),
152
+
153
+ // Audit fields
154
+ createdAt: timestamp("created_at").defaultNow().notNull(),
155
+ updatedAt: timestamp("updated_at").defaultNow().notNull(),
156
+ deletedAt: timestamp("deleted_at"),
157
+ });
158
+ ```text
159
+
160
+ #### Modified Tables
161
+
162
+ **Table**: {table_name}
163
+
164
+ - **Add columns**: {column1}, {column2}
165
+ - **Modify columns**: {column} - {old type} → {new type}
166
+ - **Remove columns**: {column} (reason: {why})
167
+
168
+ ### 4.2 Relationships
169
+
170
+ ```mermaid
171
+ erDiagram
172
+ ENTITY_A ||--o{ ENTITY_B : has
173
+ ENTITY_B }o--|| ENTITY_C : belongs_to
174
+
175
+ ENTITY_A {
176
+ uuid id PK
177
+ string field1
178
+ timestamp created_at
179
+ }
180
+
181
+ ENTITY_B {
182
+ uuid id PK
183
+ uuid entity_a_id FK
184
+ uuid entity_c_id FK
185
+ }
186
+
187
+ ENTITY_C {
188
+ uuid id PK
189
+ string name
190
+ }
191
+ ```text
192
+
193
+ **Relationship Details:**
194
+
195
+ - {Entity A} → {Entity B}: {Type of relationship and why}
196
+ - {Entity B} → {Entity C}: {Type of relationship and why}
197
+
198
+ ### 4.3 Indexes
199
+
200
+ **New Indexes:**
201
+
202
+ ```sql
203
+ CREATE INDEX idx_{table}_{column} ON {table}({column});
204
+ CREATE INDEX idx_{table}_{col1}_{col2} ON {table}({col1}, {col2});
205
+ ```text
206
+
207
+ **Justification:**
208
+
209
+ - **idx_{table}_{column}**: {Query pattern that benefits, expected improvement}
210
+
211
+ ### 4.4 Migrations
212
+
213
+ **Migration Strategy:**
214
+
215
+ 1. {Step 1}
216
+ 2. {Step 2}
217
+ 3. {Step 3}
218
+
219
+ **Rollback Plan:**
220
+
221
+ - {How to rollback if needed}
222
+
223
+ **Data Migration:**
224
+
225
+ - Existing data: {How to migrate/transform}
226
+ - Default values: {For new fields}
227
+
228
+ ---
229
+
230
+ ## 5. API Design
231
+
232
+ ### 5.1 Endpoints
233
+
234
+ #### Endpoint 1: Create {Entity}
235
+
236
+ ```text
237
+ POST /api/{entities}
238
+ ```text
239
+
240
+ **Request:**
241
+
242
+ ```typescript
243
+ {
244
+ field1: string;
245
+ field2: number;
246
+ field3?: string;
247
+ }
248
+ ```text
249
+
250
+ **Response:**
251
+
252
+ ```typescript
253
+ {
254
+ success: true;
255
+ data: {
256
+ id: string;
257
+ field1: string;
258
+ field2: number;
259
+ createdAt: string;
260
+ }
261
+ }
262
+ ```text
263
+
264
+ **Authentication**: Required | Public
265
+ **Authorization**: {Roles/permissions}
266
+ **Rate Limit**: {X} requests per minute
267
+
268
+ ---
269
+
270
+ #### Endpoint 2: Get {Entity}
271
+
272
+ ```text
273
+ GET /api/{entities}/:id
274
+ ```text
275
+
276
+ **Response:**
277
+
278
+ ```typescript
279
+ {
280
+ success: true;
281
+ data: {
282
+ id: string;
283
+ field1: string;
284
+ field2: number;
285
+ // ... all fields
286
+ }
287
+ }
288
+ ```text
289
+
290
+ ---
291
+
292
+ #### Endpoint 3: List {Entities}
293
+
294
+ ```text
295
+ GET /api/{entities}?page=1&pageSize=20&orderBy=createdAt&order=desc
296
+ ```text
297
+
298
+ **Query Parameters:**
299
+
300
+ - `page`: number (default: 1)
301
+ - `pageSize`: number (default: 20, max: 100)
302
+ - `orderBy`: string (default: "createdAt")
303
+ - `order`: "asc" | "desc" (default: "desc")
304
+ - `q`: string (search query)
305
+
306
+ **Response:**
307
+
308
+ ```typescript
309
+ {
310
+ success: true;
311
+ data: {
312
+ items: Entity[];
313
+ pagination: {
314
+ page: number;
315
+ pageSize: number;
316
+ total: number;
317
+ totalPages: number;
318
+ }
319
+ }
320
+ }
321
+ ```text
322
+
323
+ ---
324
+
325
+ ### 5.2 Error Handling
326
+
327
+ **Error Response Format:**
328
+
329
+ ```typescript
330
+ {
331
+ success: false;
332
+ error: {
333
+ code: string;
334
+ message: string;
335
+ details?: any;
336
+ }
337
+ }
338
+ ```text
339
+
340
+ **Error Codes:**
341
+
342
+ - `VALIDATION_ERROR` (400): Input validation failed
343
+ - `UNAUTHORIZED` (401): Not authenticated
344
+ - `FORBIDDEN` (403): Not authorized
345
+ - `NOT_FOUND` (404): Resource not found
346
+ - `CONFLICT` (409): Resource already exists
347
+ - `INTERNAL_ERROR` (500): Server error
348
+
349
+ ---
350
+
351
+ ## 6. Service Layer Design
352
+
353
+ ### 6.1 Service Structure
354
+
355
+ ```typescript
356
+ // packages/service-core/src/services/{entity}/{entity}.service.ts
357
+
358
+ export class {Entity}Service extends BaseCrudService<
359
+ {Entity},
360
+ {Entity}Model,
361
+ Create{Entity}Schema,
362
+ Update{Entity}Schema,
363
+ Search{Entity}Schema
364
+ > {
365
+ constructor(ctx: ServiceContext, model?: {Entity}Model) {
366
+ super(ctx, model ?? new {Entity}Model(ctx.db));
367
+ }
368
+
369
+ // Custom methods
370
+ async customMethod({ input }: { input: CustomInput }): Promise<CustomOutput> {
371
+ return this.runWithLoggingAndValidation(
372
+ "customMethod",
373
+ { input },
374
+ async () => {
375
+ // Implementation
376
+ }
377
+ );
378
+ }
379
+ }
380
+ ```text
381
+
382
+ ### 6.2 Business Logic
383
+
384
+ **Validation Rules:**
385
+
386
+ 1. {Rule 1}
387
+ 2. {Rule 2}
388
+ 3. {Rule 3}
389
+
390
+ **Business Rules:**
391
+
392
+ 1. {Rule 1 and implementation}
393
+ 2. {Rule 2 and implementation}
394
+
395
+ **Transactions:**
396
+
397
+ - {Operation 1}: Requires transaction because {reason}
398
+ - {Operation 2}: Requires transaction because {reason}
399
+
400
+ ---
401
+
402
+ ## 7. Frontend Implementation
403
+
404
+ ### 7.1 Components Structure
405
+
406
+ ```text
407
+ apps/web/src/components/{feature}/
408
+ ├── {Feature}List.tsx
409
+ ├── {Feature}Card.tsx
410
+ ├── {Feature}Form.tsx
411
+ └── {Feature}Detail.tsx
412
+ ```text
413
+
414
+ **Components:**
415
+
416
+ #### {Feature}List
417
+
418
+ - **Purpose**: {What it does}
419
+ - **Props**: {List props}
420
+ - **State**: {What state it manages}
421
+ - **Queries**: {TanStack Query hooks used}
422
+
423
+ #### {Feature}Form
424
+
425
+ - **Purpose**: {What it does}
426
+ - **Props**: {List props}
427
+ - **Validation**: Client-side with Zod
428
+ - **Submit**: {How it submits}
429
+
430
+ ### 7.2 State Management
431
+
432
+ **TanStack Query:**
433
+
434
+ ```typescript
435
+ // Query keys
436
+ const queryKeys = {
437
+ all: ['{entity}'] as const,
438
+ lists: () => [...queryKeys.all, 'list'] as const,
439
+ list: (filters: Filters) => [...queryKeys.lists(), filters] as const,
440
+ details: () => [...queryKeys.all, 'detail'] as const,
441
+ detail: (id: string) => [...queryKeys.details(), id] as const,
442
+ };
443
+
444
+ // Queries
445
+ const use{Entity}Query = (id: string) => {
446
+ return useQuery({
447
+ queryKey: queryKeys.detail(id),
448
+ queryFn: () => fetch{Entity}(id),
449
+ });
450
+ };
451
+
452
+ // Mutations
453
+ const useCreate{Entity}Mutation = () => {
454
+ return useMutation({
455
+ mutationFn: create{Entity},
456
+ onSuccess: () => {
457
+ queryClient.invalidateQueries({ queryKey: queryKeys.lists() });
458
+ },
459
+ });
460
+ };
461
+ ```text
462
+
463
+ ### 7.3 Routing
464
+
465
+ **Web App (Astro):**
466
+
467
+ ```text
468
+ apps/web/src/pages/
469
+ └── {feature}/
470
+ ├── index.astro # List view
471
+ ├── [id].astro # Detail view
472
+ └── new.astro # Create view
473
+ ```text
474
+
475
+ **Admin App (TanStack Start):**
476
+
477
+ ```typescript
478
+ // apps/admin/src/routes/{feature}/
479
+ export const Route = createFileRoute('/{feature}/')({
480
+ component: {Feature}List,
481
+ loader: async () => {
482
+ // Preload data
483
+ },
484
+ });
485
+ ```text
486
+
487
+ ---
488
+
489
+ ## 8. Integration Points
490
+
491
+ ### 8.1 Internal Integrations
492
+
493
+ **Package Dependencies:**
494
+
495
+ - `@repo/schemas` - Validation schemas
496
+ - `@repo/db` - Database models
497
+ - `@repo/service-core` - Business logic
498
+ - `@repo/utils` - Utility functions
499
+
500
+ **Service Dependencies:**
501
+
502
+ - {Service 1}: {Why needed, how used}
503
+ - {Service 2}: {Why needed, how used}
504
+
505
+ ### 8.2 External Integrations
506
+
507
+ **Third-Party Services:**
508
+
509
+ #### {Service Name}
510
+
511
+ - **Purpose**: {Why we use it}
512
+ - **Integration point**: {Where in our code}
513
+ - **Error handling**: {How we handle failures}
514
+ - **Fallback**: {What happens if unavailable}
515
+
516
+ ---
517
+
518
+ ## 9. Security Considerations
519
+
520
+ ### 9.1 Authentication & Authorization
521
+
522
+ **Authentication:**
523
+
524
+ - Provider: Clerk
525
+ - Flow: {Auth flow description}
526
+ - Token handling: {How tokens are managed}
527
+
528
+ **Authorization:**
529
+
530
+ - Role-based: Yes
531
+ - Roles required: {List roles}
532
+ - Permissions: {List permissions}
533
+ - Permission checks: {Where and how}
534
+
535
+ ### 9.2 Input Validation
536
+
537
+ **Client-Side:**
538
+
539
+ - Zod schemas
540
+ - Real-time validation
541
+ - User-friendly error messages
542
+
543
+ **Server-Side:**
544
+
545
+ - Zod validation with `zValidator` middleware
546
+ - SQL injection prevention (Drizzle parameterized queries)
547
+ - XSS prevention (input sanitization)
548
+
549
+ ### 9.3 Data Protection
550
+
551
+ **Sensitive Data:**
552
+
553
+ - {Type of sensitive data}
554
+ - Encryption: {At rest | In transit}
555
+ - Access control: {Who can access}
556
+
557
+ **PII Handling:**
558
+
559
+ - {How PII is collected}
560
+ - {How PII is stored}
561
+ - {How PII is accessed}
562
+ - {Retention policy}
563
+
564
+ ---
565
+
566
+ ## 10. Performance Considerations
567
+
568
+ ### 10.1 Database Optimization
569
+
570
+ **Query Optimization:**
571
+
572
+ - Indexes: {List indexes and rationale}
573
+ - Query patterns: {Common queries and optimization}
574
+ - Pagination: Cursor-based | Offset-based
575
+
576
+ **Expected Load:**
577
+
578
+ - Reads per second: {X}
579
+ - Writes per second: {Y}
580
+ - Concurrent users: {Z}
581
+
582
+ ### 10.2 API Performance
583
+
584
+ **Caching Strategy:**
585
+
586
+ - Cache what: {What to cache}
587
+ - Cache where: {Client | CDN | Server}
588
+ - TTL: {Time to live}
589
+ - Invalidation: {When to invalidate}
590
+
591
+ **Rate Limiting:**
592
+
593
+ - Limit: {X} requests per {time}
594
+ - Strategy: {Per user | Per IP | Global}
595
+
596
+ ### 10.3 Frontend Performance
597
+
598
+ **Bundle Size:**
599
+
600
+ - Component size: {X} KB
601
+ - Dependencies: {Y} KB
602
+ - Total impact: {Z} KB
603
+
604
+ **Loading Strategy:**
605
+
606
+ - Critical path: {What loads first}
607
+ - Lazy loading: {What loads on demand}
608
+ - Code splitting: {How code is split}
609
+
610
+ **Rendering:**
611
+
612
+ - SSR: {What is server-rendered}
613
+ - Client hydration: {What hydrates}
614
+ - Islands: {What uses islands architecture}
615
+
616
+ ---
617
+
618
+ ## 11. Testing Strategy
619
+
620
+ ### 11.1 Test Coverage
621
+
622
+ **Unit Tests (90%+ coverage):**
623
+
624
+ - Models: {Test scenarios}
625
+ - Services: {Test scenarios}
626
+ - Utilities: {Test scenarios}
627
+
628
+ **Integration Tests:**
629
+
630
+ - API endpoints: {Test scenarios}
631
+ - Service integration: {Test scenarios}
632
+
633
+ **E2E Tests:**
634
+
635
+ - User flow 1: {Scenario}
636
+ - User flow 2: {Scenario}
637
+
638
+ ### 11.2 Test Data
639
+
640
+ **Fixtures:**
641
+
642
+ - {Fixture 1}: {Purpose}
643
+ - {Fixture 2}: {Purpose}
644
+
645
+ **Mocks:**
646
+
647
+ - {Mock 1}: {What's mocked and why}
648
+ - {Mock 2}: {What's mocked and why}
649
+
650
+ ---
651
+
652
+ ## 12. Deployment Strategy
653
+
654
+ ### 12.1 Deployment Plan
655
+
656
+ **Deployment Type**: {Big Bang | Phased | Feature Flag | Canary}
657
+
658
+ **Steps:**
659
+
660
+ 1. {Step 1}
661
+ 2. {Step 2}
662
+ 3. {Step 3}
663
+
664
+ **Environment Variables:**
665
+
666
+ ```bash
667
+
668
+ # New variables to add
669
+
670
+ {VAR_NAME}={description}
671
+ {VAR_NAME_2}={description}
672
+ ```text
673
+
674
+ ### 12.2 Database Migration
675
+
676
+ **Migration Script:**
677
+
678
+ ```bash
679
+
680
+ # Run migration
681
+
682
+ pnpm db:migrate
683
+ ```text
684
+
685
+ **Verification:**
686
+
687
+ 1. {Verification step 1}
688
+ 2. {Verification step 2}
689
+
690
+ **Rollback:**
691
+
692
+ ```sql
693
+ -- Rollback script if needed
694
+ {rollback SQL}
695
+ ```text
696
+
697
+ ### 12.3 Monitoring
698
+
699
+ **Metrics to Monitor:**
700
+
701
+ - API response time: {endpoint} < {X}ms
702
+ - Database query time: < {Y}ms
703
+ - Error rate: < {Z}%
704
+ - User actions: {specific actions to track}
705
+
706
+ **Alerts:**
707
+
708
+ - {Metric} > {threshold}: {Action to take}
709
+ - {Error type}: {Action to take}
710
+
711
+ ---
712
+
713
+ ## 13. Technical Risks
714
+
715
+ ### Risk 1: {Risk Name}
716
+
717
+ **Probability**: High | Medium | Low
718
+ **Impact**: High | Medium | Low
719
+
720
+ **Description:**
721
+ {What could go wrong}
722
+
723
+ **Mitigation:**
724
+ {How we'll prevent or handle it}
725
+
726
+ **Contingency:**
727
+ {Backup plan if it happens}
728
+
729
+ ---
730
+
731
+ ### Risk 2: {Risk Name}
732
+
733
+ {Continue with additional risks}
734
+
735
+ ---
736
+
737
+ ## 14. Technical Debt
738
+
739
+ **Known Debt:**
740
+
741
+ 1. {Debt item 1} - {Plan to address} - {When}
742
+ 2. {Debt item 2} - {Plan to address} - {When}
743
+
744
+ **Acceptable Tradeoffs:**
745
+
746
+ - {Tradeoff 1}: {Why acceptable}
747
+ - {Tradeoff 2}: {Why acceptable}
748
+
749
+ ---
750
+
751
+ ## 15. Open Questions
752
+
753
+ **Q1**: {Technical question}
754
+ **Status**: Open | Resolved
755
+ **Resolution**: {Answer if resolved}
756
+
757
+ **Q2**: {Technical question}
758
+ **Status**: Open | Resolved
759
+ **Resolution**: {Answer if resolved}
760
+
761
+ ---
762
+
763
+ ## 16. Implementation Checklist
764
+
765
+ - [ ] Database schema designed
766
+ - [ ] Zod schemas created
767
+ - [ ] Drizzle models implemented
768
+ - [ ] Services implemented
769
+ - [ ] API routes created
770
+ - [ ] Frontend components built
771
+ - [ ] Tests written (90%+ coverage)
772
+ - [ ] Documentation updated
773
+ - [ ] Security review passed
774
+ - [ ] Performance review passed
775
+ - [ ] Deployment plan ready
776
+
777
+ ---
778
+
779
+ ## 17. Related Documents
780
+
781
+ - [PDR (Product Design Requirements)](./PDR.md)
782
+ - [TODOs & Task Breakdown](./TODOs.md)
783
+ - [Code Review Report](./code-review.md) *(after implementation)*
784
+
785
+ ---
786
+
787
+ ## 18. Changelog
788
+
789
+ | Date | Author | Changes | Version |
790
+ |------|--------|---------|---------|
791
+ | YYYY-MM-DD | {Name} | Initial draft | 0.1 |
792
+ | YYYY-MM-DD | {Name} | Added architecture diagrams | 0.2 |
793
+ | YYYY-MM-DD | {Name} | Finalized technical approach | 1.0 |
794
+
795
+ ---
796
+
797
+ **Status**: {Draft | In Review | Approved | Implemented}
798
+ **Next Steps**: {What happens next}
799
+ **Owner**: {Who is responsible}
800
+