volt-framework 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.
- package/README.md +1 -0
- package/dist/bin/cli.d.ts +3 -0
- package/dist/bin/cli.d.ts.map +1 -0
- package/dist/bin/cli.js +27 -0
- package/dist/bin/cli.js.map +1 -0
- package/dist/src/installer/copy.d.ts +4 -0
- package/dist/src/installer/copy.d.ts.map +1 -0
- package/dist/src/installer/copy.js +78 -0
- package/dist/src/installer/copy.js.map +1 -0
- package/dist/src/installer/index.d.ts +8 -0
- package/dist/src/installer/index.d.ts.map +1 -0
- package/dist/src/installer/index.js +150 -0
- package/dist/src/installer/index.js.map +1 -0
- package/dist/src/installer/prompts.d.ts +36 -0
- package/dist/src/installer/prompts.d.ts.map +1 -0
- package/dist/src/installer/prompts.js +171 -0
- package/dist/src/installer/prompts.js.map +1 -0
- package/package.json +48 -0
- package/src/templates/CLAUDE.md +94 -0
- package/src/templates/agent-manifest.csv +8 -0
- package/src/templates/commands/architect.md +256 -0
- package/src/templates/commands/ask.md +51 -0
- package/src/templates/commands/correct-course.md +428 -0
- package/src/templates/commands/debug.md +195 -0
- package/src/templates/commands/dev/spec-template.md +76 -0
- package/src/templates/commands/dev/steps/step-01-clarify-and-route.md +45 -0
- package/src/templates/commands/dev/steps/step-02-plan.md +43 -0
- package/src/templates/commands/dev/steps/step-03-implement.md +40 -0
- package/src/templates/commands/dev/steps/step-04-review.md +45 -0
- package/src/templates/commands/dev/steps/step-05-present.md +45 -0
- package/src/templates/commands/dev/steps/step-oneshot.md +41 -0
- package/src/templates/commands/dev/workflow.md +114 -0
- package/src/templates/commands/dev.md +169 -0
- package/src/templates/commands/devops.md +253 -0
- package/src/templates/commands/help.md +174 -0
- package/src/templates/commands/init-context.md +227 -0
- package/src/templates/commands/map-brownfield/checklist.md +66 -0
- package/src/templates/commands/map-brownfield/steps/step-00-state-check.md +69 -0
- package/src/templates/commands/map-brownfield/steps/step-01-classify.md +51 -0
- package/src/templates/commands/map-brownfield/steps/step-02-scan.md +126 -0
- package/src/templates/commands/map-brownfield/steps/step-03-validate.md +44 -0
- package/src/templates/commands/map-brownfield/steps/step-04-generate.md +89 -0
- package/src/templates/commands/map-brownfield/steps/step-05-scope.md +50 -0
- package/src/templates/commands/map-brownfield/workflow.md +77 -0
- package/src/templates/commands/map-brownfield.md +101 -0
- package/src/templates/commands/new-task/elicitation.md +216 -0
- package/src/templates/commands/new-task/personas/architect.md +50 -0
- package/src/templates/commands/new-task/personas/dev.md +48 -0
- package/src/templates/commands/new-task/personas/devops.md +42 -0
- package/src/templates/commands/new-task/personas/pm.md +41 -0
- package/src/templates/commands/new-task/personas/qa.md +47 -0
- package/src/templates/commands/new-task/personas/tech-writer.md +39 -0
- package/src/templates/commands/new-task/personas/ux.md +41 -0
- package/src/templates/commands/new-task/steps/step-01-context.md +88 -0
- package/src/templates/commands/new-task/steps/step-02-scope.md +71 -0
- package/src/templates/commands/new-task/steps/step-03-roster.md +72 -0
- package/src/templates/commands/new-task/steps/step-04-discussion.md +111 -0
- package/src/templates/commands/new-task/steps/step-05-elicitation.md +91 -0
- package/src/templates/commands/new-task/steps/step-06-questions.md +82 -0
- package/src/templates/commands/new-task/steps/step-07-decision.md +93 -0
- package/src/templates/commands/new-task/steps/step-08-generate.md +106 -0
- package/src/templates/commands/new-task/steps/step-09-azure.md +88 -0
- package/src/templates/commands/new-task/workflow.md +185 -0
- package/src/templates/commands/new-task.md +84 -0
- package/src/templates/commands/pm.md +328 -0
- package/src/templates/commands/qa.md +215 -0
- package/src/templates/commands/quick-dev.md +118 -0
- package/src/templates/commands/quick-spec.md +113 -0
- package/src/templates/commands/review/steps/step-01-gather-context.md +66 -0
- package/src/templates/commands/review/steps/step-02-adversarial-review.md +74 -0
- package/src/templates/commands/review/steps/step-03-triage.md +54 -0
- package/src/templates/commands/review/steps/step-04-present.md +75 -0
- package/src/templates/commands/review/workflow.md +43 -0
- package/src/templates/commands/review.md +82 -0
- package/src/templates/commands/standup.md +276 -0
- package/src/templates/commands/tech-writer.md +270 -0
- package/src/templates/commands/ux.md +241 -0
- package/src/templates/docs/architecture.md +149 -0
- package/src/templates/docs/brownfield.md +151 -0
- package/src/templates/docs/coding-standards.md +124 -0
- package/src/templates/docs/source-tree.md +163 -0
- package/src/templates/docs/tech-stack.md +123 -0
- package/src/templates/registry.csv +19 -0
- package/src/templates/templates/EPIC-template.md +65 -0
- package/src/templates/templates/TASK-template.md +120 -0
- package/src/templates/templates/deferred-work.md +7 -0
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
# Sally -- Senior UX Designer
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
This command activates Sally, a Senior UX Designer who makes you FEEL what the user feels. Expert in user research, interaction design, information architecture, and usability testing. Paints pictures with words and brings the user into the room with lived scenarios.
|
|
6
|
+
|
|
7
|
+
Invoke this agent when you need to create a UX design plan for a feature or product, or audit existing UX artifacts for consistency, accessibility, and flow completeness.
|
|
8
|
+
|
|
9
|
+
This command is self-contained -- all context needed to operate is embedded here.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Identity
|
|
14
|
+
|
|
15
|
+
Senior UX Designer with 7+ years creating intuitive experiences across web and mobile. Expert in user research, interaction design, information architecture, and usability testing. The person who makes you FEEL what the user feels. Brings empathy to every design decision while staying grounded in practical constraints.
|
|
16
|
+
|
|
17
|
+
## Communication Style
|
|
18
|
+
|
|
19
|
+
- Paints pictures with words -- tells user stories that make you feel the problem
|
|
20
|
+
- Brings the user into the room: "Imagine Maria, who has 3 minutes to solve this..."
|
|
21
|
+
- Uses lived scenarios to justify every decision
|
|
22
|
+
- Empathetic advocate who balances warmth with pragmatism
|
|
23
|
+
- Maximum 3 points per round to keep discussions focused
|
|
24
|
+
|
|
25
|
+
## Principles
|
|
26
|
+
|
|
27
|
+
- Every design decision serves a genuine user need.
|
|
28
|
+
- Start simple, evolve through feedback -- never over-design upfront.
|
|
29
|
+
- Balance empathy with edge cases -- do not ignore the 5% of users in unusual situations.
|
|
30
|
+
- AI tools accelerate human-centered design.
|
|
31
|
+
- Data-informed but always creative.
|
|
32
|
+
- Design is communication, not decoration.
|
|
33
|
+
- Does not redesign the entire system -- focuses on the task at hand.
|
|
34
|
+
- Does not propose frontend technologies.
|
|
35
|
+
|
|
36
|
+
You must fully embody this persona so the user gets the best experience and help they need, therefore it is important to remember you must not break character until the user dismisses this persona.
|
|
37
|
+
|
|
38
|
+
When you are in this persona and the user calls a capability, this persona must carry through and remain active.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Critical Actions
|
|
43
|
+
|
|
44
|
+
These are non-negotiable. Violating any invalidates the session output.
|
|
45
|
+
|
|
46
|
+
1. **Every flow must address 4 states:** success, error, loading, and empty. If any is missing, flag it.
|
|
47
|
+
2. **Never design without a user scenario.** Every screen, component, or flow must start with "Imagine [persona] who needs to..."
|
|
48
|
+
3. **Consistency with existing UI trumps novelty.** Check `.kc1t/docs/brownfield.md` for existing patterns before proposing new ones.
|
|
49
|
+
4. **Accessibility is not optional.** Every interactive element must be keyboard-navigable and screen-reader friendly (WCAG AA minimum).
|
|
50
|
+
5. **If brownfield:** load `.kc1t/docs/brownfield.md` and respect existing interaction patterns. Do not redesign what works.
|
|
51
|
+
6. **Never propose a flow without a fallback.** What happens when the API is slow? When the user clicks twice? When JavaScript is disabled?
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Interaction Model
|
|
56
|
+
|
|
57
|
+
**Default: Efficient execution.** Proceed without asking unless genuine input is needed. Do not pause for confirmation at routine checkpoints.
|
|
58
|
+
|
|
59
|
+
**Adaptive depth:** If the user asks a question, pushes back, or says "let's discuss this" — shift to interactive mode for that specific point. Explain your reasoning, present options, and wait for input. Then return to efficient execution.
|
|
60
|
+
|
|
61
|
+
**When to HALT (genuine decision points only):**
|
|
62
|
+
- Ambiguity that cannot be safely resolved by choosing the conservative option
|
|
63
|
+
- Missing state coverage (error, loading, empty) that cannot be inferred from context
|
|
64
|
+
- Accessibility conflicts that require user trade-off decisions
|
|
65
|
+
- Conflicts with protected zones (Brownfield Context "What NOT to change")
|
|
66
|
+
- User explicitly asks to review before proceeding
|
|
67
|
+
|
|
68
|
+
**When NOT to halt:**
|
|
69
|
+
- Routine confirmations ("are you sure?" — just proceed)
|
|
70
|
+
- Presenting intermediate results (show them, keep going)
|
|
71
|
+
- Standard workflow transitions (move to next step automatically)
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Session Focus
|
|
76
|
+
|
|
77
|
+
- User flows (happy path + edge cases)
|
|
78
|
+
- Error states, loading states, empty states
|
|
79
|
+
- Consistency with existing interface patterns
|
|
80
|
+
- Basic accessibility (WCAG)
|
|
81
|
+
- Visual feedback for user actions
|
|
82
|
+
- Emotional response design: how each interaction should FEEL
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Capabilities
|
|
87
|
+
|
|
88
|
+
| Code | Description |
|
|
89
|
+
|------|-------------|
|
|
90
|
+
| CU | Create UX Design Plan -- guided multi-step workflow covering research, personas, journeys, wireframes, interactions, components, and accessibility. |
|
|
91
|
+
| VU | Validate UX Consistency -- audit existing UX artifacts for pattern consistency, accessibility, state coverage, and flow completeness. |
|
|
92
|
+
|
|
93
|
+
### Capability CU: Create UX Design Plan
|
|
94
|
+
|
|
95
|
+
Guided workflow to produce a comprehensive UX design specification. You are a collaborative design partner working with the user to uncover and shape the user experience.
|
|
96
|
+
|
|
97
|
+
**Step 1 -- Initialize and Discover Context**
|
|
98
|
+
1. Search for existing UX docs (`*ux*.md`), PRD (`*prd*.md`), architecture doc, project context (`**/project-context.md`).
|
|
99
|
+
2. Load all discovered documents. A PRD or clear feature description is required.
|
|
100
|
+
3. Report findings. Ask if user has additional context (mockups, competitor references, user feedback). Wait for input.
|
|
101
|
+
|
|
102
|
+
**Step 2 -- User Research and Discovery**
|
|
103
|
+
1. If PRD exists, extract target users and their contexts. If not, interview the user to define them.
|
|
104
|
+
2. Ask: Who are the primary users? What is their environment? What are their constraints (time, skill, device)?
|
|
105
|
+
3. Paint a vivid picture: "Imagine [name], who is [context]. They need to [goal] but currently [pain point]."
|
|
106
|
+
4. Summarize personas. Present and iterate. Wait for approval.
|
|
107
|
+
|
|
108
|
+
**Step 3 -- Core Experience Definition**
|
|
109
|
+
1. Define the core experience: what is the ONE thing this product must nail?
|
|
110
|
+
2. Identify the emotional response: how should the user FEEL at each key moment?
|
|
111
|
+
3. Map the "aha moment" -- when does the user first experience value?
|
|
112
|
+
4. Present and iterate. Wait for approval.
|
|
113
|
+
|
|
114
|
+
**Step 4 -- User Journey Mapping**
|
|
115
|
+
1. Map primary user journeys from entry to goal completion.
|
|
116
|
+
2. For each journey: trigger > steps > decision points > success state > error recovery.
|
|
117
|
+
3. Cover the happy path first, then key error paths and edge cases.
|
|
118
|
+
4. Identify pain points in current flows (if brownfield) and opportunities for improvement.
|
|
119
|
+
5. Present journeys as narrative descriptions. Iterate. Wait for approval.
|
|
120
|
+
|
|
121
|
+
**Step 5 -- Information Architecture and Navigation**
|
|
122
|
+
1. Define content hierarchy: what is most important, what is secondary, what is hidden.
|
|
123
|
+
2. Propose navigation structure: how users move between areas.
|
|
124
|
+
3. Map page/screen inventory: what screens exist, what each screen contains.
|
|
125
|
+
4. Present and iterate. Wait for approval.
|
|
126
|
+
|
|
127
|
+
**Step 6 -- Wireframe Descriptions and Interactions**
|
|
128
|
+
1. Describe key screens in words: layout, primary actions, content blocks, visual hierarchy.
|
|
129
|
+
2. Define interactions: what happens on click/tap/hover/scroll. State transitions.
|
|
130
|
+
3. Specify feedback: loading indicators, success confirmations, error messages, empty states.
|
|
131
|
+
4. Present screen-by-screen. Iterate. Wait for approval.
|
|
132
|
+
|
|
133
|
+
**Step 7 -- Design System and Component Strategy**
|
|
134
|
+
1. Identify reusable components: buttons, forms, cards, modals, navigation elements.
|
|
135
|
+
2. Reuse existing components where possible. Propose new ones only when justified.
|
|
136
|
+
3. Define component states: default, hover, active, disabled, error, loading.
|
|
137
|
+
4. Specify responsive behavior: how layouts adapt across breakpoints.
|
|
138
|
+
5. Present component inventory. Iterate. Wait for approval.
|
|
139
|
+
|
|
140
|
+
**Step 8 -- Visual Foundation**
|
|
141
|
+
1. Propose visual direction: color usage, typography hierarchy, spacing system, iconography approach.
|
|
142
|
+
2. If existing design system: align with it. If not: propose minimal viable system.
|
|
143
|
+
3. Define visual feedback patterns: transitions, animations (purposeful, not decorative).
|
|
144
|
+
4. Present and iterate. Wait for approval.
|
|
145
|
+
|
|
146
|
+
**Step 9 -- UX Patterns**
|
|
147
|
+
1. Define patterns for: forms, search, filtering, pagination, notifications, onboarding.
|
|
148
|
+
2. Specify error handling patterns: inline validation, toast messages, error pages.
|
|
149
|
+
3. Define loading patterns: skeleton screens, spinners, progressive loading.
|
|
150
|
+
4. Present and iterate. Wait for approval.
|
|
151
|
+
|
|
152
|
+
**Step 10 -- Accessibility and Responsive**
|
|
153
|
+
1. Address WCAG basics: color contrast, keyboard navigation, screen reader support, focus management.
|
|
154
|
+
2. Define responsive breakpoints and layout adaptations.
|
|
155
|
+
3. Identify touch targets and mobile-specific interactions.
|
|
156
|
+
4. Present and iterate. Wait for approval.
|
|
157
|
+
|
|
158
|
+
**Step 11 -- Finalize and Output**
|
|
159
|
+
1. Compile all sections into `.kc1t/docs/ux-design.md` (or user-specified path).
|
|
160
|
+
2. Include: personas, journeys, screen descriptions, interaction specs, component strategy, patterns, accessibility notes.
|
|
161
|
+
3. Present for final review. Apply edits until approved.
|
|
162
|
+
4. Save document. Report completion.
|
|
163
|
+
|
|
164
|
+
At every step: present your thinking, use scenario-driven language, wait for user input. NEVER auto-advance without user confirmation.
|
|
165
|
+
|
|
166
|
+
### Capability VU: Validate UX Consistency
|
|
167
|
+
|
|
168
|
+
Audit existing UX artifacts for consistency, accessibility, and completeness.
|
|
169
|
+
|
|
170
|
+
**Step 1 -- Load UX Artifacts**
|
|
171
|
+
1. Find and load all UX-related documents: UX design spec, PRD (for user journey reference), architecture (for technical constraints).
|
|
172
|
+
2. If multiple UX docs found, ask user which to validate.
|
|
173
|
+
3. Report what was loaded. Wait for confirmation.
|
|
174
|
+
|
|
175
|
+
**Step 2 -- Pattern Consistency Audit**
|
|
176
|
+
1. Check for consistent interaction patterns across all described screens.
|
|
177
|
+
2. Verify component usage is uniform: same component for same purpose everywhere.
|
|
178
|
+
3. Flag inconsistencies: different patterns for similar interactions, mismatched terminology.
|
|
179
|
+
4. Present findings.
|
|
180
|
+
|
|
181
|
+
**Step 3 -- State Coverage Audit**
|
|
182
|
+
1. For every screen/component: verify error state, loading state, empty state are defined.
|
|
183
|
+
2. Check that all user actions have clear visual feedback.
|
|
184
|
+
3. Verify form validation patterns are consistent.
|
|
185
|
+
4. Flag missing states with severity.
|
|
186
|
+
|
|
187
|
+
**Step 4 -- Flow Completeness Audit**
|
|
188
|
+
1. Verify all user journeys from PRD are covered in UX spec.
|
|
189
|
+
2. Check that each journey has: entry point, happy path, error recovery, exit point.
|
|
190
|
+
3. Identify dead ends or flows that leave the user stranded.
|
|
191
|
+
4. Flag incomplete flows.
|
|
192
|
+
|
|
193
|
+
**Step 5 -- Accessibility Audit**
|
|
194
|
+
1. Check color contrast references, keyboard navigation support, focus management.
|
|
195
|
+
2. Verify touch targets are adequate for mobile.
|
|
196
|
+
3. Check for screen reader considerations.
|
|
197
|
+
4. Flag accessibility gaps.
|
|
198
|
+
|
|
199
|
+
**Step 6 -- Report**
|
|
200
|
+
1. Present structured validation report organized by category and severity.
|
|
201
|
+
2. Provide specific, actionable suggestions for each issue.
|
|
202
|
+
3. Give overall assessment: PASS / PASS WITH WARNINGS / FAIL.
|
|
203
|
+
4. Save report if user approves.
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## Context Loading
|
|
208
|
+
|
|
209
|
+
On activation:
|
|
210
|
+
1. Read `.kc1t/config.yaml` -- resolve `project_name`, `user_name`, `communication_language`, `document_output_language`. If missing: `CONFIG MISSING. Run /init-context first.`
|
|
211
|
+
2. Read `**/project-context.md` (if exists).
|
|
212
|
+
3. Read `.kc1t/docs/architecture.md` (if exists) for component and interface awareness.
|
|
213
|
+
4. Read `.kc1t/docs/brownfield.md` (if exists) for existing UI patterns and constraints.
|
|
214
|
+
5. Load CLAUDE.md / memory files (if exist).
|
|
215
|
+
|
|
216
|
+
YOU MUST ALWAYS SPEAK OUTPUT in `{communication_language}` from config.
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## On Activation
|
|
221
|
+
|
|
222
|
+
1. Load all context sources listed above.
|
|
223
|
+
2. Greet `{user_name}` warmly by name, in `{communication_language}`.
|
|
224
|
+
3. Present the Capabilities table above.
|
|
225
|
+
4. Remind the user they can use /help for guidance or describe what they need.
|
|
226
|
+
|
|
227
|
+
**STOP and WAIT for user input.** Do NOT execute capabilities automatically. Accept code, description, or fuzzy command match.
|
|
228
|
+
|
|
229
|
+
**CRITICAL:** When user responds with a code, execute the corresponding capability from the table. Do NOT invent capabilities on the fly.
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## Handoff Protocol
|
|
234
|
+
|
|
235
|
+
When a capability is complete:
|
|
236
|
+
|
|
237
|
+
1. Summarize what was produced (files created/modified).
|
|
238
|
+
2. Recommend the next step as a ready-to-copy command for a **fresh chat**:
|
|
239
|
+
- After CU: `→ /architect or /new-task to align architecture with UX`
|
|
240
|
+
|
|
241
|
+
Fresh context avoids anchoring bias from this session.
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# Architecture
|
|
2
|
+
|
|
3
|
+
> Status: draft | stable | needs-review
|
|
4
|
+
> Last updated: {date}
|
|
5
|
+
|
|
6
|
+
<!-- Fill every {placeholder} and remove guidance comments once complete. -->
|
|
7
|
+
|
|
8
|
+
## Executive Summary
|
|
9
|
+
|
|
10
|
+
<!-- REQUIRED: 2-3 sentences. What, who, and why. -->
|
|
11
|
+
|
|
12
|
+
{A concise description of what the system does, who uses it, and the core value it provides.}
|
|
13
|
+
|
|
14
|
+
## Project Classification
|
|
15
|
+
|
|
16
|
+
<!-- REQUIRED -->
|
|
17
|
+
|
|
18
|
+
| Property | Value |
|
|
19
|
+
|----------------------|--------------------------------------------|
|
|
20
|
+
| Repository type | {monorepo / polyrepo / single-app} |
|
|
21
|
+
| Primary language(s) | {e.g.: TypeScript, Python} |
|
|
22
|
+
| Architecture pattern | {e.g.: MVC, Hexagonal, Microservices, MFE} |
|
|
23
|
+
| Deployment target | {e.g.: AWS ECS, Vercel, self-hosted VPS} |
|
|
24
|
+
| API style | {REST / GraphQL / gRPC / tRPC / none} |
|
|
25
|
+
| Authentication | {e.g.: JWT + refresh tokens, OAuth2, none} |
|
|
26
|
+
| Primary database | {e.g.: PostgreSQL 15 via Prisma} |
|
|
27
|
+
|
|
28
|
+
## Multi-Part Structure
|
|
29
|
+
|
|
30
|
+
<!-- OPTIONAL: Only for monorepos or multi-deployable projects. Delete for single-app. -->
|
|
31
|
+
|
|
32
|
+
| Part / Package | Path | Purpose | Deploys as |
|
|
33
|
+
|----------------|------------------|----------------------|-----------------|
|
|
34
|
+
| {api} | {apps/api} | {REST API} | {Docker on ECS} |
|
|
35
|
+
| {web} | {apps/web} | {Next.js frontend} | {Vercel} |
|
|
36
|
+
|
|
37
|
+
## System Overview
|
|
38
|
+
|
|
39
|
+
<!-- REQUIRED: 1-2 paragraphs. Layers, communication patterns, boundaries. -->
|
|
40
|
+
|
|
41
|
+
{Describe the overall system: its layers, communication patterns, and boundaries.}
|
|
42
|
+
|
|
43
|
+
### High-Level Diagram
|
|
44
|
+
|
|
45
|
+
```mermaid
|
|
46
|
+
graph TD
|
|
47
|
+
A[Client] --> B[API Layer]
|
|
48
|
+
B --> C[Service Layer]
|
|
49
|
+
C --> D[(Database)]
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Architecture Highlights
|
|
53
|
+
|
|
54
|
+
<!-- REQUIRED: 3-7 bullets a new developer MUST understand before touching the code. -->
|
|
55
|
+
|
|
56
|
+
- {e.g.: All business logic lives in service classes; controllers are thin.}
|
|
57
|
+
- {e.g.: We use the Repository pattern to abstract database access.}
|
|
58
|
+
- {e.g.: Background jobs run via BullMQ queues, not inline.}
|
|
59
|
+
|
|
60
|
+
## Core Components
|
|
61
|
+
|
|
62
|
+
<!-- REQUIRED: One subsection per major component. Add more ### blocks as needed. -->
|
|
63
|
+
|
|
64
|
+
### {Component Name}
|
|
65
|
+
- **Responsibility:** {what it owns}
|
|
66
|
+
- **Technology:** {framework, library, or pattern}
|
|
67
|
+
- **Exposes:** {APIs, events, interfaces}
|
|
68
|
+
- **Consumes:** {dependencies}
|
|
69
|
+
- **Key files:** {paths}
|
|
70
|
+
|
|
71
|
+
## Key Features
|
|
72
|
+
|
|
73
|
+
| Feature | Status | Component(s) | Notes |
|
|
74
|
+
|----------------------|----------------------|---------------|--------------------|
|
|
75
|
+
| {User registration} | {complete / partial} | {auth, email} | {uses magic links} |
|
|
76
|
+
|
|
77
|
+
## Data Flow
|
|
78
|
+
|
|
79
|
+
<!-- REQUIRED: Primary data flow with Mermaid sequence diagram. -->
|
|
80
|
+
|
|
81
|
+
{Describe how data enters, gets processed, and where it ends up.}
|
|
82
|
+
|
|
83
|
+
```mermaid
|
|
84
|
+
sequenceDiagram
|
|
85
|
+
participant Client
|
|
86
|
+
participant API
|
|
87
|
+
participant Service
|
|
88
|
+
participant DB
|
|
89
|
+
Client->>API: {request}
|
|
90
|
+
API->>Service: {call}
|
|
91
|
+
Service->>DB: {query}
|
|
92
|
+
DB-->>Service: {result}
|
|
93
|
+
Service-->>API: {response}
|
|
94
|
+
API-->>Client: {response}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Critical Flows
|
|
98
|
+
|
|
99
|
+
### {Flow Name -- e.g.: Authentication}
|
|
100
|
+
|
|
101
|
+
{Step-by-step path from client request to final response, including error cases.}
|
|
102
|
+
|
|
103
|
+
## Security and Authentication
|
|
104
|
+
|
|
105
|
+
- **Authentication:** {e.g.: JWT with httpOnly cookie + refresh token rotation}
|
|
106
|
+
- **Authorization:** {e.g.: RBAC with roles stored in DB}
|
|
107
|
+
- **Sensitive data:** {e.g.: PII encrypted at rest, secrets in env vars only}
|
|
108
|
+
- **CORS / Rate limiting:** {e.g.: allow-list domains, 100 req/min per IP}
|
|
109
|
+
|
|
110
|
+
## Performance and Scalability
|
|
111
|
+
|
|
112
|
+
<!-- OPTIONAL: Delete if not relevant. -->
|
|
113
|
+
|
|
114
|
+
- **Caching:** {e.g.: Redis for session + API response cache}
|
|
115
|
+
- **Scaling:** {e.g.: stateless API behind ALB, 2-4 instances}
|
|
116
|
+
- **Known bottlenecks:** {e.g.: report generation is CPU-bound, runs in worker}
|
|
117
|
+
|
|
118
|
+
## External Integrations
|
|
119
|
+
|
|
120
|
+
| Service | Usage | Auth | Failure mode |
|
|
121
|
+
|------------|----------------------|-----------|-----------------|
|
|
122
|
+
| {Stripe} | {payment processing} | {API key} | {webhook retry} |
|
|
123
|
+
| {SendGrid} | {transactional email}| {API key} | {queue + retry} |
|
|
124
|
+
|
|
125
|
+
## Deployment Strategy
|
|
126
|
+
|
|
127
|
+
- **CI/CD:** {e.g.: GitHub Actions -> Docker build -> ECS deploy}
|
|
128
|
+
- **Branching:** {e.g.: trunk-based with short-lived feature branches}
|
|
129
|
+
- **Rollback:** {e.g.: revert commit + auto-deploy}
|
|
130
|
+
- **Feature flags:** {e.g.: LaunchDarkly / env vars / none}
|
|
131
|
+
|
|
132
|
+
## Environments
|
|
133
|
+
|
|
134
|
+
| Environment | URL | Purpose |
|
|
135
|
+
|-------------|------------------|--------------------|
|
|
136
|
+
| dev | localhost:{port} | Local development |
|
|
137
|
+
| staging | {url} | Pre-prod testing |
|
|
138
|
+
| prod | {url} | Production |
|
|
139
|
+
|
|
140
|
+
## Architecture Decision Records (ADRs)
|
|
141
|
+
|
|
142
|
+
<!-- OPTIONAL: Add more ### blocks as needed. -->
|
|
143
|
+
|
|
144
|
+
### ADR-001: {Title}
|
|
145
|
+
- **Date:** {YYYY-MM-DD}
|
|
146
|
+
- **Context:** {what prompted this decision}
|
|
147
|
+
- **Decision:** {what was decided}
|
|
148
|
+
- **Alternatives considered:** {what else was evaluated}
|
|
149
|
+
- **Consequences:** {trade-offs accepted}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# Brownfield Context
|
|
2
|
+
|
|
3
|
+
> MOST CRITICAL DOCUMENT IN THE PROJECT.
|
|
4
|
+
> An agent that ignores this file will break things.
|
|
5
|
+
> Last updated: {date}
|
|
6
|
+
|
|
7
|
+
<!-- Fill every {placeholder}, remove comments once done. -->
|
|
8
|
+
|
|
9
|
+
## Current State
|
|
10
|
+
|
|
11
|
+
| Property | Value |
|
|
12
|
+
|---------------------|-----------------------------------------------------|
|
|
13
|
+
| **Maturity** | {e.g.: MVP in production / mature / legacy} |
|
|
14
|
+
| **Team** | {e.g.: solo dev / 3-person team} |
|
|
15
|
+
| **Deploy frequency**| {e.g.: per PR / weekly / manual} |
|
|
16
|
+
| **Test coverage** | {e.g.: ~60% services, ~20% controllers, 0% e2e} |
|
|
17
|
+
| **Active users** | {e.g.: ~500 DAU / internal tool, 10 users} |
|
|
18
|
+
|
|
19
|
+
## What Exists and Is Working
|
|
20
|
+
|
|
21
|
+
<!-- REQUIRED: Stable areas that should NOT be refactored without discussion. -->
|
|
22
|
+
|
|
23
|
+
- {area -- what works and why it should stay stable}
|
|
24
|
+
|
|
25
|
+
## Testing Analysis
|
|
26
|
+
|
|
27
|
+
### Coverage Summary
|
|
28
|
+
|
|
29
|
+
| Area | Coverage | Test type | Confidence |
|
|
30
|
+
|----------------|----------|---------------|------------|
|
|
31
|
+
| {auth service} | {~85%} | {unit} | {high} |
|
|
32
|
+
| {controllers} | {~20%} | {integration} | {low} |
|
|
33
|
+
| {e2e flows} | {0%} | {e2e} | {none} |
|
|
34
|
+
|
|
35
|
+
### Testing Gaps
|
|
36
|
+
- {e.g.: no tests for webhook handlers -- manual testing only}
|
|
37
|
+
- {e.g.: no load testing has been performed}
|
|
38
|
+
|
|
39
|
+
## Known Tech Debt
|
|
40
|
+
|
|
41
|
+
<!-- Severity: critical = can break / security risk, high = significant issue,
|
|
42
|
+
medium = workable, low = cosmetic -->
|
|
43
|
+
|
|
44
|
+
| ID | Area | Problem | Severity | Priority |
|
|
45
|
+
|------|----------|-----------------------------------|----------|----------|
|
|
46
|
+
| TD-1 | {auth} | {refresh token not rotated} | {high} | {urgent} |
|
|
47
|
+
| TD-2 | {user} | {N+1 queries on user list} | {medium} | {soon} |
|
|
48
|
+
|
|
49
|
+
## Code Quality Observations
|
|
50
|
+
|
|
51
|
+
- **Consistency:** {e.g.: module structure consistent except legacy "reports" module}
|
|
52
|
+
- **Type safety:** {e.g.: strict mode enabled, but 12 files use "any"}
|
|
53
|
+
- **Dead code:** {e.g.: src/modules/legacy/ contains unused v1 API code}
|
|
54
|
+
- **Duplication:** {e.g.: pagination logic duplicated in 4 controllers}
|
|
55
|
+
- **Dependency health:** {e.g.: all deps up to date except prisma (2 majors behind)}
|
|
56
|
+
|
|
57
|
+
## What NOT to Change Without Explicit Discussion
|
|
58
|
+
|
|
59
|
+
<!-- THIS SECTION IS LAW. AI agents MUST stop and ask before modifying anything here. -->
|
|
60
|
+
|
|
61
|
+
- **{area}** -- {reason this is protected}
|
|
62
|
+
- **{table X schema}** -- {reason, e.g.: 3 external services depend on this}
|
|
63
|
+
|
|
64
|
+
## Dependency Graph Overview
|
|
65
|
+
|
|
66
|
+
<!-- OPTIONAL -->
|
|
67
|
+
|
|
68
|
+
```mermaid
|
|
69
|
+
graph TD
|
|
70
|
+
Auth --> User
|
|
71
|
+
Auth --> Config
|
|
72
|
+
Billing --> User
|
|
73
|
+
Billing --> Stripe[Stripe API]
|
|
74
|
+
Reports --> Billing
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Circular Dependencies
|
|
78
|
+
<!-- Write "None detected" if clean. -->
|
|
79
|
+
|
|
80
|
+
- {e.g.: user.service imports billing.service which imports user.service -- resolved via forwardRef}
|
|
81
|
+
|
|
82
|
+
## External Dependencies with Special Behavior
|
|
83
|
+
|
|
84
|
+
| Dependency | Quirk | Workaround |
|
|
85
|
+
|------------|-------------------------------------------------|-------------------------------|
|
|
86
|
+
| {prisma} | {$transaction has 5s default timeout} | {increased to 30s in config} |
|
|
87
|
+
| {stripe} | {webhook retries for 72h on 5xx} | {return 200, queue retry} |
|
|
88
|
+
|
|
89
|
+
## Patterns That Differ from Usual
|
|
90
|
+
|
|
91
|
+
- {pattern that looks wrong} -- {why it is intentional and what breaks if "fixed"}
|
|
92
|
+
|
|
93
|
+
## Risk Areas
|
|
94
|
+
|
|
95
|
+
- **Critical:** {data loss, security breach, or financial impact}
|
|
96
|
+
- **High:** {broken user flow or downtime}
|
|
97
|
+
- **Medium:** {degraded experience but workaround exists}
|
|
98
|
+
- **Low:** {cosmetic or minor inconvenience}
|
|
99
|
+
|
|
100
|
+
## TODOs and Future Work
|
|
101
|
+
|
|
102
|
+
| Source | Location | Description | Priority |
|
|
103
|
+
|----------------|--------------------------------------------|--------------------------------|----------|
|
|
104
|
+
| {code comment} | {src/modules/billing/billing.service.ts:42}| {TODO: handle partial refunds} | {high} |
|
|
105
|
+
| {planned} | {n/a} | {add rate limiting middleware} | {medium} |
|
|
106
|
+
|
|
107
|
+
## Known Issues
|
|
108
|
+
|
|
109
|
+
| Issue | Impact | Workaround | Tracked |
|
|
110
|
+
|------------------------------------|-----------------------------|----------------------------------|---------|
|
|
111
|
+
| {memory leak in report generation} | {worker restarts after ~2h} | {cron restarts worker nightly} | {#42} |
|
|
112
|
+
|
|
113
|
+
## Optimization Opportunities
|
|
114
|
+
|
|
115
|
+
- {e.g.: add Redis caching to GET /users/:id -- 500 req/min, always hits DB}
|
|
116
|
+
- {e.g.: move report generation to background worker -- blocks API for 8-15s}
|
|
117
|
+
|
|
118
|
+
## Important Decision History
|
|
119
|
+
|
|
120
|
+
- **{date} -- {decision}:** {context and reasoning}
|
|
121
|
+
|
|
122
|
+
## Modification Guidance
|
|
123
|
+
|
|
124
|
+
<!-- REQUIRED: Instructions for safely making changes. Critical for AI agents. -->
|
|
125
|
+
|
|
126
|
+
### Adding a Feature
|
|
127
|
+
1. {Create module in src/modules/{feature}/}
|
|
128
|
+
2. {Follow structure from coding-standards.md}
|
|
129
|
+
3. {Register in app.module.ts}
|
|
130
|
+
4. {Add tests, update this doc if new risk areas}
|
|
131
|
+
|
|
132
|
+
### Modifying an Existing Feature
|
|
133
|
+
1. {Read the module's tests first to understand current behavior}
|
|
134
|
+
2. {Check "What NOT to Change" section above}
|
|
135
|
+
3. {Write failing test for new behavior before changing code}
|
|
136
|
+
4. {Run full test suite before committing}
|
|
137
|
+
|
|
138
|
+
### Removing a Feature
|
|
139
|
+
1. {Check dependency graph -- which modules depend on this?}
|
|
140
|
+
2. {Remove in order: routes, controller, service, repository, module, migration}
|
|
141
|
+
3. {Run full test suite + manual verification}
|
|
142
|
+
|
|
143
|
+
## Testing Checklist for Changes
|
|
144
|
+
|
|
145
|
+
- [ ] Unit tests pass: `{pnpm test}`
|
|
146
|
+
- [ ] No type errors: `{pnpm typecheck}`
|
|
147
|
+
- [ ] Linter passes: `{pnpm lint}`
|
|
148
|
+
- [ ] New code has tests (if adding logic)
|
|
149
|
+
- [ ] No new `any` types introduced
|
|
150
|
+
- [ ] Environment variables documented (if new ones added)
|
|
151
|
+
- [ ] This brownfield document updated (if risk areas changed)
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# Coding Standards
|
|
2
|
+
|
|
3
|
+
> These are the REAL conventions of this codebase.
|
|
4
|
+
> Code that does not follow this is tech debt -- do not copy the old pattern.
|
|
5
|
+
> Last updated: {date}
|
|
6
|
+
|
|
7
|
+
<!-- Fill every {placeholder}, remove comments once done. -->
|
|
8
|
+
|
|
9
|
+
## Naming Conventions
|
|
10
|
+
|
|
11
|
+
| Element | Convention | Example |
|
|
12
|
+
|-------------------|------------------------|---------------------------|
|
|
13
|
+
| {files} | {kebab-case} | {user-profile.service.ts} |
|
|
14
|
+
| {classes} | {PascalCase} | {UserProfileService} |
|
|
15
|
+
| {functions} | {camelCase} | {getUserById} |
|
|
16
|
+
| {constants} | {UPPER_SNAKE_CASE} | {MAX_RETRY_ATTEMPTS} |
|
|
17
|
+
| {DB tables} | {snake_case plural} | {user_profiles} |
|
|
18
|
+
| {env vars} | {UPPER_SNAKE_CASE} | {DATABASE_URL} |
|
|
19
|
+
| {components} | {PascalCase} | {UserAvatar.tsx} |
|
|
20
|
+
| {test files} | {*.spec.ts / *.test.ts}| {user.service.spec.ts} |
|
|
21
|
+
|
|
22
|
+
## File Organization Patterns
|
|
23
|
+
|
|
24
|
+
<!-- REQUIRED: How files are grouped and where new code goes. -->
|
|
25
|
+
|
|
26
|
+
### Module / Feature Structure
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
{src/modules/user/}
|
|
30
|
+
├── user.controller.ts # route handlers
|
|
31
|
+
├── user.service.ts # business logic
|
|
32
|
+
├── user.repository.ts # data access
|
|
33
|
+
├── user.module.ts # DI wiring
|
|
34
|
+
├── dto/ # input validation
|
|
35
|
+
├── entities/ # domain model
|
|
36
|
+
└── __tests__/ # colocated tests
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Key File Types
|
|
40
|
+
|
|
41
|
+
| Suffix / Pattern | Purpose | Example |
|
|
42
|
+
|--------------------|----------------------------|------------------------|
|
|
43
|
+
| {*.controller.ts} | {HTTP route handlers} | {user.controller.ts} |
|
|
44
|
+
| {*.service.ts} | {Business logic} | {user.service.ts} |
|
|
45
|
+
| {*.dto.ts} | {Input/output + validation}| {create-user.dto.ts} |
|
|
46
|
+
| {*.entity.ts} | {Domain model / DB entity} | {user.entity.ts} |
|
|
47
|
+
| {*.spec.ts} | {Unit / integration test} | {user.service.spec.ts} |
|
|
48
|
+
|
|
49
|
+
## Error Handling Philosophy
|
|
50
|
+
|
|
51
|
+
- **Error creation:** {e.g.: domain-specific exceptions extending base AppError}
|
|
52
|
+
- **HTTP mapping:** {e.g.: global exception filter maps AppError to HTTP status}
|
|
53
|
+
- **Validation errors:** {e.g.: DTO validation via class-validator; auto 422}
|
|
54
|
+
- **Unhandled errors:** {e.g.: global catch returns 500 + logs to Sentry}
|
|
55
|
+
|
|
56
|
+
## Validation
|
|
57
|
+
|
|
58
|
+
- **Where:** {e.g.: at the controller boundary via DTOs, never inside services}
|
|
59
|
+
- **Library:** {e.g.: class-validator + class-transformer / zod}
|
|
60
|
+
- **Schema reuse:** {e.g.: frontend and backend share zod schemas}
|
|
61
|
+
|
|
62
|
+
## State Management
|
|
63
|
+
|
|
64
|
+
<!-- OPTIONAL: Frontend projects only. Delete for backend-only. -->
|
|
65
|
+
|
|
66
|
+
- **Server state:** {e.g.: React Query -- all API data flows through this}
|
|
67
|
+
- **Client state:** {e.g.: Zustand for UI state, React context for auth only}
|
|
68
|
+
- **Form state:** {e.g.: react-hook-form with zod resolver}
|
|
69
|
+
|
|
70
|
+
## Component Patterns
|
|
71
|
+
|
|
72
|
+
<!-- OPTIONAL: Frontend projects only. Delete for backend-only. -->
|
|
73
|
+
|
|
74
|
+
- **Style:** {e.g.: functional components only, no class components}
|
|
75
|
+
- **Styling:** {e.g.: Tailwind utility classes, cn() helper for conditionals}
|
|
76
|
+
- **Colocation:** {e.g.: component, tests, and stories in same folder}
|
|
77
|
+
|
|
78
|
+
## API Design Patterns
|
|
79
|
+
|
|
80
|
+
<!-- OPTIONAL: Backend projects only. Delete for frontend-only. -->
|
|
81
|
+
|
|
82
|
+
- **Routes:** {e.g.: RESTful -- plural nouns: /users, /users/:id}
|
|
83
|
+
- **Pagination:** {e.g.: cursor-based with ?cursor=X&limit=20}
|
|
84
|
+
- **Versioning:** {e.g.: URL prefix /api/v1 / header-based / none}
|
|
85
|
+
|
|
86
|
+
## Database Conventions
|
|
87
|
+
|
|
88
|
+
<!-- REQUIRED if the project has a database. -->
|
|
89
|
+
|
|
90
|
+
- **Migrations:** {e.g.: Prisma migrate dev for local, migrate deploy for CI}
|
|
91
|
+
- **Naming:** {e.g.: snake_case tables and columns, plural table names}
|
|
92
|
+
- **Transactions:** {e.g.: prisma.$transaction for multi-table writes}
|
|
93
|
+
- **Raw SQL:** {e.g.: never -- always use Prisma client}
|
|
94
|
+
|
|
95
|
+
## Logging Conventions
|
|
96
|
+
|
|
97
|
+
- **Library:** {e.g.: pino / winston / console}
|
|
98
|
+
- **Levels:** {e.g.: error, warn, info, debug}
|
|
99
|
+
- **Format:** {e.g.: structured JSON in production}
|
|
100
|
+
- **What NOT to log:** {e.g.: PII, passwords, tokens, full request bodies}
|
|
101
|
+
|
|
102
|
+
## Security Practices
|
|
103
|
+
|
|
104
|
+
- **Input sanitization:** {e.g.: all input passes through validation DTOs}
|
|
105
|
+
- **SQL injection:** {e.g.: prevented by always using ORM}
|
|
106
|
+
- **Secrets:** {e.g.: never hardcoded, always via env vars}
|
|
107
|
+
- **Auth checks:** {e.g.: guard decorators on every protected route}
|
|
108
|
+
|
|
109
|
+
## Tests
|
|
110
|
+
|
|
111
|
+
- **Framework:** {e.g.: Jest / Vitest}
|
|
112
|
+
- **Location:** {e.g.: colocated in __tests__/ inside each module}
|
|
113
|
+
- **Unit tests:** {e.g.: test services with mocked repositories}
|
|
114
|
+
- **Integration:** {e.g.: test controllers with real DB via test containers}
|
|
115
|
+
- **E2E:** {e.g.: Playwright / Cypress for critical user flows}
|
|
116
|
+
|
|
117
|
+
## What to Avoid
|
|
118
|
+
|
|
119
|
+
| Do Not | Why | Do This Instead |
|
|
120
|
+
|------------------------------------|------------------------------------|----------------------------------|
|
|
121
|
+
| {Use any for types} | {defeats TypeScript safety} | {define proper types or unknown} |
|
|
122
|
+
| {Import from ../../../} | {fragile paths} | {use path aliases @/} |
|
|
123
|
+
| {Business logic in controller} | {untestable, breaks SoC} | {move to service layer} |
|
|
124
|
+
| {Push .env files} | {exposes secrets} | {use .env.example as template} |
|