@mrciphersmith/keryx 0.4.27 → 0.4.28

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 (87) hide show
  1. package/README.md +2 -2
  2. package/dist/cli.js +105165 -104989
  3. package/dist/core.js +21 -197
  4. package/dist/keryx-general-worker-entry.js +22 -201
  5. package/package.json +3 -3
  6. package/src/gdskills/bundled/agents/work-planner.md +1 -1
  7. package/src/gdskills/bundled/install-manifest.json +3 -26
  8. package/src/gdskills/bundled/rules/core/code-review-learned-profile.mdc +1 -2
  9. package/src/gdskills/bundled/rules/core/definition-of-done.mdc +0 -1
  10. package/src/gdskills/bundled/rules/core/implementation-doc-mandate.mdc +4 -5
  11. package/src/gdskills/bundled/rules/core/jobs-documentation.mdc +8 -8
  12. package/src/gdskills/bundled/rules/core/skills-storage-workflow.mdc +7 -10
  13. package/src/gdskills/bundled/skills/core/reviewer-skill-creator/SKILL.md +1 -1
  14. package/src/gdskills/bundled/skills/orchestration/context-collector/SKILL.md +12 -21
  15. package/src/gdskills/bundled/skills/orchestration/feature-analyzer/SKILL.md +3 -3
  16. package/src/gdskills/bundled/skills/orchestration/flow-orchestrator/SKILL.md +1 -1
  17. package/src/gdskills/bundled/skills/orchestration/job-orchestrator/SKILL.md +1 -1
  18. package/src/gdskills/bundled/skills/orchestration/task-implementer/input-contract.schema.json +1 -1
  19. package/src/gdskills/bundled/skills/planning/autodoc-orchestrator/SKILL.md +1 -1
  20. package/src/gdskills/bundled/skills/planning/brainstorm/SKILL.md +1 -1
  21. package/src/gdskills/bundled/skills/planning/interview/SKILL.md +3 -4
  22. package/src/gdskills/bundled/skills/planning/interviewer/SKILL.md +1 -1
  23. package/src/gdskills/bundled/skills/quality/git-publish/SKILL.md +60 -0
  24. package/src/gdskills/bundled/skills/quality/pr-issue-documenter/SKILL.md +1 -1
  25. package/src/gdskills/bundled/skills/review/code-learned-review/SKILL.md +3 -3
  26. package/src/gdskills/bundled/skills/review/review-architecture/SKILL.md +7 -7
  27. package/src/gdskills/bundled/skills/review/review-backend/SKILL.md +22 -22
  28. package/src/gdskills/bundled/skills/review/review-clean-code/SKILL.md +15 -15
  29. package/src/gdskills/bundled/skills/review/review-core-boundaries/SKILL.md +2 -2
  30. package/src/gdskills/bundled/skills/review/review-degradation/SKILL.md +7 -7
  31. package/src/gdskills/bundled/skills/review/review-flow-graph/SKILL.md +2 -2
  32. package/src/gdskills/bundled/skills/review/review-frontend/SKILL.md +34 -30
  33. package/src/gdskills/bundled/skills/review/review-frontend-conventions/SKILL.md +2 -2
  34. package/src/gdskills/bundled/skills/review/review-highload/SKILL.md +64 -135
  35. package/src/gdskills/bundled/skills/review/review-logic/SKILL.md +4 -4
  36. package/src/gdskills/bundled/skills/review/review-orchestrator/SKILL.detail.md +18 -20
  37. package/src/gdskills/bundled/skills/review/review-orchestrator/SKILL.md +12 -18
  38. package/src/gdskills/bundled/skills/review/review-orchestrator/reviewer-finding.schema.json +2 -2
  39. package/src/gdskills/bundled/skills/review/review-orchestrator/reviewer-input.schema.json +2 -10
  40. package/src/gdskills/bundled/skills/review/review-performance/SKILL.md +35 -35
  41. package/src/gdskills/bundled/skills/review/review-pr-contract/SKILL.md +4 -5
  42. package/src/gdskills/bundled/skills/review/review-premise/SKILL.md +2 -2
  43. package/src/gdskills/bundled/skills/review/review-regression/SKILL.md +3 -5
  44. package/src/gdskills/bundled/skills/review/review-security-code/SKILL.md +14 -15
  45. package/src/gdskills/bundled/skills/review/review-style/SKILL.md +14 -13
  46. package/src/gdskills/bundled/skills/review/review-testing-practices/SKILL.md +11 -11
  47. package/src/gdskills/bundled/skills/review/review-ui-ux/SKILL.md +10 -11
  48. package/src/gdskills/bundled/skills/review/review-verifier/SKILL.md +5 -5
  49. package/src/gdskills/bundled/skills/shared/git-merge-base.md +1 -1
  50. package/src/gdskills/bundled/stacks/mobx/agent-refs.json +1 -1
  51. package/src/gdskills/bundled/stacks/mobx/governance/scout.json +2 -2
  52. package/src/gdskills/bundled/stacks/mobx/skills/mobx-store-implementation/SKILL.md +2 -2
  53. package/src/gdskills/bundled/stacks/vue/governance/scout.json +1 -1
  54. package/src/gdskills/contracts/review-finding.schema.json +2 -2
  55. package/src/gdskills/bundled/rules/core/code-review-ai-assistant.mdc +0 -49
  56. package/src/gdskills/bundled/rules/core/gproject-contracts.mdc +0 -198
  57. package/src/gdskills/bundled/skills/orchestration/feature-dev/SKILL.md +0 -177
  58. package/src/gdskills/bundled/skills/orchestration/job-documenter/SKILL.md +0 -414
  59. package/src/gdskills/bundled/skills/orchestration/job-documenter/input-contract.schema.json +0 -55
  60. package/src/gdskills/bundled/skills/orchestration/job-documenter/output-contract.schema.json +0 -58
  61. package/src/gdskills/bundled/skills/planning/consistency-checker/SKILL.codex.md +0 -209
  62. package/src/gdskills/bundled/skills/planning/consistency-checker/SKILL.cursor.md +0 -209
  63. package/src/gdskills/bundled/skills/planning/consistency-checker/SKILL.md +0 -208
  64. package/src/gdskills/bundled/skills/planning/patterns-researcher/SKILL.codex.md +0 -255
  65. package/src/gdskills/bundled/skills/planning/patterns-researcher/SKILL.cursor.md +0 -255
  66. package/src/gdskills/bundled/skills/planning/patterns-researcher/SKILL.md +0 -254
  67. package/src/gdskills/bundled/skills/planning/planner/SKILL.codex.md +0 -209
  68. package/src/gdskills/bundled/skills/planning/planner/SKILL.cursor.md +0 -209
  69. package/src/gdskills/bundled/skills/planning/planner/SKILL.md +0 -208
  70. package/src/gdskills/bundled/skills/planning/problem-definer/SKILL.codex.md +0 -171
  71. package/src/gdskills/bundled/skills/planning/problem-definer/SKILL.cursor.md +0 -171
  72. package/src/gdskills/bundled/skills/planning/problem-definer/SKILL.md +0 -170
  73. package/src/gdskills/bundled/skills/planning/project-discovery/SKILL.codex.md +0 -184
  74. package/src/gdskills/bundled/skills/planning/project-discovery/SKILL.cursor.md +0 -184
  75. package/src/gdskills/bundled/skills/planning/project-discovery/SKILL.md +0 -183
  76. package/src/gdskills/bundled/skills/planning/spec-writer/SKILL.codex.md +0 -249
  77. package/src/gdskills/bundled/skills/planning/spec-writer/SKILL.cursor.md +0 -249
  78. package/src/gdskills/bundled/skills/planning/spec-writer/SKILL.md +0 -248
  79. package/src/gdskills/bundled/skills/planning/stack-advisor/SKILL.codex.md +0 -199
  80. package/src/gdskills/bundled/skills/planning/stack-advisor/SKILL.cursor.md +0 -199
  81. package/src/gdskills/bundled/skills/planning/stack-advisor/SKILL.md +0 -198
  82. package/src/gdskills/bundled/skills/quality/commit/SKILL.md +0 -87
  83. package/src/gdskills/bundled/skills/quality/pr/SKILL.md +0 -95
  84. package/src/gdskills/bundled/skills/quality/push/SKILL.md +0 -73
  85. package/src/gdskills/bundled/skills/review/code-ai-review/SKILL.md +0 -238
  86. package/src/gdskills/bundled/skills/review/code-mobx-store-review/SKILL.md +0 -301
  87. package/src/gdskills/bundled/skills/review/code-style-review/SKILL.md +0 -208
@@ -1,255 +0,0 @@
1
- ---
2
- name: patterns-researcher
3
- description: >
4
- Researches best practices per technology in the chosen stack and defines
5
- application architecture patterns. Produces constraints that PRD must follow.
6
- Use when: dispatched by gproject-orchestrator Phase 3.
7
- NOT for: direct user invocation.
8
- triggers:
9
- - "research patterns"
10
- - "architecture patterns"
11
- - "best practices"
12
- metadata:
13
- version: 1.0.0
14
- compatible_harnesses: "cursor,codex,zed,opencode"
15
- ---
16
-
17
- # gproject-patterns-researcher
18
-
19
- ## Purpose
20
-
21
- After stack is chosen, research and define the specific patterns, conventions,
22
- and architectural decisions for each technology. The output becomes a set of
23
- **binding constraints** that Phase 4 (PRD) must adhere to.
24
-
25
- ## Iron Laws
26
-
27
- | # | Law |
28
- |---|-----|
29
- | 1 | Every pattern MUST reference a source (official docs, community consensus, or established practice) |
30
- | 2 | Patterns MUST be compatible with chosen project level — no enterprise patterns for MVP |
31
- | 3 | Architecture decisions MUST list alternatives considered |
32
- | 4 | NEVER copy-paste generic "best practices" — every recommendation must be contextualized to THIS project |
33
- | 5 | Output MUST be structured as checkable constraints, not prose advice |
34
- | 6 | Existing project patterns (task_in_project) take precedence unless they're antipatterns |
35
-
36
- ## Red Flags
37
-
38
- Stop and re-read this skill if you are thinking:
39
-
40
- | Rationalization | Rebuttal |
41
- |---|---|
42
- | "Clean Architecture is the right answer for any serious project." | Iron Law 2: patterns must fit the chosen level. Layer boundaries and ports-and-adapters on an MVP buy indirection nobody has time to maintain, and Phase 4 is then bound by a constraint that slows every task. |
43
- | "This is standard practice, so it needs no source." | Iron Law 1: every pattern cites official docs, community consensus, or established practice. Uncited standard practice is how a convention three major versions out of date becomes a binding constraint on the PRD. |
44
- | "I picked the best option, so listing the alternatives is padding." | Iron Law 3: architecture decisions list the alternatives considered. Without them, the next person to question the decision has to redo the research, and usually re-decides it differently. |
45
- | "The existing project does this badly, so I'll specify the correct pattern instead." | Iron Law 6: existing patterns win unless they are genuinely antipatterns — and if they are, say so explicitly with the reason. A silent replacement produces a PRD whose constraints contradict the codebase it will be implemented in. |
46
- | "'Use proper error handling' captures the intent well enough." | Iron Law 5: constraints must be checkable. Phase 5 validates the PRD against these line by line; prose advice passes trivially and constrains nothing. |
47
-
48
- ---
49
-
50
- ## Input Contract
51
-
52
- ```yaml
53
- task: "Research per-technology patterns and define application architecture"
54
- input_artifacts:
55
- - .metaproject/jobs/<job>/artifacts/stack-decision.md
56
- - .metaproject/jobs/<job>/artifacts/problem-statement.md
57
- decisions_so_far:
58
- D_level: "..."
59
- D_frontend: "..."
60
- D_backend: "..."
61
- D_database: "..."
62
- D_deploy: "..."
63
- # All stack decisions
64
- ```
65
-
66
- ## Output Contract
67
-
68
- ```yaml
69
- status: "DONE" | "NEEDS_CONTEXT"
70
- summary: "<3-5 sentences: architecture pattern, key per-tech decisions, constraint count>"
71
- new_decisions:
72
- D_arch_pattern: "<e.g., Clean Architecture, Feature-Sliced, MVC>"
73
- D_api_style: "<REST | GraphQL | tRPC | gRPC>"
74
- D_state_management: "<approach>"
75
- D_auth_pattern: "<JWT | session | OAuth flow>"
76
- D_testing_strategy: "<unit + integration + e2e split>"
77
- D_error_handling: "<pattern>"
78
- D_logging_observability: "<approach>"
79
- artifact_path: ".metaproject/jobs/<job>/artifacts/architecture.md"
80
- additional_artifacts:
81
- - ".metaproject/jobs/<job>/artifacts/tech-bestpractices.md"
82
- ```
83
-
84
- ---
85
-
86
- ## Workflow
87
-
88
- ### Step 1: Define Application Architecture
89
-
90
- Based on project level and stack, select architecture pattern:
91
-
92
- | Level | Typical Pattern | Why |
93
- |-------|---------------|-----|
94
- | MVP | Simple layered (routes → services → DB) | Minimum indirection, fast to build |
95
- | Pet | Feature-based modules | Good learning structure |
96
- | Startup | Clean Architecture / Hexagonal | Testable, scalable when team grows |
97
- | Production | DDD + CQRS where justified | Complex domain needs it |
98
-
99
- Document the pattern with:
100
- - Layer diagram (which layers, what goes where)
101
- - Dependency direction (who imports whom)
102
- - Module/feature structure (how to organize code)
103
- - Cross-cutting concerns (logging, auth, error handling)
104
-
105
- ### Step 2: Per-Technology Research
106
-
107
- For EACH technology in the stack, research and document:
108
-
109
- #### Frontend (e.g., Next.js)
110
- - Project structure pattern (App Router conventions, feature folders)
111
- - Component patterns (Server vs Client components, composition)
112
- - State management pattern (chosen approach + why)
113
- - Data fetching pattern (Server Actions, SWR, React Query)
114
- - Styling approach (Tailwind, CSS Modules, styled-components)
115
- - Form handling pattern
116
- - Error boundary strategy
117
- - Testing approach (unit: Vitest, e2e: Playwright)
118
-
119
- #### Backend (e.g., NestJS)
120
- - Module structure pattern
121
- - DTO and validation approach
122
- - Service layer patterns
123
- - Repository / data access pattern
124
- - Error handling (exception filters, typed errors)
125
- - Authentication and authorization pattern
126
- - API versioning strategy
127
- - Testing approach (unit + integration)
128
-
129
- #### Database (e.g., PostgreSQL)
130
- - Schema design approach (normalized vs denormalized for use case)
131
- - Migration strategy and tooling
132
- - Indexing guidelines for expected queries
133
- - Connection pooling approach
134
- - Backup and recovery (if production level)
135
-
136
- #### Infrastructure (e.g., Docker)
137
- - Container structure (multi-stage builds, compose setup)
138
- - Environment management (dev/staging/prod)
139
- - CI/CD pipeline pattern
140
- - Monitoring and logging stack
141
-
142
- ### Step 3: Define API Contract Style
143
-
144
- Based on project needs:
145
- - REST: resource-based, OpenAPI spec, versioning scheme
146
- - GraphQL: schema-first vs code-first, resolver patterns
147
- - tRPC: shared types, router structure
148
- - gRPC: proto file organization, service boundaries
149
-
150
- ### Step 4: Cross-Cutting Patterns
151
-
152
- Define patterns that span all layers:
153
- - **Authentication flow**: complete auth pattern (signup, login, token refresh, logout)
154
- - **Authorization**: RBAC, ABAC, or simple role checks
155
- - **Error handling**: typed errors, error codes, user-facing messages
156
- - **Logging**: structured logging format, log levels, sensitive data masking
157
- - **Validation**: where validation happens (API layer, domain layer, both)
158
- - **Testing**: test pyramid ratios for this project level
159
-
160
- ### Step 5: Write Architecture Doc
161
-
162
- Write `artifacts/architecture.md`:
163
-
164
- ```markdown
165
- # Architecture: <Project/Task Name>
166
-
167
- ## Architecture Pattern: <Pattern Name>
168
- **Rationale**: <why this pattern for this project>
169
- **Alternative considered**: <pattern and why rejected>
170
-
171
- ## Layer Diagram
172
- <describe layers and dependencies>
173
-
174
- ## Module Structure
175
- <how code is organized — by feature, by layer, hybrid>
176
-
177
- ## Component Interaction
178
- <how layers communicate — direct calls, events, DTOs>
179
-
180
- ## Cross-Cutting Concerns
181
- ### Authentication: <pattern>
182
- ### Error Handling: <pattern>
183
- ### Logging: <pattern>
184
- ### Validation: <pattern>
185
-
186
- ## Key Architecture Decisions
187
- | Decision | Choice | Rationale | Alternative |
188
- |----------|--------|-----------|-------------|
189
- | <decision> | <choice> | <why> | <what else> |
190
- ```
191
-
192
- ### Step 6: Write Best Practices Constraints
193
-
194
- Write `artifacts/tech-bestpractices.md` — this is the **constraint document**
195
- that PRD writer must follow:
196
-
197
- ```markdown
198
- # Technical Best Practices & Constraints
199
-
200
- ## How to Use This Document
201
- Every requirement in the PRD MUST be compatible with these constraints.
202
- The consistency-checker (Phase 5) validates PRD against these rules.
203
-
204
- ## Frontend Constraints (<technology>)
205
- ### MUST
206
- - [ ] <constraint 1 — e.g., "Use Server Components by default, Client only when needed">
207
- - [ ] <constraint 2>
208
- ### MUST NOT
209
- - [ ] <antipattern 1 — e.g., "Do not use getServerSideProps in App Router">
210
- - [ ] <antipattern 2>
211
- ### SHOULD
212
- - [ ] <recommendation 1>
213
-
214
- ## Backend Constraints (<technology>)
215
- ### MUST
216
- - [ ] ...
217
- ### MUST NOT
218
- - [ ] ...
219
- ### SHOULD
220
- - [ ] ...
221
-
222
- ## Database Constraints (<technology>)
223
- ### MUST
224
- - [ ] ...
225
- ### MUST NOT
226
- - [ ] ...
227
-
228
- ## API Constraints
229
- ### MUST
230
- - [ ] ...
231
-
232
- ## Infrastructure Constraints
233
- ### MUST
234
- - [ ] ...
235
-
236
- ## Testing Constraints
237
- ### MUST
238
- - [ ] <e.g., "Every API endpoint must have integration test">
239
- - [ ] <e.g., "Critical user flows must have e2e tests">
240
- ### Test Pyramid Target
241
- - Unit: <X>%
242
- - Integration: <Y>%
243
- - E2E: <Z>%
244
-
245
- ## Security Constraints
246
- ### MUST
247
- - [ ] ...
248
- ### MUST NOT
249
- - [ ] ...
250
- ```
251
-
252
- ### Step 7: Return Summary
253
-
254
- Compact summary: architecture pattern, number of constraints defined,
255
- key per-tech decisions, any concerns about pattern compatibility.
@@ -1,255 +0,0 @@
1
- ---
2
- name: patterns-researcher
3
- description: >
4
- Researches best practices per technology in the chosen stack and defines
5
- application architecture patterns. Produces constraints that PRD must follow.
6
- Use when: dispatched by gproject-orchestrator Phase 3.
7
- NOT for: direct user invocation.
8
- triggers:
9
- - "research patterns"
10
- - "architecture patterns"
11
- - "best practices"
12
- metadata:
13
- version: 1.0.0
14
- compatible_harnesses: "cursor,codex,zed,opencode"
15
- ---
16
-
17
- # gproject-patterns-researcher
18
-
19
- ## Purpose
20
-
21
- After stack is chosen, research and define the specific patterns, conventions,
22
- and architectural decisions for each technology. The output becomes a set of
23
- **binding constraints** that Phase 4 (PRD) must adhere to.
24
-
25
- ## Iron Laws
26
-
27
- | # | Law |
28
- |---|-----|
29
- | 1 | Every pattern MUST reference a source (official docs, community consensus, or established practice) |
30
- | 2 | Patterns MUST be compatible with chosen project level — no enterprise patterns for MVP |
31
- | 3 | Architecture decisions MUST list alternatives considered |
32
- | 4 | NEVER copy-paste generic "best practices" — every recommendation must be contextualized to THIS project |
33
- | 5 | Output MUST be structured as checkable constraints, not prose advice |
34
- | 6 | Existing project patterns (task_in_project) take precedence unless they're antipatterns |
35
-
36
- ## Red Flags
37
-
38
- Stop and re-read this skill if you are thinking:
39
-
40
- | Rationalization | Rebuttal |
41
- |---|---|
42
- | "Clean Architecture is the right answer for any serious project." | Iron Law 2: patterns must fit the chosen level. Layer boundaries and ports-and-adapters on an MVP buy indirection nobody has time to maintain, and Phase 4 is then bound by a constraint that slows every task. |
43
- | "This is standard practice, so it needs no source." | Iron Law 1: every pattern cites official docs, community consensus, or established practice. Uncited standard practice is how a convention three major versions out of date becomes a binding constraint on the PRD. |
44
- | "I picked the best option, so listing the alternatives is padding." | Iron Law 3: architecture decisions list the alternatives considered. Without them, the next person to question the decision has to redo the research, and usually re-decides it differently. |
45
- | "The existing project does this badly, so I'll specify the correct pattern instead." | Iron Law 6: existing patterns win unless they are genuinely antipatterns — and if they are, say so explicitly with the reason. A silent replacement produces a PRD whose constraints contradict the codebase it will be implemented in. |
46
- | "'Use proper error handling' captures the intent well enough." | Iron Law 5: constraints must be checkable. Phase 5 validates the PRD against these line by line; prose advice passes trivially and constrains nothing. |
47
-
48
- ---
49
-
50
- ## Input Contract
51
-
52
- ```yaml
53
- task: "Research per-technology patterns and define application architecture"
54
- input_artifacts:
55
- - .metaproject/jobs/<job>/artifacts/stack-decision.md
56
- - .metaproject/jobs/<job>/artifacts/problem-statement.md
57
- decisions_so_far:
58
- D_level: "..."
59
- D_frontend: "..."
60
- D_backend: "..."
61
- D_database: "..."
62
- D_deploy: "..."
63
- # All stack decisions
64
- ```
65
-
66
- ## Output Contract
67
-
68
- ```yaml
69
- status: "DONE" | "NEEDS_CONTEXT"
70
- summary: "<3-5 sentences: architecture pattern, key per-tech decisions, constraint count>"
71
- new_decisions:
72
- D_arch_pattern: "<e.g., Clean Architecture, Feature-Sliced, MVC>"
73
- D_api_style: "<REST | GraphQL | tRPC | gRPC>"
74
- D_state_management: "<approach>"
75
- D_auth_pattern: "<JWT | session | OAuth flow>"
76
- D_testing_strategy: "<unit + integration + e2e split>"
77
- D_error_handling: "<pattern>"
78
- D_logging_observability: "<approach>"
79
- artifact_path: ".metaproject/jobs/<job>/artifacts/architecture.md"
80
- additional_artifacts:
81
- - ".metaproject/jobs/<job>/artifacts/tech-bestpractices.md"
82
- ```
83
-
84
- ---
85
-
86
- ## Workflow
87
-
88
- ### Step 1: Define Application Architecture
89
-
90
- Based on project level and stack, select architecture pattern:
91
-
92
- | Level | Typical Pattern | Why |
93
- |-------|---------------|-----|
94
- | MVP | Simple layered (routes → services → DB) | Minimum indirection, fast to build |
95
- | Pet | Feature-based modules | Good learning structure |
96
- | Startup | Clean Architecture / Hexagonal | Testable, scalable when team grows |
97
- | Production | DDD + CQRS where justified | Complex domain needs it |
98
-
99
- Document the pattern with:
100
- - Layer diagram (which layers, what goes where)
101
- - Dependency direction (who imports whom)
102
- - Module/feature structure (how to organize code)
103
- - Cross-cutting concerns (logging, auth, error handling)
104
-
105
- ### Step 2: Per-Technology Research
106
-
107
- For EACH technology in the stack, research and document:
108
-
109
- #### Frontend (e.g., Next.js)
110
- - Project structure pattern (App Router conventions, feature folders)
111
- - Component patterns (Server vs Client components, composition)
112
- - State management pattern (chosen approach + why)
113
- - Data fetching pattern (Server Actions, SWR, React Query)
114
- - Styling approach (Tailwind, CSS Modules, styled-components)
115
- - Form handling pattern
116
- - Error boundary strategy
117
- - Testing approach (unit: Vitest, e2e: Playwright)
118
-
119
- #### Backend (e.g., NestJS)
120
- - Module structure pattern
121
- - DTO and validation approach
122
- - Service layer patterns
123
- - Repository / data access pattern
124
- - Error handling (exception filters, typed errors)
125
- - Authentication and authorization pattern
126
- - API versioning strategy
127
- - Testing approach (unit + integration)
128
-
129
- #### Database (e.g., PostgreSQL)
130
- - Schema design approach (normalized vs denormalized for use case)
131
- - Migration strategy and tooling
132
- - Indexing guidelines for expected queries
133
- - Connection pooling approach
134
- - Backup and recovery (if production level)
135
-
136
- #### Infrastructure (e.g., Docker)
137
- - Container structure (multi-stage builds, compose setup)
138
- - Environment management (dev/staging/prod)
139
- - CI/CD pipeline pattern
140
- - Monitoring and logging stack
141
-
142
- ### Step 3: Define API Contract Style
143
-
144
- Based on project needs:
145
- - REST: resource-based, OpenAPI spec, versioning scheme
146
- - GraphQL: schema-first vs code-first, resolver patterns
147
- - tRPC: shared types, router structure
148
- - gRPC: proto file organization, service boundaries
149
-
150
- ### Step 4: Cross-Cutting Patterns
151
-
152
- Define patterns that span all layers:
153
- - **Authentication flow**: complete auth pattern (signup, login, token refresh, logout)
154
- - **Authorization**: RBAC, ABAC, or simple role checks
155
- - **Error handling**: typed errors, error codes, user-facing messages
156
- - **Logging**: structured logging format, log levels, sensitive data masking
157
- - **Validation**: where validation happens (API layer, domain layer, both)
158
- - **Testing**: test pyramid ratios for this project level
159
-
160
- ### Step 5: Write Architecture Doc
161
-
162
- Write `artifacts/architecture.md`:
163
-
164
- ```markdown
165
- # Architecture: <Project/Task Name>
166
-
167
- ## Architecture Pattern: <Pattern Name>
168
- **Rationale**: <why this pattern for this project>
169
- **Alternative considered**: <pattern and why rejected>
170
-
171
- ## Layer Diagram
172
- <describe layers and dependencies>
173
-
174
- ## Module Structure
175
- <how code is organized — by feature, by layer, hybrid>
176
-
177
- ## Component Interaction
178
- <how layers communicate — direct calls, events, DTOs>
179
-
180
- ## Cross-Cutting Concerns
181
- ### Authentication: <pattern>
182
- ### Error Handling: <pattern>
183
- ### Logging: <pattern>
184
- ### Validation: <pattern>
185
-
186
- ## Key Architecture Decisions
187
- | Decision | Choice | Rationale | Alternative |
188
- |----------|--------|-----------|-------------|
189
- | <decision> | <choice> | <why> | <what else> |
190
- ```
191
-
192
- ### Step 6: Write Best Practices Constraints
193
-
194
- Write `artifacts/tech-bestpractices.md` — this is the **constraint document**
195
- that PRD writer must follow:
196
-
197
- ```markdown
198
- # Technical Best Practices & Constraints
199
-
200
- ## How to Use This Document
201
- Every requirement in the PRD MUST be compatible with these constraints.
202
- The consistency-checker (Phase 5) validates PRD against these rules.
203
-
204
- ## Frontend Constraints (<technology>)
205
- ### MUST
206
- - [ ] <constraint 1 — e.g., "Use Server Components by default, Client only when needed">
207
- - [ ] <constraint 2>
208
- ### MUST NOT
209
- - [ ] <antipattern 1 — e.g., "Do not use getServerSideProps in App Router">
210
- - [ ] <antipattern 2>
211
- ### SHOULD
212
- - [ ] <recommendation 1>
213
-
214
- ## Backend Constraints (<technology>)
215
- ### MUST
216
- - [ ] ...
217
- ### MUST NOT
218
- - [ ] ...
219
- ### SHOULD
220
- - [ ] ...
221
-
222
- ## Database Constraints (<technology>)
223
- ### MUST
224
- - [ ] ...
225
- ### MUST NOT
226
- - [ ] ...
227
-
228
- ## API Constraints
229
- ### MUST
230
- - [ ] ...
231
-
232
- ## Infrastructure Constraints
233
- ### MUST
234
- - [ ] ...
235
-
236
- ## Testing Constraints
237
- ### MUST
238
- - [ ] <e.g., "Every API endpoint must have integration test">
239
- - [ ] <e.g., "Critical user flows must have e2e tests">
240
- ### Test Pyramid Target
241
- - Unit: <X>%
242
- - Integration: <Y>%
243
- - E2E: <Z>%
244
-
245
- ## Security Constraints
246
- ### MUST
247
- - [ ] ...
248
- ### MUST NOT
249
- - [ ] ...
250
- ```
251
-
252
- ### Step 7: Return Summary
253
-
254
- Compact summary: architecture pattern, number of constraints defined,
255
- key per-tech decisions, any concerns about pattern compatibility.