specsmd 0.0.1

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 (83) hide show
  1. package/README.md +300 -0
  2. package/bin/cli.js +21 -0
  3. package/flows/aidlc/README.md +372 -0
  4. package/flows/aidlc/agents/construction-agent.md +81 -0
  5. package/flows/aidlc/agents/inception-agent.md +95 -0
  6. package/flows/aidlc/agents/master-agent.md +61 -0
  7. package/flows/aidlc/agents/operations-agent.md +89 -0
  8. package/flows/aidlc/commands/construction-agent.md +63 -0
  9. package/flows/aidlc/commands/inception-agent.md +55 -0
  10. package/flows/aidlc/commands/master-agent.md +47 -0
  11. package/flows/aidlc/commands/operations-agent.md +77 -0
  12. package/flows/aidlc/context-config.yaml +41 -0
  13. package/flows/aidlc/memory-bank.yaml +104 -0
  14. package/flows/aidlc/quick-start.md +315 -0
  15. package/flows/aidlc/skills/construction/bolt-list.md +163 -0
  16. package/flows/aidlc/skills/construction/bolt-replan.md +343 -0
  17. package/flows/aidlc/skills/construction/bolt-start.md +289 -0
  18. package/flows/aidlc/skills/construction/bolt-status.md +185 -0
  19. package/flows/aidlc/skills/construction/navigator.md +196 -0
  20. package/flows/aidlc/skills/inception/bolt-plan.md +338 -0
  21. package/flows/aidlc/skills/inception/context.md +171 -0
  22. package/flows/aidlc/skills/inception/intent-create.md +211 -0
  23. package/flows/aidlc/skills/inception/intent-list.md +124 -0
  24. package/flows/aidlc/skills/inception/navigator.md +207 -0
  25. package/flows/aidlc/skills/inception/requirements.md +227 -0
  26. package/flows/aidlc/skills/inception/review.md +248 -0
  27. package/flows/aidlc/skills/inception/story-create.md +304 -0
  28. package/flows/aidlc/skills/inception/units.md +271 -0
  29. package/flows/aidlc/skills/master/analyze-context.md +132 -0
  30. package/flows/aidlc/skills/master/answer-question.md +141 -0
  31. package/flows/aidlc/skills/master/explain-flow.md +146 -0
  32. package/flows/aidlc/skills/master/project-init.md +281 -0
  33. package/flows/aidlc/skills/master/route-request.md +126 -0
  34. package/flows/aidlc/skills/operations/build.md +237 -0
  35. package/flows/aidlc/skills/operations/deploy.md +259 -0
  36. package/flows/aidlc/skills/operations/monitor.md +265 -0
  37. package/flows/aidlc/skills/operations/navigator.md +209 -0
  38. package/flows/aidlc/skills/operations/verify.md +224 -0
  39. package/flows/aidlc/templates/construction/bolt-template.md +193 -0
  40. package/flows/aidlc/templates/construction/bolt-types/bdd-construction-bolt.md +250 -0
  41. package/flows/aidlc/templates/construction/bolt-types/ddd-construction-bolt/adr-template.md +49 -0
  42. package/flows/aidlc/templates/construction/bolt-types/ddd-construction-bolt/ddd-01-domain-model-template.md +55 -0
  43. package/flows/aidlc/templates/construction/bolt-types/ddd-construction-bolt/ddd-02-technical-design-template.md +67 -0
  44. package/flows/aidlc/templates/construction/bolt-types/ddd-construction-bolt/ddd-03-test-report-template.md +62 -0
  45. package/flows/aidlc/templates/construction/bolt-types/ddd-construction-bolt.md +528 -0
  46. package/flows/aidlc/templates/construction/bolt-types/simple-construction-bolt.md +273 -0
  47. package/flows/aidlc/templates/construction/bolt-types/spike-bolt.md +240 -0
  48. package/flows/aidlc/templates/construction/bolt-types/tdd-construction-bolt.md +259 -0
  49. package/flows/aidlc/templates/construction/construction-log-template.md +129 -0
  50. package/flows/aidlc/templates/construction/standards/coding-standards.md +29 -0
  51. package/flows/aidlc/templates/construction/standards/system-architecture.md +22 -0
  52. package/flows/aidlc/templates/construction/standards/tech-stack.md +19 -0
  53. package/flows/aidlc/templates/inception/inception-log-template.md +134 -0
  54. package/flows/aidlc/templates/inception/project/README.md +55 -0
  55. package/flows/aidlc/templates/inception/requirements-template.md +144 -0
  56. package/flows/aidlc/templates/inception/stories-template.md +38 -0
  57. package/flows/aidlc/templates/inception/story-template.md +147 -0
  58. package/flows/aidlc/templates/inception/system-context-template.md +29 -0
  59. package/flows/aidlc/templates/inception/unit-brief-template.md +177 -0
  60. package/flows/aidlc/templates/inception/units-template.md +52 -0
  61. package/flows/aidlc/templates/standards/catalog.yaml +345 -0
  62. package/flows/aidlc/templates/standards/coding-standards.guide.md +553 -0
  63. package/flows/aidlc/templates/standards/data-stack.guide.md +162 -0
  64. package/flows/aidlc/templates/standards/tech-stack.guide.md +280 -0
  65. package/lib/InstallerFactory.js +36 -0
  66. package/lib/cli-utils.js +372 -0
  67. package/lib/constants.js +31 -0
  68. package/lib/installer.js +314 -0
  69. package/lib/installers/AntigravityInstaller.js +22 -0
  70. package/lib/installers/ClaudeInstaller.js +85 -0
  71. package/lib/installers/ClineInstaller.js +21 -0
  72. package/lib/installers/CodexInstaller.js +21 -0
  73. package/lib/installers/CopilotInstaller.js +113 -0
  74. package/lib/installers/CursorInstaller.js +63 -0
  75. package/lib/installers/GeminiInstaller.js +75 -0
  76. package/lib/installers/KiroInstaller.js +22 -0
  77. package/lib/installers/OpenCodeInstaller.js +22 -0
  78. package/lib/installers/RooInstaller.js +22 -0
  79. package/lib/installers/ToolInstaller.js +73 -0
  80. package/lib/installers/WindsurfInstaller.js +76 -0
  81. package/lib/markdown-validator.ts +175 -0
  82. package/lib/yaml-validator.ts +99 -0
  83. package/package.json +65 -0
@@ -0,0 +1,553 @@
1
+ # Coding Standards Facilitation Guide
2
+
3
+ ## Purpose
4
+
5
+ Establish code style, quality, and testing standards that ensure consistency across all AI-generated and human-written code in the project.
6
+
7
+ ---
8
+
9
+ ## Facilitation Approach
10
+
11
+ You are collaborating with a peer to establish their coding standards. This should feel like a conversation between engineers, not a checklist.
12
+
13
+ **Adapt your style:**
14
+
15
+ - If they have existing standards → understand and document them
16
+ - If they reference popular style guides → build on those with project-specific additions
17
+ - If they're starting fresh → recommend sensible defaults based on their tech stack
18
+ - If they have strong opinions → respect them, ensure consistency
19
+
20
+ **Your role:**
21
+
22
+ - Surface the decisions that matter for AI code generation
23
+ - Ensure choices align with their tech stack
24
+ - Capture the "why" so future AI agents understand the rationale
25
+ - Keep it practical - standards that won't be followed are useless
26
+
27
+ **Pre-requisite:** Tech stack must be defined first. Read `standards/tech-stack.md` before starting.
28
+
29
+ ---
30
+
31
+ ## Discovery Areas
32
+
33
+ ### 1. Code Formatting
34
+
35
+ **Goal**: Establish consistent code formatting rules.
36
+
37
+ **Context to share:**
38
+ > "Formatting is the easiest standard to enforce automatically. Let's set it up once and forget about it."
39
+
40
+ **Explore:**
41
+
42
+ - Do you have existing formatting preferences?
43
+ - Is there a style guide you like? (Prettier defaults, StandardJS, Google style, etc.)
44
+ - Any specific preferences? (tabs vs spaces, line length, trailing commas)
45
+ - Should formatting be enforced on commit?
46
+
47
+ **Guide by language:**
48
+
49
+ **TypeScript/JavaScript:**
50
+
51
+ | Tool | Description |
52
+ |------|-------------|
53
+ | Prettier | Opinionated, widely adopted, minimal config |
54
+ | ESLint (formatting rules) | More configurable, can conflict with Prettier |
55
+ | Biome | Fast, all-in-one (lint + format) |
56
+
57
+ **Python:**
58
+
59
+ | Tool | Description |
60
+ |------|-------------|
61
+ | Black | Opinionated, "uncompromising", widely adopted |
62
+ | Ruff | Extremely fast, Black-compatible |
63
+ | YAPF | More configurable |
64
+
65
+ **Go:**
66
+
67
+ | Tool | Description |
68
+ |------|-------------|
69
+ | gofmt | Standard, use it |
70
+ | goimports | gofmt + import organization |
71
+
72
+ **Common decisions:**
73
+
74
+ - Line length (80, 100, 120 characters)
75
+ - Indentation (2 spaces, 4 spaces, tabs)
76
+ - Trailing commas (always, never, multi-line only)
77
+ - Semicolons (JavaScript: always, never, ASI-aware)
78
+ - Quote style (single, double)
79
+
80
+ **If they're unsure:**
81
+ > "For {language}, most teams use {default tool} with default settings. It eliminates debates and works well with AI code generation. Sound good?"
82
+
83
+ ---
84
+
85
+ ### 2. Linting Rules
86
+
87
+ **Goal**: Establish static analysis rules for catching bugs and enforcing patterns.
88
+
89
+ **Context:**
90
+ > "Linting catches bugs and enforces patterns before code review. The key is balancing strictness with developer productivity."
91
+
92
+ **Explore:**
93
+
94
+ - How strict do you want linting? (strict, balanced, relaxed)
95
+ - Any rules you feel strongly about? (unused variables, any types, etc.)
96
+ - Should linting block commits or just warn?
97
+ - Do you want to extend a popular config? (Airbnb, Standard, Recommended)
98
+
99
+ **Guide by language:**
100
+
101
+ **TypeScript:**
102
+
103
+ | Config | Description |
104
+ |--------|-------------|
105
+ | `@typescript-eslint/recommended` | Sensible defaults |
106
+ | `@typescript-eslint/strict` | Stricter type checking |
107
+ | Airbnb | Very opinionated, comprehensive |
108
+
109
+ **Key TypeScript decisions:**
110
+
111
+ - `strict: true` in tsconfig? (Recommended: yes)
112
+ - Allow `any` type? (Recommended: no, use `unknown`)
113
+ - Unused variables: error or warn?
114
+ - Explicit return types on functions?
115
+
116
+ **Python:**
117
+
118
+ | Tool | Description |
119
+ |------|-------------|
120
+ | Ruff | Fast, replaces multiple tools |
121
+ | Flake8 | Classic, plugin ecosystem |
122
+ | Pylint | Very comprehensive, can be noisy |
123
+ | mypy | Type checking |
124
+
125
+ **Key Python decisions:**
126
+
127
+ - Type hints required? (Recommended for new code)
128
+ - Docstring format? (Google, NumPy, Sphinx)
129
+ - Max complexity (cyclomatic)?
130
+
131
+ **Common patterns to discuss:**
132
+
133
+ - No console.log/print in production code
134
+ - No commented-out code
135
+ - No TODO without ticket reference
136
+ - Import ordering and grouping
137
+
138
+ ---
139
+
140
+ ### 3. Naming Conventions
141
+
142
+ **Goal**: Establish consistent naming patterns across the codebase.
143
+
144
+ **Context:**
145
+ > "Consistent naming helps AI agents generate code that fits naturally into your codebase. Let's establish the patterns."
146
+
147
+ **Explore:**
148
+
149
+ - Do you have existing naming conventions?
150
+ - Any preferences different from language defaults?
151
+ - How do you name files? (kebab-case, PascalCase, snake_case)
152
+ - Any prefix/suffix conventions? (I for interfaces, use for hooks, etc.)
153
+
154
+ **Standard patterns by language:**
155
+
156
+ **TypeScript/JavaScript:**
157
+
158
+ | Element | Convention | Example |
159
+ |---------|------------|---------|
160
+ | Variables | camelCase | `userName`, `isActive` |
161
+ | Functions | camelCase | `getUserById`, `calculateTotal` |
162
+ | Classes | PascalCase | `UserService`, `PaymentProcessor` |
163
+ | Interfaces | PascalCase | `User`, `PaymentOptions` |
164
+ | Types | PascalCase | `UserId`, `ApiResponse` |
165
+ | Constants | UPPER_SNAKE | `MAX_RETRIES`, `API_URL` |
166
+ | React components | PascalCase | `UserProfile`, `Header` |
167
+ | React hooks | camelCase with `use` | `useAuth`, `useLocalStorage` |
168
+ | Files (components) | PascalCase | `UserProfile.tsx` |
169
+ | Files (utilities) | kebab-case | `date-utils.ts` |
170
+
171
+ **Python:**
172
+
173
+ | Element | Convention | Example |
174
+ |---------|------------|---------|
175
+ | Variables | snake_case | `user_name`, `is_active` |
176
+ | Functions | snake_case | `get_user_by_id`, `calculate_total` |
177
+ | Classes | PascalCase | `UserService`, `PaymentProcessor` |
178
+ | Constants | UPPER_SNAKE | `MAX_RETRIES`, `API_URL` |
179
+ | Modules | snake_case | `user_service.py` |
180
+ | Private | Leading underscore | `_internal_method` |
181
+
182
+ **Go:**
183
+
184
+ | Element | Convention | Example |
185
+ |---------|------------|---------|
186
+ | Exported | PascalCase | `UserService`, `GetUser` |
187
+ | Unexported | camelCase | `userCache`, `calculateHash` |
188
+ | Files | snake_case | `user_service.go` |
189
+
190
+ **Specific decisions:**
191
+
192
+ - Interface prefix? (`IUser` vs `User`)
193
+ - Boolean naming? (`isActive`, `hasPermission`, `canEdit`)
194
+ - Handler/callback naming? (`onClick`, `handleClick`)
195
+ - Plural for collections? (`users` vs `userList`)
196
+
197
+ ---
198
+
199
+ ### 4. File & Folder Organization
200
+
201
+ **Goal**: Establish project structure patterns.
202
+
203
+ **Context:**
204
+ > "Good organization makes it easy to find code and helps AI agents know where to put new files."
205
+
206
+ **Explore:**
207
+
208
+ - Do you prefer feature-based or type-based organization?
209
+ - Any existing patterns to follow?
210
+ - How do you organize tests? (co-located, separate folder)
211
+ - Any barrel exports (index.ts files)?
212
+
213
+ **Common patterns:**
214
+
215
+ **Feature-based (Recommended for apps):**
216
+
217
+ ```text
218
+ src/
219
+ features/
220
+ auth/
221
+ components/
222
+ hooks/
223
+ api/
224
+ types.ts
225
+ index.ts
226
+ users/
227
+ ...
228
+ shared/
229
+ components/
230
+ hooks/
231
+ utils/
232
+ ```
233
+
234
+ **Type-based (Simpler, good for smaller projects):**
235
+
236
+ ```text
237
+ src/
238
+ components/
239
+ hooks/
240
+ services/
241
+ types/
242
+ utils/
243
+ ```
244
+
245
+ **Domain-Driven:**
246
+
247
+ ```text
248
+ src/
249
+ domain/
250
+ user/
251
+ order/
252
+ payment/
253
+ application/
254
+ services/
255
+ infrastructure/
256
+ database/
257
+ api/
258
+ ```
259
+
260
+ **Decisions to capture:**
261
+
262
+ - Where do tests live? (`__tests__/`, `.test.ts`, `tests/`)
263
+ - Where do types live? (co-located, `types/` folder)
264
+ - Barrel exports? (index.ts re-exporting)
265
+ - Max folder nesting depth?
266
+
267
+ ---
268
+
269
+ ### 5. Testing Strategy
270
+
271
+ **Goal**: Establish testing approach and coverage expectations.
272
+
273
+ **Context:**
274
+ > "Testing strategy affects how AI writes code and tests. Let's define what 'tested' means for this project."
275
+
276
+ **Explore:**
277
+
278
+ - What testing framework? (Often determined by tech stack)
279
+ - Unit vs integration vs e2e balance?
280
+ - Coverage requirements? (percentage, or just critical paths)
281
+ - Where do tests live?
282
+ - Mock strategy?
283
+
284
+ **Guide by test type:**
285
+
286
+ | Type | Purpose | Tools (JS/TS) | Tools (Python) |
287
+ |------|---------|---------------|----------------|
288
+ | Unit | Individual functions/components | Vitest, Jest | pytest |
289
+ | Integration | Module interactions | Vitest, Jest | pytest |
290
+ | E2E | Full user flows | Playwright, Cypress | Playwright, Selenium |
291
+ | Component | UI components in isolation | Testing Library, Storybook | - |
292
+
293
+ **Key decisions:**
294
+
295
+ - **Coverage target**: What percentage? (80% is common, 100% is rarely practical)
296
+ - **What must be tested**: Critical paths? All public APIs? Everything?
297
+ - **Test naming**: `it('should...')`, `test('when X, then Y')`, descriptive functions
298
+ - **Mock strategy**: Minimal mocks, mock at boundaries, mock everything external
299
+ - **Test data**: Factories, fixtures, inline data?
300
+
301
+ **Patterns to discuss:**
302
+
303
+ - Arrange-Act-Assert structure
304
+ - One assertion per test vs multiple related assertions
305
+ - Testing implementation vs behavior
306
+ - Snapshot testing (when/if to use)
307
+
308
+ ---
309
+
310
+ ### 6. Error Handling Patterns
311
+
312
+ **Goal**: Establish consistent error handling across the codebase.
313
+
314
+ **Context:**
315
+ > "Consistent error handling makes debugging easier and helps AI generate robust code."
316
+
317
+ **Explore:**
318
+
319
+ - Do you have existing error handling patterns?
320
+ - How do you handle async errors?
321
+ - Custom error classes or standard errors?
322
+ - How are errors logged?
323
+
324
+ **Patterns to discuss:**
325
+
326
+ **Error types:**
327
+
328
+ - Use custom error classes for domain errors?
329
+ - Error codes or just messages?
330
+ - Structured errors with metadata?
331
+
332
+ **Async error handling (TypeScript):**
333
+
334
+ ```typescript
335
+ // Option A: try/catch
336
+ try {
337
+ const result = await doSomething();
338
+ } catch (error) {
339
+ // handle
340
+ }
341
+
342
+ // Option B: Result type
343
+ const result = await doSomething(); // returns Result<T, E>
344
+ if (result.isErr()) {
345
+ // handle
346
+ }
347
+ ```
348
+
349
+ **API error responses:**
350
+
351
+ - Standard error format?
352
+ - HTTP status code usage?
353
+ - Include stack traces in dev?
354
+
355
+ **Key decisions:**
356
+
357
+ - Throw vs return errors?
358
+ - Error boundaries (React)?
359
+ - Global error handler?
360
+ - User-facing vs technical errors?
361
+
362
+ ---
363
+
364
+ ### 7. Logging Standards
365
+
366
+ **Goal**: Establish consistent logging practices.
367
+
368
+ **Context:**
369
+ > "Good logging makes debugging possible. Let's establish what gets logged and how."
370
+
371
+ **Explore:**
372
+
373
+ - What logging library? (console, pino, winston, etc.)
374
+ - Log levels used? (debug, info, warn, error)
375
+ - Structured logging (JSON) or text?
376
+ - What must always be logged? What should never be logged?
377
+
378
+ **Standard log levels:**
379
+
380
+ | Level | When to Use |
381
+ |-------|-------------|
382
+ | error | Something failed, needs attention |
383
+ | warn | Something unexpected, but handled |
384
+ | info | Significant business events |
385
+ | debug | Detailed technical info (dev only) |
386
+
387
+ **Key decisions:**
388
+
389
+ - Structured logs (JSON) for production?
390
+ - Include request IDs/correlation IDs?
391
+ - PII handling (never log passwords, tokens, etc.)
392
+ - Log retention?
393
+
394
+ **What to log:**
395
+
396
+ - API requests (method, path, status, duration)
397
+ - Authentication events
398
+ - Business events (order placed, user registered)
399
+ - Errors with context
400
+
401
+ **What NOT to log:**
402
+
403
+ - Passwords, tokens, API keys
404
+ - PII without consent
405
+ - High-frequency events (unless debug)
406
+
407
+ ---
408
+
409
+ ## Completing the Discovery
410
+
411
+ Once you've explored relevant areas, summarize:
412
+
413
+ ```markdown
414
+ ## Coding Standards Summary
415
+
416
+ Based on our conversation, here's what I understand:
417
+
418
+ **Formatting**: {tool} with {key settings}
419
+ {brief rationale}
420
+
421
+ **Linting**: {tool/config} with {strictness level}
422
+ {brief rationale}
423
+
424
+ **Naming**: {key conventions}
425
+ {brief rationale}
426
+
427
+ **File Organization**: {pattern}
428
+ {brief rationale}
429
+
430
+ **Testing**: {framework}, {coverage target}, {test location}
431
+ {brief rationale}
432
+
433
+ **Error Handling**: {pattern}
434
+ {brief rationale if notable}
435
+
436
+ **Logging**: {tool}, {levels}
437
+ {brief rationale if notable}
438
+
439
+ ---
440
+
441
+ Does this capture your coding standards accurately? Any adjustments needed?
442
+ ```
443
+
444
+ ---
445
+
446
+ ## Output Generation
447
+
448
+ After confirmation, create `standards/coding-standards.md`:
449
+
450
+ ````markdown
451
+ # Coding Standards
452
+
453
+ ## Overview
454
+ {1-2 sentence summary of the standards approach}
455
+
456
+ ## Code Formatting
457
+
458
+ **Tool**: {formatter}
459
+ **Key Settings**:
460
+ - {setting}: {value}
461
+ - {setting}: {value}
462
+
463
+ **Enforcement**: {when formatting is enforced - on save, pre-commit, CI}
464
+
465
+ ## Linting
466
+
467
+ **Tool**: {linter}
468
+ **Base Config**: {extends}
469
+ **Strictness**: {strict/balanced/relaxed}
470
+
471
+ **Key Rules**:
472
+ - {rule}: {setting} - {why}
473
+ - {rule}: {setting} - {why}
474
+
475
+ ## Naming Conventions
476
+
477
+ | Element | Convention | Example |
478
+ |---------|------------|---------|
479
+ | {element} | {convention} | {example} |
480
+ | ... | ... | ... |
481
+
482
+ **File Naming**:
483
+ - Components: {convention}
484
+ - Utilities: {convention}
485
+ - Tests: {convention}
486
+
487
+ ## File Organization
488
+
489
+ **Pattern**: {feature-based/type-based/domain-driven}
490
+
491
+ **Structure**:
492
+ ```text
493
+ {high-level folder structure}
494
+ ```
495
+
496
+ **Conventions**:
497
+
498
+ - Tests: {location}
499
+ - Types: {location}
500
+ - Index files: {usage}
501
+
502
+ ## Testing Strategy
503
+
504
+ **Framework**: {framework}
505
+ **Coverage Target**: {percentage or description}
506
+
507
+ **Test Types**:
508
+
509
+ | Type | Tool | When to Use |
510
+ |------|------|-------------|
511
+ | {type} | {tool} | {guidance} |
512
+
513
+ **Conventions**:
514
+
515
+ - Test naming: {pattern}
516
+ - Test structure: {pattern}
517
+ - Mock strategy: {approach}
518
+
519
+ ## Error Handling
520
+
521
+ **Pattern**: {throw/return/result type}
522
+
523
+ **Custom Errors**: {yes/no, and structure if yes}
524
+
525
+ **API Errors**: {format}
526
+
527
+ ## Logging
528
+
529
+ **Tool**: {logger}
530
+ **Format**: {structured/text}
531
+
532
+ **Levels**:
533
+
534
+ | Level | Usage |
535
+ |-------|-------|
536
+ | {level} | {when} |
537
+
538
+ **Rules**:
539
+
540
+ - Always log: {list}
541
+ - Never log: {list}
542
+ ````
543
+
544
+ ---
545
+
546
+ ## Notes for Agent
547
+
548
+ - **Tech stack first** - Don't ask about formatters without knowing the language
549
+ - **Respect existing patterns** - If they have conventions, document them
550
+ - **Don't over-specify** - Some projects don't need every section
551
+ - **Skip irrelevant sections** - CLI tools probably don't need logging standards
552
+ - **Keep it actionable** - Standards should be specific enough for AI to follow
553
+ - **Capture the "why"** - Rationale helps future decisions
@@ -0,0 +1,162 @@
1
+ # Data Stack Facilitation Guide
2
+
3
+ ## Purpose
4
+
5
+ Define the database and data persistence choices for the project. This guide helps determine what data storage is needed and how the application will interact with it.
6
+
7
+ ---
8
+
9
+ ## Facilitation Approach
10
+
11
+ You are collaborating with a peer to discover their data persistence needs. This is a conversation, not a form to fill out.
12
+
13
+ **Adapt your style:**
14
+
15
+ - If they mention specific databases confidently → treat them as experienced, be concise
16
+ - If they seem uncertain → provide more context, examples, and recommendations
17
+ - If they have strong preferences → respect them, ask about tradeoffs they've considered
18
+
19
+ **Your role:**
20
+
21
+ - Guide discovery, don't dictate choices
22
+ - Surface tradeoffs they may not have considered
23
+ - Ensure choices are coherent with the tech stack
24
+ - Capture rationale, not just the choice
25
+
26
+ ---
27
+
28
+ ## Discovery Areas
29
+
30
+ ### 1. Database
31
+
32
+ **Goal**: Understand data persistence needs.
33
+
34
+ **Context:**
35
+ > "Database choice affects data modeling, query patterns, scaling, and operational complexity. Some projects don't need a database initially - that's valid too."
36
+
37
+ **Explore:**
38
+
39
+ - What kind of data? (Users, products, transactions, documents, time-series, relationships)
40
+ - What's the expected scale? (Hundreds, thousands, millions of records)
41
+ - Do they need real-time subscriptions?
42
+ - Managed service preference or self-hosted?
43
+ - Any compliance requirements? (Data residency, encryption at rest)
44
+ - Budget constraints?
45
+
46
+ **Guide by data patterns:**
47
+
48
+ | Data Pattern | Recommendation | Why |
49
+ |--------------|----------------|-----|
50
+ | Relational (users, orders, products) | PostgreSQL | Flexible, powerful, great extensions |
51
+ | Document-oriented, flexible schema | MongoDB | Schema flexibility, nested data |
52
+ | Serverless, auto-scaling | Supabase, PlanetScale, Neon | No ops, scales automatically |
53
+ | Real-time collaboration | Supabase, Firebase | Built-in subscriptions |
54
+ | Key-value, caching | Redis, DynamoDB | Fast lookups, simple model |
55
+ | Time-series (logs, metrics) | TimescaleDB, InfluxDB | Optimized for time-based queries |
56
+
57
+ **Managed services to consider:**
58
+
59
+ - **Supabase**: PostgreSQL + auth + real-time + storage (great for startups)
60
+ - **PlanetScale**: MySQL-compatible, serverless, branching (great for scaling)
61
+ - **Neon**: PostgreSQL, serverless, branching (great for development)
62
+ - **MongoDB Atlas**: Managed MongoDB
63
+ - **AWS RDS/Aurora**: Enterprise-grade managed databases
64
+
65
+ **If they're unsure:**
66
+ > "For most web applications, PostgreSQL is a safe default. It's relational, has great tooling, and can handle JSON when you need flexibility. If you want managed + auth + real-time, Supabase wraps PostgreSQL nicely."
67
+
68
+ ---
69
+
70
+ ### 2. ORM / Database Client
71
+
72
+ **Goal**: Determine how they'll interact with the database.
73
+
74
+ **Explore:**
75
+
76
+ - Do they prefer type-safe queries or raw SQL?
77
+ - How important are migrations and schema management?
78
+ - Do they need to support multiple databases?
79
+
80
+ **Options by language:**
81
+
82
+ **TypeScript:**
83
+
84
+ | ORM | Style | Best For |
85
+ |-----|-------|----------|
86
+ | Prisma | Schema-first, type-safe | Most projects, great DX |
87
+ | Drizzle | TypeScript-first, SQL-like | Performance, SQL lovers |
88
+ | Kysely | Type-safe query builder | Raw SQL with types |
89
+ | TypeORM | Decorator-based | Enterprise, existing TypeORM knowledge |
90
+
91
+ **Python:**
92
+
93
+ | ORM | Style | Best For |
94
+ |-----|-------|----------|
95
+ | SQLAlchemy | Flexible, powerful | Most projects |
96
+ | Django ORM | Integrated with Django | Django projects |
97
+ | Prisma (Python) | Schema-first | Prisma fans |
98
+
99
+ **Go:**
100
+
101
+ | Library | Style | Best For |
102
+ |---------|-------|----------|
103
+ | GORM | Full ORM | Quick development |
104
+ | sqlx | SQL with structs | Performance, SQL control |
105
+ | pgx | Low-level PostgreSQL | Maximum performance |
106
+
107
+ ---
108
+
109
+ ## Completing the Discovery
110
+
111
+ Once you've explored all relevant areas, summarize:
112
+
113
+ ```markdown
114
+ ## Data Stack Summary
115
+
116
+ Based on our conversation, here's what I understand:
117
+
118
+ **Database**: {choice}
119
+ {brief rationale}
120
+
121
+ **ORM / Database Client**: {choice}
122
+ {brief rationale}
123
+
124
+ ---
125
+
126
+ Does this capture your data stack accurately? Any adjustments needed?
127
+ ```
128
+
129
+ ---
130
+
131
+ ## Output Generation
132
+
133
+ After confirmation, create `standards/data-stack.md`:
134
+
135
+ ```markdown
136
+ # Data Stack
137
+
138
+ ## Overview
139
+ {1-2 sentence summary of the data persistence approach}
140
+
141
+ ## Database
142
+ {database choice}
143
+
144
+ {Rationale - why this choice, scaling approach, managed vs self-hosted}
145
+
146
+ ## ORM / Database Client
147
+ {orm choice}
148
+
149
+ {Rationale - why this choice, how it fits with the language/framework}
150
+
151
+ ## Decision Relationships
152
+ {Note any important connections, e.g., "Prisma was chosen because it integrates well with TypeScript and provides excellent type-safe database access"}
153
+ ```
154
+
155
+ ---
156
+
157
+ ## Notes for Agent
158
+
159
+ - **This standard is only for projects that need data persistence** - skip if not applicable
160
+ - **Capture rationale** - "why" is as important as "what"
161
+ - **Respect existing choices** - if they say "we're using X", don't try to change their mind unless there's a real issue
162
+ - **Consider the tech stack** - ORM choice should align with language/framework from tech-stack