@davidbalzan/groundwork 0.3.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 (57) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +323 -0
  3. package/docs/DECISIONS.md +170 -0
  4. package/package.json +38 -0
  5. package/payload/doc-templates/COMMANDS.md +419 -0
  6. package/payload/doc-templates/DECISIONS.md +168 -0
  7. package/payload/doc-templates/FACTS.md +43 -0
  8. package/payload/doc-templates/GROUNDWORK_METHODOLOGY.md +1300 -0
  9. package/payload/doc-templates/STACK_MAP.md +90 -0
  10. package/payload/doc-templates/WORKSTREAMS.md +79 -0
  11. package/payload/doc-templates/_INDEX.md +54 -0
  12. package/payload/doc-templates/phases/README.md +36 -0
  13. package/payload/doc-templates/phases/templates/README.md +63 -0
  14. package/payload/doc-templates/phases/templates/TASK_TEMPLATE.md +302 -0
  15. package/payload/doc-templates/phases/templates/task_template_prompt.md +229 -0
  16. package/payload/doc-templates/templates/ARCHITECTURE_GUIDE_TEMPLATE.md +250 -0
  17. package/payload/doc-templates/templates/DESIGN_SYSTEM_TEMPLATE.md +336 -0
  18. package/payload/doc-templates/templates/DONE_TEMPLATE.md +21 -0
  19. package/payload/doc-templates/templates/PHASES_README_TEMPLATE.md +144 -0
  20. package/payload/doc-templates/templates/PHASE_README_TEMPLATE.md +142 -0
  21. package/payload/doc-templates/templates/PRD_TEMPLATE.md +348 -0
  22. package/payload/doc-templates/templates/PRODUCTION_ROADMAP_TEMPLATE.md +168 -0
  23. package/payload/doc-templates/templates/QUEUE_TEMPLATE.md +17 -0
  24. package/payload/doc-templates/templates/TECH_STACK_TEMPLATE.md +199 -0
  25. package/payload/scripts/check-task.mjs +98 -0
  26. package/payload/scripts/check-versions.mjs +113 -0
  27. package/payload/scripts/phase-status.mjs +69 -0
  28. package/payload/scripts/set-fact.mjs +86 -0
  29. package/payload/skills/add-data-layer/SKILL.md +129 -0
  30. package/payload/skills/check-task/SKILL.md +35 -0
  31. package/payload/skills/check-versions/SKILL.md +47 -0
  32. package/payload/skills/create-prd/SKILL.md +90 -0
  33. package/payload/skills/domain-model/SKILL.md +90 -0
  34. package/payload/skills/kickstart/SKILL.md +157 -0
  35. package/payload/skills/log-decision/SKILL.md +65 -0
  36. package/payload/skills/next/SKILL.md +65 -0
  37. package/payload/skills/plan-phase/SKILL.md +108 -0
  38. package/payload/skills/remember/SKILL.md +77 -0
  39. package/payload/skills/start-session/SKILL.md +52 -0
  40. package/payload/skills/update-workstreams/SKILL.md +60 -0
  41. package/src/cli.mjs +115 -0
  42. package/src/commands/add.mjs +39 -0
  43. package/src/commands/artifacts.mjs +24 -0
  44. package/src/commands/doctor.mjs +292 -0
  45. package/src/commands/init.mjs +147 -0
  46. package/src/commands/knowledge.mjs +148 -0
  47. package/src/commands/list.mjs +61 -0
  48. package/src/commands/status.mjs +96 -0
  49. package/src/commands/update.mjs +128 -0
  50. package/src/lib/adr-tripwire.mjs +171 -0
  51. package/src/lib/artifacts.mjs +124 -0
  52. package/src/lib/config.mjs +43 -0
  53. package/src/lib/fs.mjs +46 -0
  54. package/src/lib/log.mjs +22 -0
  55. package/src/lib/paths.mjs +36 -0
  56. package/src/lib/progress.mjs +26 -0
  57. package/src/lib/skills.mjs +42 -0
@@ -0,0 +1,229 @@
1
+ ---
2
+ title: "Task Template Prompt"
3
+ tags: [groundwork/template]
4
+ aliases: []
5
+ ---
6
+
7
+ # Task Template Development Prompt
8
+
9
+ You are an expert software architect and project manager tasked with conducting a comprehensive codebase analysis and creating a detailed task plan. Your goal is to systematically probe the codebase, gather requirements from the user, and produce a thorough project specification following a structured template.
10
+
11
+ ## 🎯 Your Mission
12
+
13
+ Work through the following stages systematically, probing the codebase extensively and asking targeted clarifying questions. Use the available tools to explore code structure, dependencies, patterns, and architecture before making assumptions.
14
+
15
+ ---
16
+
17
+ ## Stage 1: Initial Discovery & Project Scope
18
+
19
+ ### 🔍 Codebase Exploration Tasks:
20
+
21
+ 1. **Repository Structure Analysis**
22
+ - Explore the overall project structure and identify major components
23
+ - Map out package/module organization and dependencies
24
+ - Identify build systems, configuration files, and deployment artifacts
25
+ - Look for existing documentation, specs, or architectural decisions
26
+
27
+ 2. **Technology Stack Assessment**
28
+ - Identify programming languages, frameworks, and major dependencies
29
+ - Understand build tools, testing frameworks, and development workflows
30
+ - Examine configuration files and environment setup
31
+
32
+ ### 💬 Essential User Questions:
33
+
34
+ After initial exploration, ask the user:
35
+
36
+ 1. **Project Context**:
37
+ - What is the overall goal of this project? (migration, refactor, new feature, optimization, etc.)
38
+ - What prompted this work? What problem are we solving?
39
+ - What's the business/technical context driving this initiative?
40
+
41
+ 2. **Scope Boundaries**:
42
+ - Which specific components/areas should be included in this task?
43
+ - Are there any components that should be explicitly excluded?
44
+ - What's the priority order for different areas of work?
45
+
46
+ 3. **Success Definition**:
47
+ - How will we know when this project is successful?
48
+ - What are the key metrics or criteria that matter most?
49
+ - Are there any non-negotiable requirements or constraints?
50
+
51
+ ---
52
+
53
+ ## Stage 2: Deep Technical Analysis
54
+
55
+ ### 🔍 Advanced Codebase Probing:
56
+
57
+ 1. **Dependency Mapping**
58
+ - Analyze inter-module dependencies and coupling
59
+ - Identify circular dependencies or architectural debt
60
+ - Map external library usage and version compatibility
61
+
62
+ 2. **Code Quality Assessment**
63
+ - Examine test coverage and testing patterns
64
+ - Look for code duplication, complexity hotspots
65
+ - Identify outdated patterns or deprecated usage
66
+
67
+ 3. **Architecture Pattern Recognition**
68
+ - Understand current architectural patterns and principles
69
+ - Identify service boundaries and data flow
70
+ - Examine error handling, logging, and monitoring patterns
71
+
72
+ ### 💬 Technical Clarification Questions:
73
+
74
+ 1. **Current State Assessment**:
75
+ - What are the main pain points with the current system?
76
+ - Which components are working well and should be preserved?
77
+ - Are there any known technical debt or legacy issues?
78
+
79
+ 2. **Target Architecture**:
80
+ - Do you have a preferred target architecture or pattern in mind?
81
+ - Are there any architectural principles or constraints we must follow?
82
+ - Should we prioritize specific qualities (performance, maintainability, scalability)?
83
+
84
+ 3. **Migration Strategy**:
85
+ - Should this be a big-bang migration or incremental approach?
86
+ - Are there any components that must remain operational during transition?
87
+ - What's the acceptable risk level for this project?
88
+
89
+ ---
90
+
91
+ ## Stage 3: Impact & Risk Analysis
92
+
93
+ ### 🔍 Risk Assessment Exploration:
94
+
95
+ 1. **Breaking Change Analysis**
96
+ - Identify public APIs and contracts that might change
97
+ - Find hard dependencies between components
98
+ - Locate configuration or data format dependencies
99
+
100
+ 2. **Testing & Validation Gaps**
101
+ - Assess current test coverage for affected components
102
+ - Identify integration points that need validation
103
+ - Find manual processes that could be affected
104
+
105
+ ### 💬 Risk & Impact Questions:
106
+
107
+ 1. **Business Impact**:
108
+ - What are the consequences if this project fails or is delayed?
109
+ - Are there any critical deadlines or external dependencies?
110
+ - Which stakeholders are most affected by this work?
111
+
112
+ 2. **Technical Risks**:
113
+ - What are you most concerned about in this project?
114
+ - Are there any components you're particularly nervous about changing?
115
+ - What would be the worst-case scenario if something goes wrong?
116
+
117
+ 3. **Resource Constraints**:
118
+ - What's the time budget for this work?
119
+ - How many developers will be working on this?
120
+ - Are there any skill gaps or training needs?
121
+
122
+ ---
123
+
124
+ ## Stage 4: Detailed Component Inventory
125
+
126
+ ### 🔍 Comprehensive Component Analysis:
127
+
128
+ 1. **Component Categorization**
129
+ - Group components by function, layer, or domain
130
+ - Assess the size and complexity of each component
131
+ - Identify shared utilities and common patterns
132
+
133
+ 2. **Migration Complexity Scoring**
134
+ - Evaluate each component's migration difficulty
135
+ - Identify components with external dependencies
136
+ - Find components that other parts of the system depend on
137
+
138
+ ### 💬 Component-Specific Questions:
139
+
140
+ For each major component category discovered:
141
+
142
+ 1. **Component Priority**:
143
+ - How critical is [specific component] to the overall system?
144
+ - Can [component] be migrated independently, or does it require coordination?
145
+ - Are there any [component]-specific requirements or constraints?
146
+
147
+ 2. **Integration Points**:
148
+ - What external systems does [component] integrate with?
149
+ - Are there any API contracts or data formats we must preserve?
150
+ - Who are the consumers of [component]'s interfaces?
151
+
152
+ ---
153
+
154
+ ## Stage 5: Task Planning & Sequencing
155
+
156
+ ### 🔍 Dependency & Sequencing Analysis:
157
+
158
+ 1. **Task Dependency Mapping**
159
+ - Identify which components must be migrated before others
160
+ - Find parallel work streams that can proceed independently
161
+ - Locate critical path dependencies
162
+
163
+ 2. **Incremental Delivery Options**
164
+ - Identify natural breakpoints for incremental delivery
165
+ - Find opportunities for feature flags or gradual rollouts
166
+ - Plan backwards compatibility strategies
167
+
168
+ ### 💬 Planning & Timeline Questions:
169
+
170
+ 1. **Delivery Preferences**:
171
+ - Would you prefer frequent small deliveries or fewer large milestones?
172
+ - Are there any natural breakpoints where we should pause and validate?
173
+ - What's your preference for handling backwards compatibility?
174
+
175
+ 2. **Resource Allocation**:
176
+ - Can work be distributed across multiple developers?
177
+ - Are there any components that require specific expertise?
178
+ - Should junior developers be assigned specific types of tasks?
179
+
180
+ 3. **Quality Gates**:
181
+ - What testing/validation should happen at each phase?
182
+ - Are there any approval processes or stakeholder reviews required?
183
+ - What documentation needs to be created or updated?
184
+
185
+ ---
186
+
187
+ ## Stage 6: Success Criteria & Validation
188
+
189
+ ### 💬 Final Clarification Questions:
190
+
191
+ 1. **Definition of Done**:
192
+ - What specific functional requirements must be met?
193
+ - Are there performance benchmarks or quality gates?
194
+ - What documentation deliverables are expected?
195
+
196
+ 2. **Acceptance Criteria**:
197
+ - Who will validate that each phase is complete?
198
+ - What does "production ready" mean for this project?
199
+ - Are there any compliance or security requirements?
200
+
201
+ 3. **Future Considerations**:
202
+ - Are there follow-up projects or phases planned?
203
+ - Should the design accommodate known future requirements?
204
+ - What's the long-term maintenance strategy?
205
+
206
+ ---
207
+
208
+ ## 📋 Your Process
209
+
210
+ 1. **Start with Stage 1** - Conduct initial codebase exploration, then ask user questions
211
+ 2. **Wait for responses** before proceeding to the next stage
212
+ 3. **Use all available tools** to thoroughly understand the codebase before asking questions
213
+ 4. **Be specific** - Reference actual files, components, and patterns you discover
214
+ 5. **Ask follow-up questions** if user responses are unclear or incomplete
215
+ 6. **Document findings** as you go to build toward the final task template
216
+
217
+ ## 🎯 Final Deliverable
218
+
219
+ After completing all stages, synthesize your findings into a comprehensive task template that includes:
220
+
221
+ - **Executive Summary**: Clear project overview with critical findings
222
+ - **Detailed Component Inventory**: What needs to be migrated/implemented
223
+ - **Risk Assessment**: Impact analysis and mitigation strategies
224
+ - **Target Architecture**: Clear vision of the end state
225
+ - **Phased Task Plan**: Detailed tasks with dependencies and timelines
226
+ - **Success Criteria**: Measurable outcomes and quality gates
227
+ - **Timeline Estimates**: Realistic projections with contingencies
228
+
229
+ Remember: Your goal is to create a actionable roadmap that any developer could follow to successfully complete this project.
@@ -0,0 +1,250 @@
1
+ ---
2
+ title: "Architecture Guide Template"
3
+ tags: [groundwork/template]
4
+ aliases: ["Architecture Template"]
5
+ ---
6
+
7
+ # [Project Name] - Architecture Guide
8
+
9
+ > Documents **why** architectural decisions were made, not just what they are. This is the primary reference for AI agents and developers to understand the system's design philosophy and make consistent decisions.
10
+
11
+ ---
12
+
13
+ ## 🏗️ Current Architecture Overview
14
+
15
+ ```
16
+ [ASCII diagram showing system components and primary data flow.
17
+ Replace this with your actual architecture. Example:]
18
+
19
+ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
20
+ │ Frontend │ ──▶ │ API Layer │ ──▶ │ Database │
21
+ │ ([Framework │ ◀── │ ([Framework │ ◀── │ ([Database │
22
+ │ + Version])│ │ + Version]) │ │ + Version]) │
23
+ └──────────────┘ └──────────────┘ └──────────────┘
24
+ │ │
25
+ │ ┌─────┴──────┐
26
+ │ │ Shared │
27
+ └──────────────│ Package │
28
+ │ (Types & │
29
+ │ Utilities)│
30
+ └────────────┘
31
+ ```
32
+
33
+ ### Key Components
34
+
35
+ - **[Component Name, e.g., "Web Frontend"]**: [Purpose, responsibility boundaries, and what it owns. Describe what requests it handles, what data it manages, and what it delegates to other components. E.g., "Handles all user interaction, client-side routing, form validation, and API communication. Does NOT handle business logic or data persistence."]
36
+ - **[Component Name, e.g., "API Server"]**: [Purpose, responsibility boundaries. E.g., "Handles request validation, authentication, business logic orchestration, and database operations. Serves as the single gateway to persistent data."]
37
+ - **[Component Name, e.g., "Shared Package"]**: [Purpose. E.g., "Provides TypeScript types, constants, and utility functions shared between frontend and backend. Ensures type safety across the API boundary."]
38
+
39
+ ### Communication Patterns
40
+
41
+ - **Frontend ↔ API**: [Protocol and format — e.g., "REST over HTTPS, JSON payloads, typed with shared ApiResponse<T> wrapper"]
42
+ - **API ↔ Database**: [Access pattern — e.g., "ORM with query builder, connection pooling, prepared statements"]
43
+ - **Cross-Package**: [How packages communicate — e.g., "TypeScript project references with workspace: protocol, no runtime dependency on build artifacts"]
44
+
45
+ ---
46
+
47
+ ## 🤔 Why [Major Decision — e.g., "Monorepo with Turborepo"]?
48
+
49
+ > Document the reasoning behind each significant architectural choice. Repeat this section for each major decision.
50
+
51
+ ### The Problem We're Solving
52
+
53
+ [Describe the specific problem or need that led to this decision. Be concrete about pain points. E.g., "Frontend and backend share many types and utilities. Without a monorepo, we'd need to publish packages to npm, manage versioning, and deal with synchronization issues during development."]
54
+
55
+ ### Alternatives Considered
56
+
57
+ 1. **[Alternative 1, e.g., "Separate Repositories"]**
58
+ - **Pros**: [What this alternative does well — e.g., "Independent deployment, clear ownership boundaries"]
59
+ - **Cons**: [Why we rejected it — e.g., "Type synchronization nightmare, slow development feedback loop, package publishing overhead"]
60
+ - **Rejected because**: [The decisive factor — e.g., "Development velocity loss outweighs deployment flexibility at our current scale"]
61
+
62
+ 2. **[Alternative 2, e.g., "Nx Monorepo"]**
63
+ - **Pros**: [What this does well — e.g., "More features, computation caching, affected detection"]
64
+ - **Cons**: [Why we rejected it — e.g., "Heavier configuration, steeper learning curve, more opinionated"]
65
+ - **Rejected because**: [Decisive factor — e.g., "Turborepo covers our needs with significantly less configuration overhead"]
66
+
67
+ ### Why Current Approach is Better
68
+
69
+ #### [Pattern/Approach Name — e.g., "Turborepo Workspaces"]
70
+
71
+ - [Concrete benefit with evidence — e.g., "Shared types via workspace: protocol eliminates type drift between frontend and backend"]
72
+ - [Concrete benefit — e.g., "Incremental builds with content-hash caching reduce CI time from ~5min to ~30s for unchanged packages"]
73
+ - [Concrete benefit — e.g., "Single PR for cross-cutting changes: a type change propagates to all consumers immediately"]
74
+
75
+ ```tsx
76
+ // Example showing the preferred pattern in action
77
+ // [Demonstrate with real code from your project that illustrates why this approach works]
78
+ ```
79
+
80
+ ---
81
+
82
+ ## 📁 Directory Structure
83
+
84
+ ```
85
+ [Replace with your actual project structure. Annotate each directory
86
+ with its purpose, what files belong there, and what does NOT belong there.]
87
+
88
+ apps/
89
+ ├── [app-1]/src/
90
+ │ ├── components/ # [Shared UI components — reusable across features, no business logic]
91
+ │ ├── features/ # [Feature modules — self-contained, domain-specific functionality]
92
+ │ │ └── [feature]/ # [Each feature owns its components, hooks, types, and tests]
93
+ │ ├── pages/ # [Route pages — thin wrappers that compose features and layout]
94
+ │ ├── hooks/ # [Shared hooks — cross-feature, generic React hooks only]
95
+ │ └── lib/ # [Utilities — API client, formatters, helpers with no React dependency]
96
+
97
+ ├── [app-2]/src/
98
+ │ ├── routes/ # [Route handlers — request parsing, response formatting, delegation to services]
99
+ │ ├── middleware/ # [Request middleware — auth, validation, logging, error handling]
100
+ │ ├── services/ # [Business logic — pure functions/classes, no HTTP/framework dependency]
101
+ │ └── config/ # [Configuration — environment parsing, feature flags, constants]
102
+
103
+ packages/
104
+ ├── [package-1]/src/ # [Shared types, constants, utilities — no runtime framework dependency]
105
+ └── [package-2]/src/ # [UI component library — framework-dependent but app-independent]
106
+ ```
107
+
108
+ ### Feature-Based Organization
109
+
110
+ > Both frontend and backend use **feature-based** organization. Each feature is self-contained with its own components, logic, types, and tests. This reduces coupling and makes it easy to understand, modify, or remove a feature.
111
+
112
+ ```
113
+ features/
114
+ ├── [feature-name]/
115
+ │ ├── components/ # (frontend) UI components specific to this feature
116
+ │ ├── hooks/ # (frontend) Custom hooks for this feature's data/state
117
+ │ ├── routes/ # (backend) Route handlers for this feature's endpoints
118
+ │ ├── services/ # (backend) Business logic for this feature's domain
119
+ │ ├── types.ts # Types shared within this feature (exported via barrel if needed cross-feature)
120
+ │ └── __tests__/ # Tests co-located with the feature they test
121
+ ```
122
+
123
+ ### File Naming Conventions
124
+
125
+ - **Components**: `PascalCase.tsx` — [E.g., "UserProfile.tsx, DashboardCard.tsx"]
126
+ - **Hooks**: `camelCase.ts` with `use` prefix — [E.g., "useAuth.ts, useDebounce.ts"]
127
+ - **Services**: `camelCase.ts` — [E.g., "userService.ts, authService.ts"]
128
+ - **Types**: `camelCase.ts` — [E.g., "types.ts, api.ts, common.ts"]
129
+ - **Tests**: `[filename].test.ts(x)` — [Co-located with source file]
130
+ - **Constants**: `UPPER_SNAKE_CASE` exports in `camelCase.ts` files
131
+
132
+ ---
133
+
134
+ ## 🔗 Related Documents
135
+
136
+ - **[[DECISIONS|Decisions Log]]** - Detailed ADRs for every major architectural choice
137
+ - **[[TECH_STACK|Tech Stack]]** - Technology choices with versions, rationale, and upgrade risks
138
+ - **[[WORKSTREAMS|Workstreams]]** - Live state of parallel work streams
139
+ - **[[DESIGN_SYSTEM|Design System]]** - Visual language and component patterns (if frontend)
140
+
141
+ ---
142
+
143
+ ## 📈 Upgrade Paths
144
+
145
+ > Document when and how to evolve the architecture as the project grows. This prevents premature optimization while ensuring a clear migration path.
146
+
147
+ ### Current State (Now)
148
+
149
+ **What**: [Current approach — e.g., "Simple REST API with direct database queries, React SPA with client-side routing"]
150
+ **Best for**: [Scale/use case this works for — e.g., "< 10k users, < 50 API endpoints, single dev team"]
151
+ **Effort**: None — already implemented
152
+
153
+ ### Growing Complexity → [Next Approach, e.g., "Service Layer Extraction"]
154
+
155
+ **When to upgrade** (trigger conditions):
156
+
157
+ - [Measurable trigger — e.g., "API response time p95 exceeds 500ms under normal load"]
158
+ - [Measurable trigger — e.g., "More than 3 developers working on the same service simultaneously"]
159
+ - [Measurable trigger — e.g., "Feature development velocity drops below 1 feature/sprint due to coupling"]
160
+
161
+ **Migration effort**: [Low/Medium/High] ([X] days estimated)
162
+ **Migration strategy**: [Brief description — e.g., "Extract business logic into service layer, add caching, introduce message queue for async operations"]
163
+
164
+ ### Maturity → [Advanced Approach, e.g., "Microservices / Event-Driven"]
165
+
166
+ **When to upgrade** (trigger conditions):
167
+
168
+ - [Measurable trigger — e.g., "Need independent scaling of specific services"]
169
+ - [Measurable trigger — e.g., "Multiple teams need autonomous deployment cycles"]
170
+
171
+ **Migration effort**: [Low/Medium/High] ([X] weeks estimated)
172
+
173
+ ---
174
+
175
+ ## 📋 Decision Matrix
176
+
177
+ > Quick reference for "what do I use for X?" questions. Links to detailed ADRs for full context.
178
+
179
+ | Need | Current Solution | Effort | When to Revisit | ADR Reference |
180
+ | --------------------------------- | ---------------------------------------------- | ------ | ------------------------------------------------------------------ | ------------------------------- | --------- |
181
+ | [Need — e.g., "State management"] | [Current — e.g., "React Context + useReducer"] | Low | [Trigger — e.g., "When state logic spans > 5 components"] | [[DECISIONS#adr-xxx | ADR-XXX]] |
182
+ | [Need — e.g., "API caching"] | [Current — e.g., "No caching"] | Medium | [Trigger — e.g., "When same data fetched > 3 times/session"] | [ADR link or "Not yet decided"] |
183
+ | [Need — e.g., "Search"] | [Current — e.g., "SQL LIKE queries"] | High | [Trigger — e.g., "When full-text search needed or > 100k records"] | [ADR link or "Not yet decided"] |
184
+
185
+ ---
186
+
187
+ ## ✅ Best Practices
188
+
189
+ > Patterns that all code in this project should follow. AI agents reference this section when generating code.
190
+
191
+ ### 1. [Pattern Name — e.g., "API Response Wrapper"]
192
+
193
+ ```tsx
194
+ // DO: Always wrap API responses in the shared ApiResponse<T> type
195
+ // This ensures consistent error handling and type safety across the boundary
196
+
197
+ // DON'T: Return raw data or ad-hoc response shapes
198
+ // This breaks client-side type safety and makes error handling inconsistent
199
+ ```
200
+
201
+ ### 2. [Pattern Name — e.g., "Error Handling"]
202
+
203
+ ```tsx
204
+ // DO: Use typed error classes that map to HTTP status codes
205
+ // This centralizes error handling and ensures consistent API responses
206
+
207
+ // DON'T: Throw generic Error() or return status codes directly from services
208
+ // Services should not know about HTTP; that's the route handler's job
209
+ ```
210
+
211
+ ### 3. [Pattern Name — e.g., "Component Composition"]
212
+
213
+ ```tsx
214
+ // DO: Compose features from small, focused components with clear props
215
+ // This makes components testable, reusable, and easy to understand
216
+
217
+ // DON'T: Create monolithic components that handle rendering, state, and side effects
218
+ // This makes components hard to test, modify, and reason about
219
+ ```
220
+
221
+ ---
222
+
223
+ ## 📊 Performance Implications
224
+
225
+ ### Current Baselines
226
+
227
+ ```
228
+ [Measure and record these after initial implementation. Update as architecture evolves.]
229
+
230
+ Frontend:
231
+ Bundle Size: [X]kb gzipped — [How this compares to budget, e.g., "Target: < 200kb"]
232
+ First Paint: [X]ms — [Measurement conditions, e.g., "3G throttled, Lighthouse"]
233
+ Time to Interactive: [X]ms
234
+
235
+ Backend:
236
+ API Latency: [X]ms p50, [X]ms p95 — [For which endpoints, e.g., "Health check baseline"]
237
+ Throughput: [X] req/s — [Measurement conditions]
238
+
239
+ Build:
240
+ Full Build: [X]s — [All packages from clean state]
241
+ Incremental: [X]s — [Single package change with cache]
242
+ Dev Startup: [X]s — [Time from pnpm dev to ready]
243
+ ```
244
+
245
+ ### Monitoring Checklist
246
+
247
+ - [What to monitor — e.g., "API error rate by endpoint, alert if > 1% over 5 minutes"]
248
+ - [What to monitor — e.g., "Database connection pool usage, alert if > 80% utilized"]
249
+ - [What to monitor — e.g., "Frontend Core Web Vitals via analytics, review weekly"]
250
+ - [What to monitor — e.g., "Dependency vulnerability scan, run daily in CI"]