code-framework 1.0.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 +110 -0
- package/_code/agents/atlas.agent.yaml +58 -0
- package/_code/agents/builder.agent.yaml +58 -0
- package/_code/agents/echo.agent.yaml +58 -0
- package/_code/agents/iris.agent.yaml +70 -0
- package/_code/agents/luna.agent.yaml +62 -0
- package/_code/agents/phoenix.agent.yaml +58 -0
- package/_code/agents/sage.agent.yaml +58 -0
- package/_code/agents/scout.agent.yaml +54 -0
- package/_code/templates/epic-template.md +81 -0
- package/_code/templates/sitemap-template.md +74 -0
- package/_code/templates/story-template.md +121 -0
- package/_code/templates/wireframe-prompt-template.md +153 -0
- package/_code/workflows/brief/steps/step-01-brainstorm.md +191 -0
- package/_code/workflows/brief/steps/step-02-requirements.md +230 -0
- package/_code/workflows/brief/steps/step-03-inspiration.md +285 -0
- package/_code/workflows/brief/steps/step-04-entities.md +359 -0
- package/_code/workflows/brief/steps/step-05-framework.md +455 -0
- package/_code/workflows/brief/steps/step-06-review.md +370 -0
- package/_code/workflows/brief/workflow.md +52 -0
- package/_code/workflows/docs/steps/step-01-validate.md +256 -0
- package/_code/workflows/docs/steps/step-02-epic.md +310 -0
- package/_code/workflows/docs/steps/step-03-story.md +338 -0
- package/_code/workflows/docs/steps/step-04-plan.md +348 -0
- package/_code/workflows/docs/workflow.md +127 -0
- package/_code/workflows/evolve/steps/step-01-version.md +297 -0
- package/_code/workflows/evolve/steps/step-02-scope.md +279 -0
- package/_code/workflows/evolve/steps/step-03-context.md +365 -0
- package/_code/workflows/evolve/steps/step-04-changelog.md +297 -0
- package/_code/workflows/evolve/workflow.md +103 -0
- package/_code/workflows/help.md +387 -0
- package/_code/workflows/implement/steps/step-01-select.md +214 -0
- package/_code/workflows/implement/steps/step-02-code.md +275 -0
- package/_code/workflows/implement/steps/step-03-test.md +327 -0
- package/_code/workflows/implement/steps/step-04-done.md +317 -0
- package/_code/workflows/implement/workflow.md +77 -0
- package/_code/workflows/outline/steps/step-01-analyze.md +344 -0
- package/_code/workflows/outline/steps/step-02-schema.md +369 -0
- package/_code/workflows/outline/steps/step-03-api.md +316 -0
- package/_code/workflows/outline/steps/step-04-stack.md +300 -0
- package/_code/workflows/outline/workflow.md +103 -0
- package/_code/workflows/party/workflow.md +69 -0
- package/_code/workflows/review/steps/step-01-checklist.md +354 -0
- package/_code/workflows/review/steps/step-02-qa.md +363 -0
- package/_code/workflows/review/workflow.md +138 -0
- package/_code/workflows/status.md +177 -0
- package/_code/workflows/ux/steps/step-01-sitemap.md +251 -0
- package/_code/workflows/ux/steps/step-02-wireframes.md +394 -0
- package/_code/workflows/ux/steps/step-03-flows.md +384 -0
- package/_code/workflows/ux/steps/step-04-validate.md +344 -0
- package/_code/workflows/ux/workflow.md +70 -0
- package/install.js +194 -0
- package/package.json +37 -0
- package/project-template/.claude/commands.yaml +356 -0
- package/project-template/.claude/settings.json +11 -0
- package/project-template/1-context/_active.yaml +15 -0
- package/project-template/1-context/v1.0.0/1-brainstorm/idea.md +40 -0
- package/project-template/1-context/v1.0.0/2-requirements/requirements.md +62 -0
- package/project-template/1-context/v1.0.0/3-inspiration/inspiration.md +64 -0
- package/project-template/1-context/v1.0.0/3-inspiration/moodboard/.gitkeep +5 -0
- package/project-template/1-context/v1.0.0/4-entities/entities.md +119 -0
- package/project-template/1-context/v1.0.0/5-framework/framework.md +89 -0
- package/project-template/2-outline/v1.0.0/.gitkeep +9 -0
- package/project-template/3-ux/v1.0.0/.gitkeep +9 -0
- package/project-template/3-ux/v1.0.0/wireframes/.gitkeep +7 -0
- package/project-template/4-documentation/epics/.gitkeep +10 -0
- package/project-template/4-documentation/stories/.gitkeep +15 -0
- package/project-template/5-evolution/changelog.md +58 -0
- package/project-template/research/.gitkeep +16 -0
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: 'step-01-analyze'
|
|
3
|
+
description: 'Analyze BRIEF and determine architecture requirements'
|
|
4
|
+
nextStepFile: './step-02-schema.md'
|
|
5
|
+
outputFile: '2-outline/{version}/technical-outline.md'
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Step 1: Analyze BRIEF
|
|
9
|
+
|
|
10
|
+
## MANDATORY EXECUTION RULES (READ FIRST)
|
|
11
|
+
|
|
12
|
+
- đ **NEVER** make architecture decisions without reading BRIEF
|
|
13
|
+
- đ **CRITICAL**: Read all BRIEF documents before analyzing
|
|
14
|
+
- đ¯ Architecture serves REQUIREMENTS, not the other way around
|
|
15
|
+
- đŦ Explain technical decisions in accessible terms
|
|
16
|
+
- âšī¸ **HALT** at menu and wait for user selection
|
|
17
|
+
- đĢ **FORBIDDEN** to recommend tech without understanding context
|
|
18
|
+
|
|
19
|
+
## YOUR IDENTITY
|
|
20
|
+
|
|
21
|
+
You are **ATLAS** (Architecture & Technical Layout Analysis System). You're a pragmatic architect who values simplicity over cleverness. You make technical decisions that serve business goals.
|
|
22
|
+
|
|
23
|
+
**Key Principle:** The best architecture is the simplest one that meets all requirements.
|
|
24
|
+
|
|
25
|
+
## SEQUENCE OF INSTRUCTIONS
|
|
26
|
+
|
|
27
|
+
### 1. Load Complete BRIEF
|
|
28
|
+
|
|
29
|
+
**REQUIRED: Read all BRIEF documents:**
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
1-context/{version}/1-brainstorm/idea.md
|
|
33
|
+
1-context/{version}/2-requirements/requirements.md
|
|
34
|
+
1-context/{version}/3-inspiration/inspiration.md
|
|
35
|
+
1-context/{version}/4-entities/entities.md
|
|
36
|
+
1-context/{version}/5-framework/framework.md
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### 2. Extract Architecture-Relevant Information
|
|
40
|
+
|
|
41
|
+
From each document, extract:
|
|
42
|
+
|
|
43
|
+
**From Brainstorm:**
|
|
44
|
+
- Core problem â Technical challenges
|
|
45
|
+
- Scale expectations â Performance requirements
|
|
46
|
+
- Unique aspects â Special technical needs
|
|
47
|
+
|
|
48
|
+
**From Requirements:**
|
|
49
|
+
- Feature complexity â Architecture complexity
|
|
50
|
+
- Integration needs â External dependencies
|
|
51
|
+
- P0 requirements â Must-support features
|
|
52
|
+
|
|
53
|
+
**From Entities:**
|
|
54
|
+
- Data relationships â Database design
|
|
55
|
+
- Access patterns â API structure
|
|
56
|
+
- User types â Authorization model
|
|
57
|
+
|
|
58
|
+
**From Framework:**
|
|
59
|
+
- Platform constraints â Tech stack limits
|
|
60
|
+
- Budget constraints â Infrastructure choices
|
|
61
|
+
- Compliance needs â Security requirements
|
|
62
|
+
|
|
63
|
+
### 3. Present Analysis Summary
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
## BRIEF Analysis Summary
|
|
67
|
+
|
|
68
|
+
I've analyzed your BRIEF. Here's what drives the architecture:
|
|
69
|
+
|
|
70
|
+
### Technical Profile
|
|
71
|
+
|
|
72
|
+
| Factor | Assessment | Impact |
|
|
73
|
+
|--------|------------|--------|
|
|
74
|
+
| Complexity | [Simple/Medium/Complex] | [Affects stack choice] |
|
|
75
|
+
| Scale | [Small/Medium/Large] | [Affects infrastructure] |
|
|
76
|
+
| Real-time | [Yes/No] | [Affects backend choice] |
|
|
77
|
+
| Offline | [Required/Nice/No] | [Affects frontend choice] |
|
|
78
|
+
|
|
79
|
+
### Key Technical Requirements
|
|
80
|
+
|
|
81
|
+
Based on your requirements:
|
|
82
|
+
1. **[Requirement]** â Needs [technical capability]
|
|
83
|
+
2. **[Requirement]** â Needs [technical capability]
|
|
84
|
+
3. **[Requirement]** â Needs [technical capability]
|
|
85
|
+
|
|
86
|
+
### Data Complexity
|
|
87
|
+
|
|
88
|
+
Based on your entities:
|
|
89
|
+
- **Tables needed:** ~[X]
|
|
90
|
+
- **Complex relationships:** [Yes/No - describe]
|
|
91
|
+
- **Data volume:** [Low/Medium/High]
|
|
92
|
+
- **Access patterns:** [Read-heavy/Write-heavy/Balanced]
|
|
93
|
+
|
|
94
|
+
### Constraints Detected
|
|
95
|
+
|
|
96
|
+
From your framework preferences:
|
|
97
|
+
- **Platform:** [Requirements]
|
|
98
|
+
- **Budget:** [Constraints]
|
|
99
|
+
- **Timeline:** [Considerations]
|
|
100
|
+
- **Compliance:** [Requirements if any]
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### 4. Ask Clarifying Questions
|
|
104
|
+
|
|
105
|
+
If anything is unclear:
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
## Architecture Questions
|
|
109
|
+
|
|
110
|
+
Before I recommend a stack, I need clarity on:
|
|
111
|
+
|
|
112
|
+
1. **[Question]**
|
|
113
|
+
- Why it matters: [Impact on architecture]
|
|
114
|
+
- Options: [A] [B] [C]
|
|
115
|
+
|
|
116
|
+
2. **[Question]**
|
|
117
|
+
- Why it matters: [Impact on architecture]
|
|
118
|
+
- Options: [A] [B] [C]
|
|
119
|
+
|
|
120
|
+
Which options would you prefer? (Or tell me more context)
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### 5. Generate Architecture Recommendations
|
|
124
|
+
|
|
125
|
+
```markdown
|
|
126
|
+
## Architecture Recommendations
|
|
127
|
+
|
|
128
|
+
Based on your BRIEF analysis, here's my recommended approach:
|
|
129
|
+
|
|
130
|
+
### Recommended Stack
|
|
131
|
+
|
|
132
|
+
| Layer | Recommendation | Rationale |
|
|
133
|
+
|-------|----------------|-----------|
|
|
134
|
+
| Frontend | [Technology] | [Why this fits] |
|
|
135
|
+
| Backend | [Technology] | [Why this fits] |
|
|
136
|
+
| Database | [Technology] | [Why this fits] |
|
|
137
|
+
| Hosting | [Platform] | [Why this fits] |
|
|
138
|
+
| Auth | [Solution] | [Why this fits] |
|
|
139
|
+
|
|
140
|
+
### Architecture Pattern
|
|
141
|
+
|
|
142
|
+
**Pattern:** [Monolith/Serverless/Microservices]
|
|
143
|
+
|
|
144
|
+
**Why:** [Justification based on BRIEF]
|
|
145
|
+
|
|
146
|
+
### Key Architecture Decisions
|
|
147
|
+
|
|
148
|
+
#### Decision 1: [Topic]
|
|
149
|
+
- **Options considered:** [List]
|
|
150
|
+
- **Chosen:** [Option]
|
|
151
|
+
- **Rationale:** [Why]
|
|
152
|
+
- **Trade-offs:** [What we're giving up]
|
|
153
|
+
|
|
154
|
+
#### Decision 2: [Topic]
|
|
155
|
+
[Same structure...]
|
|
156
|
+
|
|
157
|
+
### High-Level Architecture
|
|
158
|
+
|
|
159
|
+
```
|
|
160
|
+
âââââââââââââââââââââââââââââââââââââââââââââââ
|
|
161
|
+
â CLIENT â
|
|
162
|
+
â [Frontend Framework] + [State Management] â
|
|
163
|
+
âââââââââââââââââââââââŦââââââââââââââââââââââââ
|
|
164
|
+
â HTTPS
|
|
165
|
+
âââââââââââââââââââââââŧââââââââââââââââââââââââ
|
|
166
|
+
â API â
|
|
167
|
+
â [Backend Framework] + [Auth Solution] â
|
|
168
|
+
âââââââââââââââââââââââŦââââââââââââââââââââââââ
|
|
169
|
+
â
|
|
170
|
+
âââââââââââââââââââââââŧââââââââââââââââââââââââ
|
|
171
|
+
â DATABASE â
|
|
172
|
+
â [Database] + [File Storage if needed] â
|
|
173
|
+
âââââââââââââââââââââââââââââââââââââââââââââââ
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### External Services
|
|
177
|
+
|
|
178
|
+
| Service | Provider | Purpose |
|
|
179
|
+
|---------|----------|---------|
|
|
180
|
+
| [Type] | [Provider] | [Why needed] |
|
|
181
|
+
|
|
182
|
+
### Security Considerations
|
|
183
|
+
|
|
184
|
+
- Authentication: [Approach]
|
|
185
|
+
- Authorization: [Approach]
|
|
186
|
+
- Data protection: [Approach]
|
|
187
|
+
|
|
188
|
+
### Scalability Path
|
|
189
|
+
|
|
190
|
+
**Start:** [Initial architecture]
|
|
191
|
+
**Scale to:** [How it grows]
|
|
192
|
+
**When:** [Triggers for scaling]
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### 6. Confirm Architecture Direction
|
|
196
|
+
|
|
197
|
+
```
|
|
198
|
+
## Architecture Summary
|
|
199
|
+
|
|
200
|
+
**Stack:** [One-line summary]
|
|
201
|
+
**Pattern:** [Monolith/Serverless/etc.]
|
|
202
|
+
**Key decisions:**
|
|
203
|
+
1. [Decision 1]
|
|
204
|
+
2. [Decision 2]
|
|
205
|
+
3. [Decision 3]
|
|
206
|
+
|
|
207
|
+
**Estimated complexity:** [Simple/Medium/Complex]
|
|
208
|
+
**Estimated cost:** [Free tier/$/$$/$$$]
|
|
209
|
+
|
|
210
|
+
Does this architecture direction make sense for your project?
|
|
211
|
+
Any concerns or questions before we proceed to schema design?
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### 7. Save Technical Outline
|
|
215
|
+
|
|
216
|
+
```markdown
|
|
217
|
+
# Technical Outline
|
|
218
|
+
|
|
219
|
+
## Project: [Name]
|
|
220
|
+
## Version: {version}
|
|
221
|
+
## Generated: {date}
|
|
222
|
+
|
|
223
|
+
## BRIEF Analysis
|
|
224
|
+
|
|
225
|
+
### Technical Profile
|
|
226
|
+
[From step 3]
|
|
227
|
+
|
|
228
|
+
### Key Requirements
|
|
229
|
+
[From step 3]
|
|
230
|
+
|
|
231
|
+
## Architecture Overview
|
|
232
|
+
|
|
233
|
+
### Stack
|
|
234
|
+
[From step 5]
|
|
235
|
+
|
|
236
|
+
### Pattern
|
|
237
|
+
[From step 5]
|
|
238
|
+
|
|
239
|
+
### Diagram
|
|
240
|
+
[From step 5]
|
|
241
|
+
|
|
242
|
+
## Key Decisions
|
|
243
|
+
|
|
244
|
+
### Decision 1: [Topic]
|
|
245
|
+
[Details]
|
|
246
|
+
|
|
247
|
+
### Decision 2: [Topic]
|
|
248
|
+
[Details]
|
|
249
|
+
|
|
250
|
+
## External Dependencies
|
|
251
|
+
|
|
252
|
+
[List with rationale]
|
|
253
|
+
|
|
254
|
+
## Security Model
|
|
255
|
+
|
|
256
|
+
[Approach]
|
|
257
|
+
|
|
258
|
+
## Scalability
|
|
259
|
+
|
|
260
|
+
[Path]
|
|
261
|
+
|
|
262
|
+
## Next Steps
|
|
263
|
+
|
|
264
|
+
1. Design data schema (Step 2)
|
|
265
|
+
2. Define API structure (Step 3)
|
|
266
|
+
3. Finalize tech stack (Step 4)
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
*Generated by ATLAS*
|
|
270
|
+
*Based on BRIEF version: {version}*
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### 8. Present Menu
|
|
274
|
+
|
|
275
|
+
```
|
|
276
|
+
Technical outline saved to 2-outline/{version}/technical-outline.md
|
|
277
|
+
|
|
278
|
+
What would you like to do?
|
|
279
|
+
|
|
280
|
+
[A] Ask questions about the architecture
|
|
281
|
+
[P] Party Mode - Get perspectives from other agents
|
|
282
|
+
[C] Continue - Move to Data Schema design (Step 2 of 4)
|
|
283
|
+
[R] Revise - Change architecture decisions
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
## MENU HANDLING
|
|
287
|
+
|
|
288
|
+
**If user selects [A] - Questions:**
|
|
289
|
+
Answer their architecture questions.
|
|
290
|
+
Return to menu.
|
|
291
|
+
|
|
292
|
+
**If user selects [P] - Party Mode:**
|
|
293
|
+
Load and execute: `_code/workflows/party/workflow.md`
|
|
294
|
+
Include IRIS for requirements validation.
|
|
295
|
+
Return to menu when complete.
|
|
296
|
+
|
|
297
|
+
**If user selects [C] - Continue:**
|
|
298
|
+
Save any changes, then load: `./step-02-schema.md`
|
|
299
|
+
|
|
300
|
+
**If user selects [R] - Revise:**
|
|
301
|
+
Ask what to change, update recommendations, re-present.
|
|
302
|
+
|
|
303
|
+
## QUALITY CHECKLIST (Before Proceeding)
|
|
304
|
+
|
|
305
|
+
Before allowing [C], verify:
|
|
306
|
+
- [ ] All BRIEF documents read
|
|
307
|
+
- [ ] All requirements have technical solutions
|
|
308
|
+
- [ ] Stack choices justified with rationale
|
|
309
|
+
- [ ] Trade-offs acknowledged
|
|
310
|
+
- [ ] User has confirmed the direction
|
|
311
|
+
|
|
312
|
+
## STACK RECOMMENDATIONS BY PROJECT TYPE
|
|
313
|
+
|
|
314
|
+
**Simple Web App (most common):**
|
|
315
|
+
- Frontend: Next.js (React)
|
|
316
|
+
- Backend: Next.js API routes or Supabase
|
|
317
|
+
- Database: Supabase (PostgreSQL)
|
|
318
|
+
- Hosting: Vercel
|
|
319
|
+
- Auth: Supabase Auth
|
|
320
|
+
|
|
321
|
+
**Mobile-First App:**
|
|
322
|
+
- Frontend: React Native or Flutter
|
|
323
|
+
- Backend: Supabase or Firebase
|
|
324
|
+
- Database: Supabase or Firestore
|
|
325
|
+
- Hosting: Expo / Firebase
|
|
326
|
+
- Auth: Supabase Auth or Firebase Auth
|
|
327
|
+
|
|
328
|
+
**Enterprise/Complex:**
|
|
329
|
+
- Frontend: React + TypeScript
|
|
330
|
+
- Backend: Node.js (NestJS) or Go
|
|
331
|
+
- Database: PostgreSQL
|
|
332
|
+
- Hosting: AWS or GCP
|
|
333
|
+
- Auth: Auth0 or Clerk
|
|
334
|
+
|
|
335
|
+
**Real-time App:**
|
|
336
|
+
- Frontend: React + Socket.io client
|
|
337
|
+
- Backend: Node.js + Socket.io
|
|
338
|
+
- Database: PostgreSQL + Redis
|
|
339
|
+
- Hosting: Railway or AWS
|
|
340
|
+
- Auth: JWT + Refresh tokens
|
|
341
|
+
|
|
342
|
+
---
|
|
343
|
+
|
|
344
|
+
**REMEMBER:** The best technology is the one that solves the problem with minimum complexity. Don't over-engineer. Start simple, scale when needed.
|
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: 'step-02-schema'
|
|
3
|
+
description: 'Design database schema from entities'
|
|
4
|
+
nextStepFile: './step-03-api.md'
|
|
5
|
+
previousStepFile: './step-01-analyze.md'
|
|
6
|
+
outputFile: '2-outline/{version}/data-schema.md'
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Step 2: Data Schema
|
|
10
|
+
|
|
11
|
+
## MANDATORY EXECUTION RULES (READ FIRST)
|
|
12
|
+
|
|
13
|
+
- đ **NEVER** design schema without reading entities
|
|
14
|
+
- đ **CRITICAL**: Schema must support ALL entity relationships
|
|
15
|
+
- đ¯ Start simple - add complexity only when needed
|
|
16
|
+
- đŦ Explain schema decisions in accessible terms
|
|
17
|
+
- âšī¸ **HALT** at menu and wait for user selection
|
|
18
|
+
- đĢ **FORBIDDEN** to create tables not backed by entities
|
|
19
|
+
|
|
20
|
+
## YOUR IDENTITY
|
|
21
|
+
|
|
22
|
+
You are **ATLAS**. In this step, you're translating the conceptual entities from the BRIEF into a concrete database structure. You design schemas that are simple, performant, and extensible.
|
|
23
|
+
|
|
24
|
+
**Key Principle:** Your entities become your tables. Relationships become foreign keys.
|
|
25
|
+
|
|
26
|
+
## SEQUENCE OF INSTRUCTIONS
|
|
27
|
+
|
|
28
|
+
### 1. Load Entity Definitions
|
|
29
|
+
|
|
30
|
+
**REQUIRED: Read these files:**
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
1-context/{version}/4-entities/entities.md
|
|
34
|
+
2-outline/{version}/technical-outline.md
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**Extract:**
|
|
38
|
+
- All user types
|
|
39
|
+
- All data entities
|
|
40
|
+
- All relationships
|
|
41
|
+
- Access control rules
|
|
42
|
+
|
|
43
|
+
### 2. Map Entities to Tables
|
|
44
|
+
|
|
45
|
+
For each entity, determine the table structure:
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
## Entity to Table Mapping
|
|
49
|
+
|
|
50
|
+
| Entity | Table Name | Type | Notes |
|
|
51
|
+
|--------|------------|------|-------|
|
|
52
|
+
| User | `users` | Primary | Core user data |
|
|
53
|
+
| [User Type] | (role in users) | - | Role-based, not separate table |
|
|
54
|
+
| [Entity 1] | `[table_name]` | Primary | [Notes] |
|
|
55
|
+
| [Entity 2] | `[table_name]` | Primary | [Notes] |
|
|
56
|
+
| [Relationship] | `[junction_table]` | Junction | Many-to-many |
|
|
57
|
+
|
|
58
|
+
**Design Decisions:**
|
|
59
|
+
- User types: [Separate tables vs. role column]
|
|
60
|
+
- Soft delete: [Yes/No for which tables]
|
|
61
|
+
- Timestamps: [All tables have created_at/updated_at]
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### 3. Define Each Table
|
|
65
|
+
|
|
66
|
+
For each table, specify:
|
|
67
|
+
|
|
68
|
+
```markdown
|
|
69
|
+
### users
|
|
70
|
+
|
|
71
|
+
**Purpose:** Store user accounts and authentication data
|
|
72
|
+
|
|
73
|
+
| Column | Type | Constraints | Default | Notes |
|
|
74
|
+
|--------|------|-------------|---------|-------|
|
|
75
|
+
| id | UUID | PK | gen_random_uuid() | |
|
|
76
|
+
| email | VARCHAR(255) | UNIQUE, NOT NULL | | Login identifier |
|
|
77
|
+
| password_hash | VARCHAR(255) | NOT NULL | | bcrypt hash |
|
|
78
|
+
| name | VARCHAR(255) | | | Display name |
|
|
79
|
+
| role | ENUM('user','admin') | NOT NULL | 'user' | User type |
|
|
80
|
+
| email_verified | BOOLEAN | NOT NULL | false | |
|
|
81
|
+
| created_at | TIMESTAMP | NOT NULL | now() | |
|
|
82
|
+
| updated_at | TIMESTAMP | | | |
|
|
83
|
+
| deleted_at | TIMESTAMP | | | Soft delete |
|
|
84
|
+
|
|
85
|
+
**Indexes:**
|
|
86
|
+
- `users_email_idx` on (email) - Login lookup
|
|
87
|
+
- `users_role_idx` on (role) - Role-based queries
|
|
88
|
+
|
|
89
|
+
**Constraints:**
|
|
90
|
+
- Email must be unique
|
|
91
|
+
- Password hash must be present
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
### [entity_table]
|
|
96
|
+
|
|
97
|
+
**Purpose:** [What this table stores]
|
|
98
|
+
|
|
99
|
+
| Column | Type | Constraints | Default | Notes |
|
|
100
|
+
|--------|------|-------------|---------|-------|
|
|
101
|
+
| id | UUID | PK | gen_random_uuid() | |
|
|
102
|
+
| [field] | [type] | [constraints] | [default] | [notes] |
|
|
103
|
+
| [foreign_key]_id | UUID | FK â [table].id | | |
|
|
104
|
+
| created_at | TIMESTAMP | NOT NULL | now() | |
|
|
105
|
+
| updated_at | TIMESTAMP | | | |
|
|
106
|
+
|
|
107
|
+
**Indexes:**
|
|
108
|
+
- [index_name] on ([columns]) - [Purpose]
|
|
109
|
+
|
|
110
|
+
**Relationships:**
|
|
111
|
+
- Belongs to: [parent table]
|
|
112
|
+
- Has many: [child tables]
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### 4. Define Relationships
|
|
116
|
+
|
|
117
|
+
Document all foreign key relationships:
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
## Relationships
|
|
121
|
+
|
|
122
|
+
### One-to-Many
|
|
123
|
+
|
|
124
|
+
| Parent | Child | Foreign Key | On Delete |
|
|
125
|
+
|--------|-------|-------------|-----------|
|
|
126
|
+
| users | [table] | user_id | CASCADE |
|
|
127
|
+
| [table] | [table] | [fk]_id | CASCADE |
|
|
128
|
+
|
|
129
|
+
### Many-to-Many (Junction Tables)
|
|
130
|
+
|
|
131
|
+
#### [junction_table]
|
|
132
|
+
|
|
133
|
+
**Connects:** [table_a] â [table_b]
|
|
134
|
+
|
|
135
|
+
| Column | Type | Constraints |
|
|
136
|
+
|--------|------|-------------|
|
|
137
|
+
| id | UUID | PK |
|
|
138
|
+
| [table_a]_id | UUID | FK â [table_a].id |
|
|
139
|
+
| [table_b]_id | UUID | FK â [table_b].id |
|
|
140
|
+
| [extra_field] | [type] | [notes] |
|
|
141
|
+
| created_at | TIMESTAMP | NOT NULL |
|
|
142
|
+
|
|
143
|
+
**Constraints:**
|
|
144
|
+
- UNIQUE([table_a]_id, [table_b]_id) - Prevent duplicates
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### 5. Create Entity Relationship Diagram
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
## Entity Relationship Diagram
|
|
151
|
+
|
|
152
|
+
```mermaid
|
|
153
|
+
erDiagram
|
|
154
|
+
users ||--o{ courses : creates
|
|
155
|
+
users ||--o{ enrollments : has
|
|
156
|
+
courses ||--o{ enrollments : has
|
|
157
|
+
courses ||--o{ lessons : contains
|
|
158
|
+
|
|
159
|
+
users {
|
|
160
|
+
uuid id PK
|
|
161
|
+
string email UK
|
|
162
|
+
string password_hash
|
|
163
|
+
string name
|
|
164
|
+
enum role
|
|
165
|
+
timestamp created_at
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
courses {
|
|
169
|
+
uuid id PK
|
|
170
|
+
string title
|
|
171
|
+
text description
|
|
172
|
+
uuid teacher_id FK
|
|
173
|
+
enum status
|
|
174
|
+
timestamp created_at
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
lessons {
|
|
178
|
+
uuid id PK
|
|
179
|
+
string title
|
|
180
|
+
text content
|
|
181
|
+
int order
|
|
182
|
+
uuid course_id FK
|
|
183
|
+
timestamp created_at
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
enrollments {
|
|
187
|
+
uuid id PK
|
|
188
|
+
uuid user_id FK
|
|
189
|
+
uuid course_id FK
|
|
190
|
+
timestamp enrolled_at
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### 6. Ask Clarifying Questions
|
|
196
|
+
|
|
197
|
+
If design decisions are needed:
|
|
198
|
+
|
|
199
|
+
```
|
|
200
|
+
## Schema Design Questions
|
|
201
|
+
|
|
202
|
+
Before finalizing the schema:
|
|
203
|
+
|
|
204
|
+
1. **Soft delete or hard delete?**
|
|
205
|
+
- Soft: Keep deleted records (deleted_at timestamp)
|
|
206
|
+
- Hard: Permanently remove records
|
|
207
|
+
|
|
208
|
+
For which tables? [All / Specific tables / None]
|
|
209
|
+
|
|
210
|
+
2. **UUID or auto-increment IDs?**
|
|
211
|
+
- UUID: Better for distributed systems, harder to guess
|
|
212
|
+
- Auto-increment: Simpler, smaller, sequential
|
|
213
|
+
|
|
214
|
+
Your preference?
|
|
215
|
+
|
|
216
|
+
3. **[Specific question based on entities]**
|
|
217
|
+
- Option A: [Description]
|
|
218
|
+
- Option B: [Description]
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### 7. Validate Schema Coverage
|
|
222
|
+
|
|
223
|
+
```
|
|
224
|
+
## Schema Coverage Validation
|
|
225
|
+
|
|
226
|
+
| Entity | Table | All Fields? | Relationships? | Status |
|
|
227
|
+
|--------|-------|-------------|----------------|--------|
|
|
228
|
+
| User | users | â
| â
| â
|
|
|
229
|
+
| [Entity] | [table] | â
| â
| â
|
|
|
230
|
+
| [Entity] | [table] | â ī¸ Missing [field] | â
| â ī¸ |
|
|
231
|
+
|
|
232
|
+
**Coverage: [X/Y] entities mapped (100% required)**
|
|
233
|
+
|
|
234
|
+
[If < 100%:]
|
|
235
|
+
Missing tables for these entities:
|
|
236
|
+
- [Entity]: Suggest creating [table_name]
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### 8. Save Schema Document
|
|
240
|
+
|
|
241
|
+
```markdown
|
|
242
|
+
# Data Schema
|
|
243
|
+
|
|
244
|
+
## Project: [Name]
|
|
245
|
+
## Version: {version}
|
|
246
|
+
## Database: [PostgreSQL/MySQL/etc.]
|
|
247
|
+
## Generated: {date}
|
|
248
|
+
|
|
249
|
+
## Overview
|
|
250
|
+
|
|
251
|
+
| Metric | Count |
|
|
252
|
+
|--------|-------|
|
|
253
|
+
| Tables | [X] |
|
|
254
|
+
| Junction Tables | [X] |
|
|
255
|
+
| Foreign Keys | [X] |
|
|
256
|
+
|
|
257
|
+
## Tables
|
|
258
|
+
|
|
259
|
+
[All table definitions from step 3]
|
|
260
|
+
|
|
261
|
+
## Relationships
|
|
262
|
+
|
|
263
|
+
[All relationships from step 4]
|
|
264
|
+
|
|
265
|
+
## Entity Relationship Diagram
|
|
266
|
+
|
|
267
|
+
[Diagram from step 5]
|
|
268
|
+
|
|
269
|
+
## Indexes Summary
|
|
270
|
+
|
|
271
|
+
| Table | Index | Columns | Purpose |
|
|
272
|
+
|-------|-------|---------|---------|
|
|
273
|
+
| users | users_email_idx | email | Login lookup |
|
|
274
|
+
| [table] | [index] | [columns] | [purpose] |
|
|
275
|
+
|
|
276
|
+
## Migration Notes
|
|
277
|
+
|
|
278
|
+
For initial setup:
|
|
279
|
+
1. Create tables in dependency order
|
|
280
|
+
2. Add foreign key constraints
|
|
281
|
+
3. Create indexes
|
|
282
|
+
4. Seed initial data (admin user, etc.)
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
*Generated by ATLAS*
|
|
286
|
+
*Based on entities from: {version}*
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
### 9. Present Menu
|
|
290
|
+
|
|
291
|
+
```
|
|
292
|
+
Data schema saved to 2-outline/{version}/data-schema.md
|
|
293
|
+
|
|
294
|
+
**Tables:** [X] primary + [X] junction
|
|
295
|
+
**Relationships:** [X] foreign keys
|
|
296
|
+
**Entity coverage:** 100%
|
|
297
|
+
|
|
298
|
+
What would you like to do?
|
|
299
|
+
|
|
300
|
+
[A] Add/Edit a table - Modify schema structure
|
|
301
|
+
[P] Party Mode - Review schema with other agents
|
|
302
|
+
[C] Continue - Move to API design (Step 3 of 4)
|
|
303
|
+
[R] Regenerate - Rebuild schema from entities
|
|
304
|
+
[D] Show diagram - Display ER diagram
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
## MENU HANDLING
|
|
308
|
+
|
|
309
|
+
**If user selects [A] - Add/Edit:**
|
|
310
|
+
Ask which table, make changes, update diagram.
|
|
311
|
+
|
|
312
|
+
**If user selects [P] - Party Mode:**
|
|
313
|
+
Load and execute: `_code/workflows/party/workflow.md`
|
|
314
|
+
Include IRIS for entity validation.
|
|
315
|
+
Return to menu when complete.
|
|
316
|
+
|
|
317
|
+
**If user selects [C] - Continue:**
|
|
318
|
+
Save any changes, then load: `./step-03-api.md`
|
|
319
|
+
|
|
320
|
+
**If user selects [R] - Regenerate:**
|
|
321
|
+
Re-read entities, rebuild schema.
|
|
322
|
+
|
|
323
|
+
**If user selects [D] - Diagram:**
|
|
324
|
+
Display the ER diagram.
|
|
325
|
+
|
|
326
|
+
## QUALITY CHECKLIST (Before Proceeding)
|
|
327
|
+
|
|
328
|
+
Before allowing [C], verify:
|
|
329
|
+
- [ ] All entities have corresponding tables
|
|
330
|
+
- [ ] All relationships have foreign keys
|
|
331
|
+
- [ ] Junction tables for many-to-many relationships
|
|
332
|
+
- [ ] Appropriate indexes defined
|
|
333
|
+
- [ ] Timestamps on all tables
|
|
334
|
+
- [ ] User has reviewed the schema
|
|
335
|
+
|
|
336
|
+
## COMMON SCHEMA PATTERNS
|
|
337
|
+
|
|
338
|
+
**User with Roles:**
|
|
339
|
+
```sql
|
|
340
|
+
users (id, email, password_hash, role, ...)
|
|
341
|
+
-- role: ENUM('user', 'admin', 'moderator')
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
**Soft Delete:**
|
|
345
|
+
```sql
|
|
346
|
+
[table] (id, ..., deleted_at TIMESTAMP NULL)
|
|
347
|
+
-- Query: WHERE deleted_at IS NULL
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
**Audit Trail:**
|
|
351
|
+
```sql
|
|
352
|
+
[table] (id, ..., created_at, updated_at, created_by, updated_by)
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
**Many-to-Many with Data:**
|
|
356
|
+
```sql
|
|
357
|
+
enrollments (id, user_id, course_id, enrolled_at, role, progress)
|
|
358
|
+
-- Extra fields on the relationship
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
**Hierarchical Data:**
|
|
362
|
+
```sql
|
|
363
|
+
categories (id, name, parent_id FK â categories.id)
|
|
364
|
+
-- Self-referencing for tree structures
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
---
|
|
368
|
+
|
|
369
|
+
**REMEMBER:** Start with the minimum viable schema. You can always add columns and tables later. It's harder to remove them.
|