ai-flow-dev 2.7.0 → 2.8.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.
Files changed (171) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +573 -570
  3. package/package.json +74 -74
  4. package/prompts/backend/flow-build-phase-0.md +535 -535
  5. package/prompts/backend/flow-build-phase-1.md +626 -626
  6. package/prompts/backend/flow-build-phase-10.md +340 -340
  7. package/prompts/backend/flow-build-phase-2.md +573 -573
  8. package/prompts/backend/flow-build-phase-3.md +834 -834
  9. package/prompts/backend/flow-build-phase-4.md +554 -554
  10. package/prompts/backend/flow-build-phase-5.md +703 -703
  11. package/prompts/backend/flow-build-phase-6.md +524 -524
  12. package/prompts/backend/flow-build-phase-7.md +1001 -1001
  13. package/prompts/backend/flow-build-phase-8.md +1407 -1407
  14. package/prompts/backend/flow-build-phase-9.md +477 -477
  15. package/prompts/backend/flow-build.md +137 -137
  16. package/prompts/backend/flow-check-review.md +656 -20
  17. package/prompts/backend/flow-check-test.md +526 -14
  18. package/prompts/backend/flow-check.md +725 -67
  19. package/prompts/backend/flow-commit.md +88 -119
  20. package/prompts/backend/flow-docs-sync.md +354 -354
  21. package/prompts/backend/flow-finish.md +919 -0
  22. package/prompts/backend/flow-release.md +949 -0
  23. package/prompts/backend/flow-work-feature.md +61 -61
  24. package/prompts/backend/flow-work-fix.md +46 -46
  25. package/prompts/backend/flow-work-refactor.md +48 -48
  26. package/prompts/backend/flow-work-resume.md +34 -34
  27. package/prompts/backend/flow-work.md +1098 -1286
  28. package/prompts/desktop/flow-build-phase-0.md +359 -359
  29. package/prompts/desktop/flow-build-phase-1.md +295 -295
  30. package/prompts/desktop/flow-build-phase-10.md +357 -357
  31. package/prompts/desktop/flow-build-phase-2.md +282 -282
  32. package/prompts/desktop/flow-build-phase-3.md +291 -291
  33. package/prompts/desktop/flow-build-phase-4.md +308 -308
  34. package/prompts/desktop/flow-build-phase-5.md +269 -269
  35. package/prompts/desktop/flow-build-phase-6.md +350 -350
  36. package/prompts/desktop/flow-build-phase-7.md +297 -297
  37. package/prompts/desktop/flow-build-phase-8.md +541 -541
  38. package/prompts/desktop/flow-build-phase-9.md +439 -439
  39. package/prompts/desktop/flow-build.md +156 -156
  40. package/prompts/desktop/flow-check-review.md +656 -20
  41. package/prompts/desktop/flow-check-test.md +526 -14
  42. package/prompts/desktop/flow-check.md +725 -67
  43. package/prompts/desktop/flow-commit.md +88 -119
  44. package/prompts/desktop/flow-docs-sync.md +354 -354
  45. package/prompts/desktop/flow-finish.md +910 -0
  46. package/prompts/desktop/flow-release.md +662 -0
  47. package/prompts/desktop/flow-work-feature.md +61 -61
  48. package/prompts/desktop/flow-work-fix.md +46 -46
  49. package/prompts/desktop/flow-work-refactor.md +48 -48
  50. package/prompts/desktop/flow-work-resume.md +34 -34
  51. package/prompts/desktop/flow-work.md +1202 -1390
  52. package/prompts/frontend/flow-build-phase-0.md +425 -425
  53. package/prompts/frontend/flow-build-phase-1.md +626 -626
  54. package/prompts/frontend/flow-build-phase-10.md +33 -33
  55. package/prompts/frontend/flow-build-phase-2.md +573 -573
  56. package/prompts/frontend/flow-build-phase-3.md +782 -782
  57. package/prompts/frontend/flow-build-phase-4.md +554 -554
  58. package/prompts/frontend/flow-build-phase-5.md +703 -703
  59. package/prompts/frontend/flow-build-phase-6.md +524 -524
  60. package/prompts/frontend/flow-build-phase-7.md +1001 -1001
  61. package/prompts/frontend/flow-build-phase-8.md +872 -872
  62. package/prompts/frontend/flow-build-phase-9.md +94 -94
  63. package/prompts/frontend/flow-build.md +137 -137
  64. package/prompts/frontend/flow-check-review.md +656 -20
  65. package/prompts/frontend/flow-check-test.md +526 -14
  66. package/prompts/frontend/flow-check.md +725 -67
  67. package/prompts/frontend/flow-commit.md +88 -119
  68. package/prompts/frontend/flow-docs-sync.md +550 -550
  69. package/prompts/frontend/flow-finish.md +910 -0
  70. package/prompts/frontend/flow-release.md +519 -0
  71. package/prompts/frontend/flow-work-api.md +1540 -0
  72. package/prompts/frontend/flow-work-feature.md +61 -61
  73. package/prompts/frontend/flow-work-fix.md +38 -38
  74. package/prompts/frontend/flow-work-refactor.md +48 -48
  75. package/prompts/frontend/flow-work-resume.md +34 -34
  76. package/prompts/frontend/flow-work.md +1583 -1320
  77. package/prompts/mobile/flow-build-phase-0.md +425 -425
  78. package/prompts/mobile/flow-build-phase-1.md +626 -626
  79. package/prompts/mobile/flow-build-phase-10.md +32 -32
  80. package/prompts/mobile/flow-build-phase-2.md +573 -573
  81. package/prompts/mobile/flow-build-phase-3.md +782 -782
  82. package/prompts/mobile/flow-build-phase-4.md +554 -554
  83. package/prompts/mobile/flow-build-phase-5.md +703 -703
  84. package/prompts/mobile/flow-build-phase-6.md +524 -524
  85. package/prompts/mobile/flow-build-phase-7.md +1001 -1001
  86. package/prompts/mobile/flow-build-phase-8.md +888 -888
  87. package/prompts/mobile/flow-build-phase-9.md +90 -90
  88. package/prompts/mobile/flow-build.md +135 -135
  89. package/prompts/mobile/flow-check-review.md +656 -20
  90. package/prompts/mobile/flow-check-test.md +526 -14
  91. package/prompts/mobile/flow-check.md +725 -67
  92. package/prompts/mobile/flow-commit.md +88 -119
  93. package/prompts/mobile/flow-docs-sync.md +620 -620
  94. package/prompts/mobile/flow-finish.md +910 -0
  95. package/prompts/mobile/flow-release.md +751 -0
  96. package/prompts/mobile/flow-work-api.md +1493 -0
  97. package/prompts/mobile/flow-work-feature.md +61 -61
  98. package/prompts/mobile/flow-work-fix.md +46 -46
  99. package/prompts/mobile/flow-work-refactor.md +48 -48
  100. package/prompts/mobile/flow-work-resume.md +34 -34
  101. package/prompts/mobile/flow-work.md +1593 -1329
  102. package/prompts/shared/mermaid-guidelines.md +102 -102
  103. package/prompts/shared/scope-levels.md +114 -114
  104. package/prompts/shared/smart-skip-preflight.md +214 -214
  105. package/prompts/shared/story-points.md +55 -55
  106. package/prompts/shared/task-format.md +74 -74
  107. package/prompts/shared/task-summary-template.md +277 -277
  108. package/templates/AGENT.template.md +443 -443
  109. package/templates/backend/.clauderules.template +112 -112
  110. package/templates/backend/.cursorrules.template +102 -102
  111. package/templates/backend/README.template.md +2 -2
  112. package/templates/backend/ai-instructions.template.md +2 -2
  113. package/templates/backend/copilot-instructions.template.md +2 -2
  114. package/templates/backend/docs/api.template.md +320 -320
  115. package/templates/backend/docs/business-flows.template.md +97 -97
  116. package/templates/backend/docs/code-standards.template.md +2 -2
  117. package/templates/backend/docs/contributing.template.md +3 -3
  118. package/templates/backend/docs/data-model.template.md +520 -520
  119. package/templates/backend/docs/testing.template.md +2 -2
  120. package/templates/backend/project-brief.template.md +2 -2
  121. package/templates/backend/specs/configuration.template.md +2 -2
  122. package/templates/backend/specs/security.template.md +2 -2
  123. package/templates/desktop/.clauderules.template +112 -112
  124. package/templates/desktop/.cursorrules.template +102 -102
  125. package/templates/desktop/README.template.md +170 -170
  126. package/templates/desktop/ai-instructions.template.md +366 -366
  127. package/templates/desktop/copilot-instructions.template.md +140 -140
  128. package/templates/desktop/docs/docs/api.template.md +320 -320
  129. package/templates/desktop/docs/docs/architecture.template.md +724 -724
  130. package/templates/desktop/docs/docs/business-flows.template.md +102 -102
  131. package/templates/desktop/docs/docs/code-standards.template.md +792 -792
  132. package/templates/desktop/docs/docs/contributing.template.md +149 -149
  133. package/templates/desktop/docs/docs/data-model.template.md +520 -520
  134. package/templates/desktop/docs/docs/operations.template.md +720 -720
  135. package/templates/desktop/docs/docs/testing.template.md +722 -722
  136. package/templates/desktop/project-brief.template.md +150 -150
  137. package/templates/desktop/specs/specs/configuration.template.md +121 -121
  138. package/templates/desktop/specs/specs/security.template.md +392 -392
  139. package/templates/frontend/README.template.md +2 -2
  140. package/templates/frontend/ai-instructions.template.md +2 -2
  141. package/templates/frontend/docs/api-integration.template.md +362 -362
  142. package/templates/frontend/docs/components.template.md +2 -2
  143. package/templates/frontend/docs/error-handling.template.md +360 -360
  144. package/templates/frontend/docs/operations.template.md +107 -107
  145. package/templates/frontend/docs/performance.template.md +124 -124
  146. package/templates/frontend/docs/pwa.template.md +119 -119
  147. package/templates/frontend/docs/state-management.template.md +2 -2
  148. package/templates/frontend/docs/styling.template.md +2 -2
  149. package/templates/frontend/docs/testing.template.md +2 -2
  150. package/templates/frontend/project-brief.template.md +2 -2
  151. package/templates/frontend/specs/accessibility.template.md +95 -95
  152. package/templates/frontend/specs/configuration.template.md +2 -2
  153. package/templates/frontend/specs/security.template.md +175 -175
  154. package/templates/fullstack/README.template.md +252 -252
  155. package/templates/fullstack/ai-instructions.template.md +444 -444
  156. package/templates/fullstack/project-brief.template.md +157 -157
  157. package/templates/fullstack/specs/configuration.template.md +340 -340
  158. package/templates/mobile/README.template.md +167 -167
  159. package/templates/mobile/ai-instructions.template.md +196 -196
  160. package/templates/mobile/docs/app-store.template.md +135 -135
  161. package/templates/mobile/docs/architecture.template.md +63 -63
  162. package/templates/mobile/docs/native-features.template.md +94 -94
  163. package/templates/mobile/docs/navigation.template.md +59 -59
  164. package/templates/mobile/docs/offline-strategy.template.md +65 -65
  165. package/templates/mobile/docs/permissions.template.md +56 -56
  166. package/templates/mobile/docs/state-management.template.md +85 -85
  167. package/templates/mobile/docs/testing.template.md +109 -109
  168. package/templates/mobile/project-brief.template.md +69 -69
  169. package/templates/mobile/specs/build-configuration.template.md +91 -91
  170. package/templates/mobile/specs/deployment.template.md +92 -92
  171. package/templates/work.template.md +47 -47
@@ -1,1407 +1,1407 @@
1
- ## PHASE 8: Project Setup & Final Documentation (10-15 min)
2
-
3
- > **Order for this phase:** MUST be executed after Phase 7.
4
-
5
- > **📌 Scope-based behavior:**
6
- > - **All Scopes:** Detect project state, initialize optional framework, and generate final documentation.
7
-
8
- ### Objective
9
- Initialize the project structure (if starting from scratch) and consolidate all collected information into comprehensive documentation (README, API specs, contributing guides).
10
- ## 📋 Phase 8 Overview
11
-
12
- This final phase will:
13
-
14
- 1. **Detect project state** (new vs existing project)
15
- 2. **Initialize framework** (optional, for new projects)
16
- 3. **Generate final documentation** (business-flows, api, contributing)
17
- 4. **Generate master index** (AGENT.md)
18
- 5. **Generate README.md** (with intelligent merge if needed)
19
- 6. **Create tool-specific configs** (based on AI tool selection)
20
- ---
21
- ## 8.1: Project State Detection
22
-
23
- > ⚠️ **PRE-REQUISITE CHECK:** Before proceeding, verify that README.md does NOT exist yet (unless it's a framework-generated one from previous initialization). If README.md exists and was NOT generated by a framework, this indicates an error in previous phases.
24
-
25
- // turbo
26
- 🔍 Detecting current project state...
27
-
28
- **⚠️ CRITICAL: Ignore AI Flow documentation and Meta files during detection:**
29
- - Files: `project-brief.md`, `ai-instructions.md`, `AGENT.md`, `.env.example`, `.cursorrules`, `.clauderules`, `.geminirules`
30
- - Directories: `.ai-flow/`, `.agent/`, `docs/`, `specs/`
31
-
32
- **Auto-detect Checklist:**
33
-
34
- - [ ] **Functional Source Code:** Check for business logic files (`.ts`, `.py`, `.go`, `.js`, etc.) in `src/`, `app/`, `internal/` or root.
35
- - [ ] **Framework Configuration:** Check for `nest-cli.json`, `manage.py`, `go.mod`, `pom.xml`, `package.json`, etc.
36
- - [ ] **Package Manager Lockfiles:** Check for `package-lock.json`, `pnpm-lock.yaml`, `poetry.lock`, etc.
37
- - [ ] **Existing README.md:** Is there a README.md that was NOT created by AI Flow?
38
-
39
- **Classification Rules (Strict Order):**
40
-
41
- 1. **New Project** (Offer Initialization):
42
- - root contains ONLY AI Flow docs and/or hidden folders like `.git`, `.github`, `.vscode`.
43
- - NO `package.json`, NO `src/`, NO functional code files.
44
- 2. **Initialized Framework** (Skip Initialization):
45
- - Root contains framework configs (`package.json`, `go.mod`, etc.) but `src/` is empty or only contains framework boilerplate.
46
- 3. **Existing Project** (Skip Initialization):
47
- - Substantial functional source code already exists in the project.
48
-
49
- **Present Detection Results:**
50
-
51
- ```
52
- 📊 Project State Detection:
53
-
54
- Type: [New Project | Initialized Framework | Existing Project]
55
-
56
- Found:
57
- - Functional code: [list non-AI Flow source files or none]
58
- - Framework files: [list or none]
59
- - Package manager: [npm/pip/go/etc. or none]
60
- - README.md: [exists: yes/no]
61
-
62
- Recommendation: [Next action based on state]
63
- ```
64
- ---
65
- ## 8.2: Framework Initialization (Optional)
66
-
67
- **Only if:** Project state = "New Project"
68
-
69
- ### 8.2.1: Ask User Preference
70
-
71
- ```
72
- 🎯 Your project appears to be new.
73
-
74
- Would you like me to initialize the [FRAMEWORK_NAME] project structure now?
75
-
76
- Options:
77
- A) ✅ Yes, initialize [FRAMEWORK_NAME] (recommended)
78
- B) ⏭️ Skip for now (manual setup later)
79
-
80
- → Your choice:
81
- ```
82
-
83
- **If user chooses A (initialize):**
84
-
85
- ### 8.2.2: Pre-initialization Backup
86
-
87
- ```
88
- 📦 Preparing for framework initialization...
89
-
90
- Creating backup of AI Flow documentation:
91
- → Moving project root docs to .ai-flow/temp-backup/
92
-
93
- Files to backup:
94
- ✅ project-brief.md
95
- ✅ docs/data-model.md
96
- ✅ docs/architecture.md
97
- ✅ ai-instructions.md
98
- ✅ specs/security.md
99
- ✅ docs/code-standards.md
100
- ✅ docs/testing.md
101
- ✅ docs/operations.md
102
- ✅ specs/configuration.md
103
- ✅ .env.example
104
-
105
- Backup complete! Safe to initialize framework.
106
- ```
107
-
108
- ### 8.2.3: Execute Framework CLI
109
-
110
- **IMPORTANT:** Use Bash tool to execute the framework's official CLI command. This ensures the project gets the latest stable versions and official project structure.
111
-
112
- **Based on framework detected in Phase 3, execute ONE of these commands:**
113
-
114
- **NestJS:**
115
-
116
- ```bash
117
- npx @nestjs/cli new . --skip-git --package-manager npm
118
- ```
119
-
120
- **Express:**
121
-
122
- ```bash
123
- # Initialize package.json
124
- npm init -y
125
-
126
- # Install core dependencies with latest versions
127
- npm install express cors helmet dotenv
128
-
129
- # Install dev dependencies
130
- npm install -D typescript @types/node @types/express ts-node nodemon
131
-
132
- # Create src/app.ts from template (see section 8.2.6.4)
133
- ```
134
-
135
- **Django:**
136
-
137
- ```bash
138
- django-admin startproject config .
139
- ```
140
-
141
- **FastAPI:**
142
-
143
- ```bash
144
- # Install FastAPI with latest stable
145
- pip install "fastapi[standard]" uvicorn[standard]
146
-
147
- # Create app/main.py from template (see section 8.2.6.4)
148
- ```
149
-
150
- **Spring Boot:**
151
-
152
- ```bash
153
- spring init --dependencies=web,data-jpa --build=maven --name=[ProjectName] .
154
- ```
155
-
156
- **Laravel:**
157
-
158
- ```bash
159
- composer create-project laravel/laravel .
160
- ```
161
-
162
- **Go (Gin):**
163
-
164
- ```bash
165
- go mod init [module-name]
166
- go get -u github.com/gin-gonic/gin
167
- ```
168
-
169
- **Ruby on Rails:**
170
-
171
- ```bash
172
- rails new . --api --skip-git --database=postgresql
173
- ```
174
-
175
- **.NET Core:**
176
-
177
- ```bash
178
- dotnet new webapi -n [ProjectName] -o .
179
- ```
180
-
181
- **Show progress as command executes:**
182
-
183
- ```
184
- 🚀 Executing: npx @nestjs/cli new . --skip-git
185
-
186
- [Real CLI output from Bash tool]
187
-
188
- ✅ Framework initialized successfully!
189
- ```
190
-
191
- **Result:** Framework CLI creates:
192
-
193
- - ✅ package.json / requirements.txt / pom.xml (with latest versions)
194
- - ✅ tsconfig.json / pyproject.toml (optimized configs)
195
- - ✅ Basic src/ structure
196
- - ✅ Test setup
197
- - ✅ Linting/formatting configs
198
-
199
- **Next:** Only add what framework doesn't include (see 8.2.6)
200
-
201
- ### 8.2.4: Restore AI Flow Documentation
202
-
203
- ```
204
- 📥 Restoring AI Flow documentation...
205
-
206
- Moving files from .ai-flow/temp-backup/ back to .ai-flow/
207
-
208
- ✅ All AI Flow docs restored!
209
- ```
210
-
211
- ### 8.2.5: Handle README.md Conflict
212
-
213
- **If framework created README.md:**
214
-
215
- ```
216
- ⚠️ Framework generated its own README.md
217
-
218
- I'll merge it with AI Flow's comprehensive README:
219
-
220
- Strategy:
221
- 1. Keep framework's quick start section (if valuable)
222
- 2. Replace with AI Flow's comprehensive content
223
- 3. Preserve any framework-specific setup instructions
224
-
225
- Merging...
226
- ```
227
-
228
- **Merge Logic:**
229
-
230
- - Extract framework's "Getting Started" or "Installation" section (usually first 50-100 lines)
231
- - Use AI Flow's README template as base
232
- - Insert framework's quick start in appropriate section
233
- - Ensure no duplication
234
- - Keep AI Flow's structure (overview, features, tech stack, etc.)
235
-
236
- **If user chooses B (skip):**
237
-
238
- ```
239
- ⏭️ Skipping framework initialization.
240
-
241
- You can initialize manually later with:
242
- [Show appropriate CLI command]
243
-
244
- Proceeding to documentation generation...
245
- ```
246
-
247
- ### 8.2.6: Minimal Post-Init Enhancements
248
-
249
- **IMPORTANT:** Only add what the framework CLI doesn't include. **DO NOT** create business logic, entity modules, or complete features.
250
-
251
- ```
252
- 📦 Adding minimal enhancements...
253
-
254
- Framework base created by CLI ✅
255
- Now adding only essential files that framework doesn't include...
256
- ```
257
-
258
- **Based on selected framework and database from previous phases:**
259
-
260
- ### 8.2.6.1: Environment Variables Template
261
-
262
- **Copy `.env.example` template to project root:**
263
-
264
- ```bash
265
- # Copy from .ai-flow/templates/.env.example.template to .env.example
266
- ```
267
-
268
- **Template content (adapt based on framework and database):**
269
-
270
- ```env
271
- # Database
272
- DATABASE_URL="postgresql://postgres:password@localhost:5432/{{PROJECT_NAME}}_dev?schema=public"
273
-
274
- # JWT Authentication
275
- JWT_SECRET="your-secret-key-here-change-in-production"
276
- JWT_EXPIRES_IN="24h"
277
-
278
- # Application
279
- NODE_ENV="development"
280
- PORT=3000
281
- API_PREFIX="/api"
282
-
283
- # CORS
284
- CORS_ORIGIN="http://localhost:3000"
285
-
286
- # Redis (if using)
287
- REDIS_HOST="localhost"
288
- REDIS_PORT=6379
289
-
290
- # Email (if using)
291
- SMTP_HOST=""
292
- SMTP_PORT=587
293
- SMTP_USER=""
294
- SMTP_PASS=""
295
- ```
296
-
297
- **User must copy to `.env` manually:**
298
-
299
- ```
300
- 📝 Created .env.example template
301
- ⚠️ User must copy to .env and configure: cp .env.example .env
302
- ```
303
-
304
- ### 8.2.6.2: Docker Compose (Optional)
305
-
306
- **Only if user selected Docker in Phase 7.**
307
-
308
- **Copy appropriate docker-compose template based on database:**
309
-
310
- **PostgreSQL:**
311
-
312
- ```yaml
313
- # Copy from templates/docker-compose/postgres.template.yml
314
- version: '3.8'
315
-
316
- services:
317
- postgres:
318
- image: postgres:15-alpine
319
- restart: unless-stopped
320
- environment:
321
- POSTGRES_DB: ${DB_NAME:-myapp_dev}
322
- POSTGRES_USER: ${DB_USER:-postgres}
323
- POSTGRES_PASSWORD: ${DB_PASSWORD:-password}
324
- ports:
325
- - '${DB_PORT:-5432}:5432'
326
- volumes:
327
- - postgres_data:/var/lib/postgresql/data
328
- healthcheck:
329
- test: ['CMD-SHELL', 'pg_isready -U postgres']
330
- interval: 10s
331
- timeout: 5s
332
- retries: 5
333
-
334
- volumes:
335
- postgres_data:
336
- ```
337
-
338
- **MySQL:**
339
-
340
- ```yaml
341
- # Copy from templates/docker-compose/mysql.template.yml
342
- version: '3.8'
343
-
344
- services:
345
- mysql:
346
- image: mysql:8-oracle
347
- restart: unless-stopped
348
- environment:
349
- MYSQL_DATABASE: ${DB_NAME:-myapp_dev}
350
- MYSQL_ROOT_PASSWORD: ${DB_PASSWORD:-password}
351
- ports:
352
- - '${DB_PORT:-3306}:3306'
353
- volumes:
354
- - mysql_data:/var/lib/mysql
355
-
356
- volumes:
357
- mysql_data:
358
- ```
359
-
360
- **MongoDB:**
361
-
362
- ```yaml
363
- # Copy from templates/docker-compose/mongodb.template.yml
364
- version: '3.8'
365
-
366
- services:
367
- mongodb:
368
- image: mongo:7
369
- restart: unless-stopped
370
- environment:
371
- MONGO_INITDB_DATABASE: ${DB_NAME:-myapp_dev}
372
- MONGO_INITDB_ROOT_USERNAME: ${DB_USER:-root}
373
- MONGO_INITDB_ROOT_PASSWORD: ${DB_PASSWORD:-password}
374
- ports:
375
- - '${DB_PORT:-27017}:27017'
376
- volumes:
377
- - mongodb_data:/data/db
378
-
379
- volumes:
380
- mongodb_data:
381
- ```
382
-
383
- ### 8.2.6.3: ORM Setup (If Framework Doesn't Include)
384
-
385
- **Only for frameworks that don't auto-configure ORM:**
386
-
387
- **NestJS + Prisma:**
388
-
389
- ```bash
390
- npx prisma init
391
- # Creates prisma/schema.prisma automatically with DATABASE_URL from .env
392
- ```
393
-
394
- **Express + Prisma:**
395
-
396
- ```bash
397
- npm install prisma @prisma/client
398
- npx prisma init
399
- ```
400
-
401
- **FastAPI + SQLAlchemy:**
402
-
403
- ```bash
404
- # SQLAlchemy setup (create app/core/database.py)
405
- # Follow FastAPI documentation: https://fastapi.tiangolo.com/tutorial/sql-databases/
406
- ```
407
-
408
- **Django:**
409
-
410
- ```bash
411
- # ORM already configured by django-admin startproject
412
- # Just configure DATABASE settings in config/settings/base.py
413
- ```
414
-
415
- **Result:**
416
-
417
- ```
418
- ✅ ORM initialized
419
- ✅ schema.prisma created (or equivalent)
420
- ✅ Migrations ready to run
421
- ```
422
-
423
- ### 8.2.6.4: Starter Files for Express/FastAPI (Optional)
424
-
425
- **Only if user needs a basic starting point. Otherwise, skip and let them follow official docs.**
426
-
427
- **Express:**
428
-
429
- - Create `src/app.ts` with basic Express setup (middleware, health endpoint)
430
- - Reference: https://expressjs.com/en/starter/hello-world.html
431
-
432
- **FastAPI:**
433
-
434
- - Create `app/main.py` with basic FastAPI setup (CORS, health endpoint)
435
- - Reference: https://fastapi.tiangolo.com/tutorial/first-steps/
436
-
437
- **Docker Compose (if needed):**
438
-
439
- - Reference official Docker Hub documentation:
440
- - PostgreSQL: https://hub.docker.com/_/postgres
441
- - MySQL: https://hub.docker.com/_/mysql
442
- - MongoDB: https://hub.docker.com/_/mongo
443
-
444
- ### 8.2.6.5: Summary
445
-
446
- ```
447
- ✅ Minimal enhancements complete!
448
-
449
- Files created (2-3 max):
450
- ✅ .env.example (environment template)
451
- ✅ docker-compose.yml (if Docker selected)
452
- ✅ prisma/schema.prisma (if Prisma ORM)
453
-
454
- 🎯 Total: 2-3 files (vs 40-60 files in old approach)
455
- 📚 For Express/FastAPI starter code, refer to official documentation
456
-
457
- Next steps:
458
- 1. Generate .gitignore (step 8.2.7 - runs for all projects)
459
- 2. Copy .env.example to .env and configure
460
- 3. Start database: docker-compose up -d (if applicable)
461
- 4. Run migrations: npm run db:migrate or equivalent
462
- 5. Start dev server: npm run start:dev or equivalent
463
- 6. Create features with /feature command
464
- ```
465
-
466
- **CRITICAL RULES:**
467
-
468
- - ❌ **DO NOT** create entity modules (User, Product, Order, etc.)
469
- - ❌ **DO NOT** create controllers/routes for business logic
470
- - ❌ **DO NOT** create authentication endpoints
471
- - ❌ **DO NOT** create complete folder structures
472
- - ❌ **DO NOT** install 40+ packages manually
473
- - ✅ **ONLY** create .env.example, .gitignore, docker-compose (optional), ORM init
474
- - ✅ **LET** framework CLI handle structure, configs, dependencies
475
- - ✅ **REFER** to official docs for starter code when needed
476
- ---
477
- ## 8.2.7: Generate .gitignore (Always)
478
-
479
- **IMPORTANT:** This step runs for ALL projects, regardless of framework initialization choice.
480
-
481
- ```
482
- 📝 Generating .gitignore for your tech stack...
483
- ```
484
-
485
- **Strategy:**
486
-
487
- 1. **Detect framework from Phase 3** (NestJS, Express, Django, FastAPI, etc.)
488
- 2. **Detect language** (Node.js, Python, Go, etc.)
489
- 3. **Detect tools from Phase 7** (Docker, Prisma, etc.)
490
- 4. **Combine relevant patterns**
491
-
492
- **Base patterns by technology:**
493
-
494
- **Node.js projects (NestJS, Express):**
495
-
496
- ```gitignore
497
- # Dependencies
498
- node_modules/
499
- npm-debug.log*
500
- yarn-debug.log*
501
- yarn-error.log*
502
- .pnpm-debug.log*
503
-
504
- # Build outputs
505
- dist/
506
- build/
507
- *.tsbuildinfo
508
-
509
- # Environment variables
510
- .env
511
- .env.local
512
- .env.*.local
513
-
514
- # IDE
515
- .vscode/
516
- .idea/
517
- *.swp
518
- *.swo
519
- *~
520
-
521
- # OS
522
- .DS_Store
523
- Thumbs.db
524
-
525
- # Testing
526
- coverage/
527
- .nyc_output/
528
-
529
- # Logs
530
- logs/
531
- *.log
532
-
533
- # Prisma (if using)
534
- prisma/migrations/dev.db
535
- prisma/*.db
536
-
537
- # TypeScript
538
- *.tsbuildinfo
539
- ```
540
-
541
- **Python projects (Django, FastAPI):**
542
-
543
- ```gitignore
544
- # Python
545
- __pycache__/
546
- *.py[cod]
547
- *$py.class
548
- *.so
549
- .Python
550
-
551
- # Virtual environments
552
- venv/
553
- env/
554
- ENV/
555
- .venv
556
-
557
- # Django
558
- *.log
559
- db.sqlite3
560
- db.sqlite3-journal
561
- media/
562
- staticfiles/
563
-
564
- # FastAPI
565
- .pytest_cache/
566
-
567
- # Environment
568
- .env
569
- .env.local
570
-
571
- # IDE
572
- .vscode/
573
- .idea/
574
- *.swp
575
-
576
- # OS
577
- .DS_Store
578
- ```
579
-
580
- **Go projects:**
581
-
582
- ```gitignore
583
- # Binaries
584
- *.exe
585
- *.exe~
586
- *.dll
587
- *.so
588
- *.dylib
589
- bin/
590
-
591
- # Test binary
592
- *.test
593
-
594
- # Output
595
- *.out
596
-
597
- # Go workspace
598
- go.work
599
-
600
- # Environment
601
- .env
602
-
603
- # IDE
604
- .vscode/
605
- .idea/
606
- ```
607
-
608
- **Docker additions (if Docker selected in Phase 7):**
609
-
610
- ```gitignore
611
- # Docker
612
- docker-compose.override.yml
613
- .docker/
614
- ```
615
-
616
- **📝 Action:** Generate and write `.gitignore` to project root.
617
-
618
- **Selection logic:**
619
-
620
- - If NestJS/Express → Use Node.js patterns
621
- - If Django/FastAPI → Use Python patterns
622
- - If Go/Gin → Use Go patterns
623
- - If Prisma detected in Phase 3 → Add Prisma patterns
624
- - If Docker selected in Phase 7 → Add Docker patterns
625
-
626
- ```
627
- ✅ Generated: .gitignore
628
- Patterns included: [Node.js | Python | Go] + [Prisma] + [Docker]
629
- ```
630
- ---
631
- ## 8.3: Generate Final Documentation
632
-
633
- ```
634
- 📖 Re-reading all generated documents to ensure accuracy...
635
-
636
- ✅ Re-reading project-brief.md
637
- ✅ Re-reading docs/data-model.md
638
- ✅ Re-reading docs/architecture.md
639
- ✅ Re-reading ai-instructions.md
640
- ✅ Re-reading specs/security.md
641
- ✅ Re-reading docs/code-standards.md
642
- ✅ Re-reading docs/testing.md
643
- ✅ Re-reading docs/operations.md
644
- ✅ Re-reading specs/configuration.md
645
- ✅ Re-reading .env.example
646
-
647
- ✅ Context fully loaded and updated!
648
-
649
- 🎉 Now generating final 5 documents:
650
-
651
- 1. docs/business-flows.md - Business process flows and mermaid diagrams
652
- 2. docs/api.md - API endpoints and conventions reference
653
- 3. docs/contributing.md - Contribution guidelines
654
- 4. README.md - Project overview (consolidates all phases)
655
- 5. AGENT.md - Universal AI configuration (master index)
656
-
657
- Generating...
658
- ```
659
-
660
- ### 8.3.1: Generate docs/business-flows.md
661
-
662
- - **Template:** `.ai-flow/templates/docs/business-flows.template.md`
663
- - **Content from:** Phase 1 (questions 1.3, 1.4, 1.5)
664
- - **Requirements:**
665
- - List all business flows from Phase 1
666
- - Generate mermaid sequence/flow diagram for EACH flow
667
- - Include actors, steps, decision points
668
- - Add error handling scenarios
669
- - Link to relevant entities from data-model.md
670
-
671
- **Example format:**
672
-
673
- ```markdown
674
- ## User Registration Flow
675
-
676
- **Actors:** User, System, Email Service
677
-
678
- **Steps:**
679
-
680
- 1. User submits registration form
681
- 2. System validates input
682
- 3. System creates user account
683
- 4. System sends verification email
684
- 5. User clicks verification link
685
- 6. System activates account
686
-
687
- **Mermaid Diagram:**
688
-
689
- [Generate mermaid sequence diagram]
690
- ```
691
-
692
- **📝 Action:** Write the complete file to `docs/business-flows.md`
693
-
694
- ```
695
- ✅ Generated: docs/business-flows.md
696
- ```
697
- ---
698
- ### 8.3.2: Generate docs/api.md
699
-
700
- - **Template:** `.ai-flow/templates/docs/api.template.md`
701
- - **Content from:** Phase 2 (entities) + Phase 3 (question 3.5 - API conventions)
702
- - **Requirements:**
703
- - Auto-generate CRUD endpoints for each entity from data-model.md
704
- - Apply REST/GraphQL conventions from Phase 3
705
- - Include authentication requirements
706
- - Document pagination format
707
- - Document error response format
708
- - Include example requests/responses
709
-
710
- **Example format:**
711
-
712
- ````markdown
713
- ## Users API
714
-
715
- ### List Users
716
-
717
- `GET /api/users`
718
-
719
- **Authentication:** Required (Bearer token)
720
-
721
- **Query Parameters:**
722
-
723
- - `page` (number): Page number (default: 1)
724
- - `limit` (number): Items per page (default: 20)
725
- - `sort` (string): Sort field (default: createdAt)
726
-
727
- **Response:**
728
-
729
- ```json
730
- {
731
- "data": [...],
732
- "meta": {
733
- "page": 1,
734
- "limit": 20,
735
- "total": 150
736
- }
737
- }
738
- ```
739
- ````
740
-
741
- ````
742
-
743
- ### 8.3.3: Generate docs/contributing.md
744
-
745
- - **Template:** `.ai-flow/templates/docs/contributing.template.md`
746
- - **Content from:** Phase 5 (questions 5.1-5.5) + Phase 7 (setup)
747
- - **Requirements:**
748
- - Git workflow from Phase 5
749
- - Commit message format from Phase 5
750
- - Code review process from Phase 5
751
- - Setup instructions from Phase 3 & 7
752
- - Testing requirements from Phase 6
753
-
754
- **Example format:**
755
-
756
- ```markdown
757
- ## Getting Started
758
-
759
- 1. Clone repository
760
- 2. Install dependencies: `[command from Phase 7]`
761
- 3. Copy `.env.example` to `.env`
762
- 4. Run migrations: `[command from Phase 7]`
763
- 5. Start dev server: `[command from Phase 7]`
764
-
765
- ## Git Workflow
766
-
767
- We use [workflow from Phase 5]
768
-
769
- ## Commit Format
770
-
771
- [Format from Phase 5.2]
772
- ````
773
-
774
- **📝 Action:** Write the complete file to `docs/contributing.md`
775
-
776
- ```
777
- ✅ Generated: docs/contributing.md
778
- ```
779
- ---
780
- ## 8.4: Generate AGENT.md (Master Index)
781
-
782
- - **Template:** `.ai-flow/templates/AGENT.template.md`
783
- - **Content from:** ALL phases (this is the aggregator)
784
- - **Requirements:**
785
- - **CRITICAL:** Re-read ALL 10 previously generated documents before filling
786
- - List all 15 documents with descriptions
787
- - Provide quick reference to tech stack
788
- - Include critical architecture rules
789
- - Link to all specs and docs
790
- - Summarize key decisions from each phase
791
- - Include common commands
792
-
793
- **Structure:**
794
-
795
- ```markdown
796
- # 🤖 AGENT.md - Universal AI Assistant Configuration
797
-
798
- ## 📚 Documentation Index
799
-
800
- ### Core Documents
801
-
802
- 1. **project-brief.md** - [1-sentence description]
803
- 2. **ai-instructions.md** - [1-sentence description]
804
-
805
- ### Specifications
806
-
807
- 3. **specs/security.md** - [1-sentence description]
808
- 4. **specs/configuration.md** - [1-sentence description]
809
-
810
- ### Documentation
811
-
812
- 5. **docs/data-model.md** - [1-sentence description]
813
- 6. **docs/architecture.md** - [1-sentence description]
814
- 7. **docs/business-flows.md** - [1-sentence description]
815
- 8. **docs/api.md** - [1-sentence description]
816
- 9. **docs/code-standards.md** - [1-sentence description]
817
- 10. **docs/testing.md** - [1-sentence description]
818
- 11. **docs/operations.md** - [1-sentence description]
819
- 12. **docs/contributing.md** - [1-sentence description]
820
-
821
- ### Quick Start
822
-
823
- 13. **.env.example** - Environment variables template
824
- 14. **README.md** - Project overview and setup
825
-
826
- ## 🎯 Quick Reference
827
-
828
- ### Tech Stack
829
-
830
- [List from Phase 3]
831
-
832
- ### Critical Rules
833
-
834
- [Key rules from code-standards.md and ai-instructions.md]
835
-
836
- ### Common Commands
837
-
838
- [From operations.md and contributing.md]
839
- ```
840
- ---
841
- ## 8.5: Generate README.md (Intelligent Merge)
842
-
843
- - **Template:** `.ai-flow/templates/README.template.md`
844
- - **Content from:** ALL phases (most comprehensive document)
845
- - **Requirements:**
846
- - **CRITICAL:** Re-read ALL documents before generating
847
- - Include project overview from Phase 1
848
- - List features from Phase 1
849
- - Show tech stack from Phase 3
850
- - Include quick start from Phase 7
851
- - Link to all documentation
852
- - Include deployment info from Phase 7
853
- - Add badges, license, contact info
854
-
855
- **Merge Strategy (if framework README exists):**
856
-
857
- 1. **Read framework's README.md** (if exists from step 8.2)
858
- 2. **Extract valuable sections:**
859
- - Installation commands specific to framework
860
- - Framework-specific setup instructions
861
- - Any auto-generated content that's useful
862
- 3. **Use AI Flow template as base structure:**
863
- - Project name and description (from Phase 1)
864
- - Features (from Phase 1)
865
- - Tech stack (from Phase 3)
866
- - Architecture overview (link to docs/architecture.md)
867
- - Getting started (merge with framework's instructions)
868
- - API documentation (link to docs/api.md)
869
- - Testing (link to docs/testing.md)
870
- - Deployment (from Phase 7)
871
- - Contributing (link to docs/contributing.md)
872
- - License
873
- 4. **Insert framework-specific content** in "Getting Started" section
874
- 5. **Ensure no duplication** between sections
875
- 6. **Validate all links** work correctly
876
-
877
- **Example merged section:**
878
-
879
- ````markdown
880
- ## 🚀 Getting Started
881
-
882
- ### Prerequisites
883
-
884
- - Node.js 18+ (from Phase 3)
885
- - PostgreSQL 14+ (from Phase 3)
886
- - Redis 6+ (from Phase 3)
887
-
888
- ### Installation
889
-
890
- 1. Clone the repository:
891
-
892
- ```bash
893
- git clone [repo-url]
894
- cd [project-name]
895
- ```
896
- ````
897
-
898
- 2. Install dependencies:
899
-
900
- ```bash
901
- npm install # From framework
902
- ```
903
-
904
- 3. Set up environment variables:
905
-
906
- ```bash
907
- cp .env.example .env
908
- # Edit .env with your configuration (see specs/configuration.md)
909
- ```
910
-
911
- 4. Run database migrations:
912
-
913
- ```bash
914
- npm run migration:run # From Phase 7
915
- ```
916
-
917
- 5. Start development server:
918
-
919
- ```bash
920
- npm run start:dev # From framework
921
- ```
922
-
923
- The API will be available at `http://localhost:3000`
924
-
925
- ````
926
-
927
- **📝 Action:** Write the complete file to `README.md` (project root)
928
-
929
- ```
930
- ✅ Generated: README.md
931
- [If merged] Merged with framework's setup instructions
932
- ```
933
- ---
934
- ## 8.6: Generate AGENT.md (Master Index)
935
-
936
- **CRITICAL:** Before generating AGENT.md, re-read ALL previously generated documents to have complete context.
937
-
938
- **📝 Action:**
939
-
940
- ```
941
- 🔄 Re-reading all generated documents for AGENT.md generation...
942
-
943
- ✅ Reading project-brief.md
944
- ✅ Reading ai-instructions.md
945
- ✅ Reading docs/data-model.md
946
- ✅ Reading docs/architecture.md
947
- ✅ Reading docs/code-standards.md
948
- ✅ Reading docs/testing.md
949
- ✅ Reading docs/operations.md
950
- ✅ Reading specs/security.md
951
- ✅ Reading specs/configuration.md
952
- ✅ Reading docs/business-flows.md
953
- ✅ Reading docs/api.md
954
- ✅ Reading docs/contributing.md
955
-
956
- ✅ All context loaded!
957
- ```
958
-
959
- Now generate AGENT.md with complete information from all documents.
960
-
961
- **📝 Action:** Write the complete file to `.ai-flow/AGENT.md`
962
-
963
- ```
964
- ✅ Generated: .ai-flow/AGENT.md (Master Index)
965
- ```
966
- ---
967
- ## 8.7: Create Tool-Specific Configs
968
-
969
- **Based on AI tool selection from Phase 3 (question 3.8):**
970
-
971
- ### If Claude selected:
972
-
973
- **Create `.clauderules`:**
974
-
975
- ```markdown
976
- # Claude AI Configuration
977
-
978
- This project uses AI Flow documentation structure.
979
-
980
- ## Primary Reference
981
-
982
- Read `.ai-flow/AGENT.md` first for complete documentation index.
983
-
984
- ## Key Documents
985
-
986
- - Project overview: `.ai-flow/project-brief.md`
987
- - AI instructions: `.ai-flow/ai-instructions.md`
988
- - Architecture: `docs/architecture.md`
989
- - API reference: `docs/api.md`
990
- - Code standards: `docs/code-standards.md`
991
-
992
- ## Working Instructions
993
-
994
- When writing code:
995
-
996
- 1. Follow patterns in `docs/code-standards.md`
997
- 2. Reference data model in `docs/data-model.md`
998
- 3. Implement security rules from `specs/security.md`
999
- 4. Write tests per `docs/testing.md`
1000
-
1001
- ## Critical Rules
1002
-
1003
- [Extract top 5-10 rules from ai-instructions.md]
1004
- ```
1005
-
1006
- ### If Cursor selected:
1007
-
1008
- **Create `.cursorrules`:**
1009
-
1010
- ```markdown
1011
- # Cursor AI Configuration
1012
-
1013
- Project uses AI Flow documentation in `.ai-flow/` directory.
1014
-
1015
- ## Documentation Index
1016
-
1017
- See `.ai-flow/AGENT.md` for complete document list.
1018
-
1019
- ## Quick Reference
1020
-
1021
- - Tech Stack: [from Phase 3]
1022
- - Architecture: `docs/architecture.md`
1023
- - Code Standards: `docs/code-standards.md`
1024
- - API Conventions: `docs/api.md`
1025
-
1026
- ## Code Generation Rules
1027
-
1028
- [Extract key rules from ai-instructions.md]
1029
-
1030
- ## Testing Requirements
1031
-
1032
- [Extract from docs/testing.md]
1033
- ```
1034
-
1035
- ### If GitHub Copilot selected:
1036
-
1037
- **Create `.github/copilot-instructions.md`:**
1038
-
1039
- ```markdown
1040
- # GitHub Copilot Instructions
1041
-
1042
- ## Project Context
1043
-
1044
- [Project description from Phase 1]
1045
-
1046
- ## Documentation Structure
1047
-
1048
- This project uses AI Flow. All documentation is in `.ai-flow/` directory.
1049
-
1050
- Master index: `.ai-flow/AGENT.md`
1051
-
1052
- ## Key References
1053
-
1054
- - Architecture: `docs/architecture.md`
1055
- - Data Model: `docs/data-model.md`
1056
- - API: `docs/api.md`
1057
- - Code Standards: `docs/code-standards.md`
1058
- - Testing: `docs/testing.md`
1059
-
1060
- ## Code Generation Guidelines
1061
-
1062
- [Extract guidelines from ai-instructions.md and code-standards.md]
1063
-
1064
- ## Tech Stack
1065
-
1066
- [From Phase 3]
1067
-
1068
- ## Common Patterns
1069
-
1070
- [Extract from code-standards.md]
1071
- ```
1072
-
1073
- ### If Antigravity selected:
1074
-
1075
- **Create `.antigravityrules`:**
1076
-
1077
- ```markdown
1078
- # Antigravity AI Configuration
1079
-
1080
- Project uses AI Flow documentation in `.ai-flow/` directory.
1081
-
1082
- ## Documentation Index
1083
-
1084
- See `.ai-flow/AGENT.md` for complete document list.
1085
-
1086
- ## Quick Reference
1087
-
1088
- - Tech Stack: [from Phase 3]
1089
- - Architecture: `docs/architecture.md`
1090
- - Code Standards: `docs/code-standards.md`
1091
- - API Conventions: `docs/api.md`
1092
-
1093
- ## Workflow Commands
1094
-
1095
- - `/flow-build` - Generate documentation
1096
- - `/flow-dev-feature` - Create new features
1097
- - `/flow-dev-fix` - Fix bugs
1098
- - `/flow-dev-commit` - Automate commits
1099
-
1100
- ## Code Generation Rules
1101
-
1102
- [Extract key rules from ai-instructions.md]
1103
-
1104
- ## Testing Requirements
1105
-
1106
- [Extract from docs/testing.md]
1107
- ```
1108
-
1109
- **📝 Action:** Generate the tool-specific config files based on selection:
1110
-
1111
- - If Claude → Write `.clauderules`
1112
- - If Cursor → Write `.cursorrules`
1113
- - If Copilot → Write `.github/copilot-instructions.md`
1114
- - If Antigravity → Write `.antigravityrules`
1115
- - If "All" → Write all four files
1116
-
1117
- ```
1118
- ✅ Generated tool-specific configs:
1119
- [List generated files based on selection]
1120
- ```
1121
- ---
1122
- ## 8.8: Final Validation & Success Message
1123
-
1124
- ```
1125
- 🔍 Validating all generated files...
1126
-
1127
- ✅ Checking for placeholder text...
1128
- ✅ Validating file references...
1129
- ✅ Ensuring all links work...
1130
- ✅ Verifying template completeness...
1131
-
1132
- All validations passed!
1133
- ```
1134
-
1135
- **Show complete summary:**
1136
-
1137
- ```
1138
- 🎉 AI Flow Complete!
1139
-
1140
- Generated 16 documents successfully:
1141
-
1142
- Phase 1:
1143
- ✅ project-brief.md
1144
-
1145
- Phase 2:
1146
- ✅ docs/data-model.md
1147
-
1148
- Phase 3:
1149
- ✅ docs/architecture.md
1150
- ✅ ai-instructions.md
1151
-
1152
- Phase 4:
1153
- ✅ specs/security.md
1154
-
1155
- Phase 5:
1156
- ✅ docs/code-standards.md
1157
-
1158
- Phase 6:
1159
- ✅ docs/testing.md
1160
-
1161
- Phase 7:
1162
- ✅ docs/operations.md
1163
- ✅ specs/configuration.md
1164
- ✅ .env.example
1165
-
1166
- Phase 8:
1167
- ✅ docs/business-flows.md
1168
- ✅ docs/api.md
1169
- ✅ docs/contributing.md
1170
- ✅ README.md
1171
- ✅ AGENT.md
1172
- ✅ .gitignore
1173
-
1174
- [If framework initialized:]
1175
- ✅ [FRAMEWORK_NAME] project initialized
1176
-
1177
- [If README merged:]
1178
- ✅ README.md merged with framework's setup instructions
1179
-
1180
- Tool-specific configs:
1181
- ✅ [List generated configs: .clauderules, .cursorrules, .github/copilot-instructions.md, .antigravityrules]
1182
- ---
1183
- 📁 Project Structure:
1184
- ```
1185
-
1186
- your-project/
1187
- ├── .ai-flow/ # AI Flow documentation
1188
- │ ├── project-brief.md
1189
- │ ├── AGENT.md ⭐ Start here!
1190
- │ ├── ai-instructions.md
1191
- │ ├── docs/
1192
- │ │ ├── data-model.md
1193
- │ │ ├── architecture.md
1194
- │ │ ├── business-flows.md
1195
- │ │ ├── api.md
1196
- │ │ ├── code-standards.md
1197
- │ │ ├── testing.md
1198
- │ │ ├── operations.md
1199
- │ │ └── contributing.md
1200
- ├── specs/
1201
- │ ├── security.md
1202
- │ └── configuration.md
1203
- │ └── templates/ # Original templates
1204
- ├── [framework files] # If initialized
1205
- ├── README.md
1206
- ├── .env.example
1207
- ├── .gitignore
1208
- └── [tool configs] # .clauderules, .cursorrules, etc.
1209
-
1210
- ````
1211
- ---
1212
- Next steps:
1213
-
1214
- 1. ⭐ **Read `.ai-flow/AGENT.md`** - Master index of all documentation
1215
- 2. 📖 **Review generated documents** - Customize as needed
1216
- 3. 🔧 **Set up environment** - Copy `.env.example` to `.env` and configure
1217
- [If NOT initialized:]
1218
- 4. 🚀 **Initialize framework** - Run: `[show command from Phase 3]`
1219
- [If initialized:]
1220
- 5. 🚀 **Install dependencies** - Run: `[show command from Phase 7]`
1221
- 6. 💾 **Initialize git** (if not done) - `git init && git add . && git commit -m "Initial commit with AI Flow docs"`
1222
- 7. 🧪 **Start building!** - Your AI assistant now has complete project context
1223
- ---
1224
- 💡 **Remember:**
1225
-
1226
- - Documents are **living artifacts** - update them as project evolves
1227
- - All AI assistants will reference these docs for future work
1228
- - AGENT.md is the **single source of truth** for AI context
1229
-
1230
- 🤖 **AI Assistant Usage:**
1231
- Your AI assistant (Claude, Cursor, Copilot, Antigravity) will now:
1232
-
1233
- - ✅ Understand complete project context
1234
- - ✅ Follow your architecture patterns
1235
- - ✅ Generate code matching your standards
1236
- - ✅ Reference your data model
1237
- - ✅ Apply your security rules
1238
- - ✅ Write tests per your guidelines
1239
-
1240
- Happy building! 🎉
1241
-
1242
- ```
1243
- ---
1244
- ## EXECUTION CHECKLIST FOR AI ASSISTANT
1245
-
1246
- When executing Phase 8:
1247
-
1248
- **8.1 Project State Detection:**
1249
-
1250
- - [ ] Scan for source directories (src/, app/, lib/, etc.)
1251
- - [ ] Check for framework files (nest-cli.json, manage.py, etc.)
1252
- - [ ] Check for package managers (package.json, requirements.txt, etc.)
1253
- - [ ] Check for existing README.md
1254
- - [ ] Classify project: New / Initialized / Existing
1255
- - [ ] Present detection results with recommendation
1256
-
1257
- **8.2 Framework Initialization (if new project):**
1258
-
1259
- - [ ] Ask user if they want to initialize framework
1260
- - [ ] If yes:
1261
- - [ ] Backup .ai-flow/ docs to temp-backup/
1262
- - [ ] Execute appropriate framework CLI command
1263
- - [ ] Restore .ai-flow/ docs from temp-backup/
1264
- - [ ] Handle README.md conflict if framework created one
1265
- - [ ] If no: Show manual command and continue
1266
- - [ ] Generate .gitignore (ALWAYS - step 8.2.7, runs for all projects)
1267
-
1268
- **8.3 Generate Final Documentation:**
1269
-
1270
- - [ ] Re-read ALL 10 previously generated documents
1271
- - [ ] Generate docs/business-flows.md (from Phase 1)
1272
- - [ ] Generate docs/api.md (from Phase 2 + Phase 3)
1273
- - [ ] Generate docs/contributing.md (from Phase 5 + Phase 7)
1274
-
1275
- **8.4 Generate AGENT.md:**
1276
-
1277
- - [ ] Re-read ALL documents again to ensure accuracy
1278
- - [ ] Create master index listing all 16 documents
1279
- - [ ] Include quick reference (tech stack, rules, commands)
1280
- - [ ] Validate all links
1281
-
1282
- **8.5 Generate README.md:**
1283
-
1284
- - [ ] Re-read ALL documents for complete context
1285
- - [ ] If framework README exists: merge intelligently
1286
- - [ ] If no framework README: create from template
1287
- - [ ] Ensure comprehensive content from all phases
1288
- - [ ] Validate all internal links
1289
-
1290
- **8.6 Create Tool-Specific Configs:**
1291
-
1292
- - [ ] Based on Phase 3 (question 3.8) AI tool selection
1293
- - [ ] Create .clauderules (if Claude)
1294
- - [ ] Create .cursorrules (if Cursor)
1295
- - [ ] Create .github/copilot-instructions.md (if Copilot)
1296
- - [ ] Create .antigravityrules (if Antigravity)
1297
- - [ ] Create all four (if "All")
1298
-
1299
- **8.7 Final Validation:**
1300
-
1301
- - [ ] Check for placeholder text in all files
1302
- - [ ] Validate file references
1303
- - [ ] Ensure all links work
1304
- - [ ] Verify template completeness
1305
- - [ ] Show complete success message with next steps
1306
-
1307
- **DO NOT:**
1308
-
1309
- - ❌ Skip project state detection
1310
- - ❌ Force framework initialization without asking
1311
- - ❌ Overwrite framework README without merging
1312
- - ❌ Generate documents without re-reading previous ones
1313
- - ❌ Leave placeholder text in final documents
1314
- - ❌ Skip tool-specific config generation
1315
- - ❌ Forget to show next steps
1316
-
1317
- **ESTIMATED TIME:**
1318
-
1319
- - 8.1: Detection - 1-2 min
1320
- - 8.2: Framework init (optional) - 2-5 min
1321
- - 8.3: Final docs - 3-5 min
1322
- - 8.4: AGENT.md - 1-2 min
1323
- - 8.5: README.md - 2-3 min
1324
- - 8.6: Tool configs - 1 min
1325
- - 8.7: Validation - 1 min
1326
- - **Total: 10-15 minutes**
1327
- ---
1328
- **FINAL STEP: Offer Phase 9 (Implementation Roadmap)**
1329
-
1330
- ```
1331
- ---
1332
- ✅ PHASE 8 COMPLETE: PROJECT READY FOR DEVELOPMENT
1333
- ---
1334
- 🎯 All documentation generated and validated!
1335
- 📁 Project initialized and ready
1336
- 📖 AGENT.md and README.md created
1337
- ⚙️ AI tool configurations in place
1338
- ---
1339
- 🗺️ Optional: Generate Implementation Roadmap?
1340
- ---
1341
- Phase 9 will analyze all your documentation and generate a complete
1342
- implementation roadmap with:
1343
-
1344
- ✅ Epics organized by domain
1345
- ✅ Features with Story Point estimations (Fibonacci scale)
1346
- ✅ Task breakdown with acceptance criteria
1347
- ✅ Dependency graph and execution order
1348
- ✅ Parallelization opportunities
1349
- ✅ Production readiness checklist
1350
- ✅ Ready-to-execute /feature commands
1351
-
1352
- ⏱️ Estimated time: 15-30 minutes
1353
-
1354
- Would you like to continue to Phase 9?
1355
-
1356
- A) ✅ Yes, generate roadmap now (recommended)
1357
- → Will analyze {{ENTITIES_COUNT}} entities, {{ENDPOINTS_COUNT}} endpoints
1358
- → Will create complete implementation plan
1359
-
1360
- B) ⏭️ Skip for now (you can run Phase 9 later)
1361
- → You can start coding with /feature command manually
1362
- → Run Phase 9 anytime: Just ask "Continue to Phase 9"
1363
-
1364
- Your choice (A/B): \_\_
1365
-
1366
- ```
1367
-
1368
- **If choice A:** Continue to Phase 9 (flow-build-phase-9.md)
1369
-
1370
- **If choice B:** Show completion message:
1371
-
1372
- ```
1373
- ---
1374
- ✅ DOCUMENTATION COMPLETE - READY TO BUILD
1375
- ---
1376
- Your project is fully documented and initialized! 🎉
1377
-
1378
- 📖 Next steps:
1379
-
1380
- 1. Review your documentation in .ai-flow/
1381
- 2. Start implementing features with /feature command
1382
- 3. Generate roadmap anytime by asking "Continue to Phase 9"
1383
-
1384
- Happy coding! 🚀
1385
- ---
1386
- ```
1387
- ---
1388
-
1389
- ## 📝 Generated Documents
1390
-
1391
- After Phase 8, generate/update:
1392
-
1393
- - `README.md` - Main project documentation
1394
- - `docs/api.md` - API reference
1395
- - `docs/contributing.md` - Contribution guidelines
1396
- - `docs/business-flows.md` - Visualized business logic
1397
-
1398
- ---
1399
-
1400
- **Next Phase:** Phase 9 - Project Roadmap (Post-Documentation)
1401
-
1402
- Read: `.ai-flow/prompts/backend/flow-build-phase-9.md`
1403
-
1404
- ---
1405
-
1406
- **Last Updated:** 2025-12-21
1407
- **Version:** 2.1.9
1
+ ## PHASE 8: Project Setup & Final Documentation (10-15 min)
2
+
3
+ > **Order for this phase:** MUST be executed after Phase 7.
4
+
5
+ > **📌 Scope-based behavior:**
6
+ > - **All Scopes:** Detect project state, initialize optional framework, and generate final documentation.
7
+
8
+ ### Objective
9
+ Initialize the project structure (if starting from scratch) and consolidate all collected information into comprehensive documentation (README, API specs, contributing guides).
10
+ ## 📋 Phase 8 Overview
11
+
12
+ This final phase will:
13
+
14
+ 1. **Detect project state** (new vs existing project)
15
+ 2. **Initialize framework** (optional, for new projects)
16
+ 3. **Generate final documentation** (business-flows, api, contributing)
17
+ 4. **Generate master index** (AGENT.md)
18
+ 5. **Generate README.md** (with intelligent merge if needed)
19
+ 6. **Create tool-specific configs** (based on AI tool selection)
20
+ ---
21
+ ## 8.1: Project State Detection
22
+
23
+ > ⚠️ **PRE-REQUISITE CHECK:** Before proceeding, verify that README.md does NOT exist yet (unless it's a framework-generated one from previous initialization). If README.md exists and was NOT generated by a framework, this indicates an error in previous phases.
24
+
25
+ // turbo
26
+ 🔍 Detecting current project state...
27
+
28
+ **⚠️ CRITICAL: Ignore AI Flow documentation and Meta files during detection:**
29
+ - Files: `project-brief.md`, `ai-instructions.md`, `AGENT.md`, `.env.example`, `.cursorrules`, `.clauderules`, `.geminirules`
30
+ - Directories: `.ai-flow/`, `.agent/`, `docs/`, `specs/`
31
+
32
+ **Auto-detect Checklist:**
33
+
34
+ - [ ] **Functional Source Code:** Check for business logic files (`.ts`, `.py`, `.go`, `.js`, etc.) in `src/`, `app/`, `internal/` or root.
35
+ - [ ] **Framework Configuration:** Check for `nest-cli.json`, `manage.py`, `go.mod`, `pom.xml`, `package.json`, etc.
36
+ - [ ] **Package Manager Lockfiles:** Check for `package-lock.json`, `pnpm-lock.yaml`, `poetry.lock`, etc.
37
+ - [ ] **Existing README.md:** Is there a README.md that was NOT created by AI Flow?
38
+
39
+ **Classification Rules (Strict Order):**
40
+
41
+ 1. **New Project** (Offer Initialization):
42
+ - root contains ONLY AI Flow docs and/or hidden folders like `.git`, `.github`, `.vscode`.
43
+ - NO `package.json`, NO `src/`, NO functional code files.
44
+ 2. **Initialized Framework** (Skip Initialization):
45
+ - Root contains framework configs (`package.json`, `go.mod`, etc.) but `src/` is empty or only contains framework boilerplate.
46
+ 3. **Existing Project** (Skip Initialization):
47
+ - Substantial functional source code already exists in the project.
48
+
49
+ **Present Detection Results:**
50
+
51
+ ```
52
+ 📊 Project State Detection:
53
+
54
+ Type: [New Project | Initialized Framework | Existing Project]
55
+
56
+ Found:
57
+ - Functional code: [list non-AI Flow source files or none]
58
+ - Framework files: [list or none]
59
+ - Package manager: [npm/pip/go/etc. or none]
60
+ - README.md: [exists: yes/no]
61
+
62
+ Recommendation: [Next action based on state]
63
+ ```
64
+ ---
65
+ ## 8.2: Framework Initialization (Optional)
66
+
67
+ **Only if:** Project state = "New Project"
68
+
69
+ ### 8.2.1: Ask User Preference
70
+
71
+ ```
72
+ 🎯 Your project appears to be new.
73
+
74
+ Would you like me to initialize the [FRAMEWORK_NAME] project structure now?
75
+
76
+ Options:
77
+ A) ✅ Yes, initialize [FRAMEWORK_NAME] (recommended)
78
+ B) ⏭️ Skip for now (manual setup later)
79
+
80
+ → Your choice:
81
+ ```
82
+
83
+ **If user chooses A (initialize):**
84
+
85
+ ### 8.2.2: Pre-initialization Backup
86
+
87
+ ```
88
+ 📦 Preparing for framework initialization...
89
+
90
+ Creating backup of AI Flow documentation:
91
+ → Moving project root docs to .ai-flow/temp-backup/
92
+
93
+ Files to backup:
94
+ ✅ project-brief.md
95
+ ✅ docs/data-model.md
96
+ ✅ docs/architecture.md
97
+ ✅ ai-instructions.md
98
+ ✅ specs/security.md
99
+ ✅ docs/code-standards.md
100
+ ✅ docs/testing.md
101
+ ✅ docs/operations.md
102
+ ✅ specs/configuration.md
103
+ ✅ .env.example
104
+
105
+ Backup complete! Safe to initialize framework.
106
+ ```
107
+
108
+ ### 8.2.3: Execute Framework CLI
109
+
110
+ **IMPORTANT:** Use Bash tool to execute the framework's official CLI command. This ensures the project gets the latest stable versions and official project structure.
111
+
112
+ **Based on framework detected in Phase 3, execute ONE of these commands:**
113
+
114
+ **NestJS:**
115
+
116
+ ```bash
117
+ npx @nestjs/cli new . --skip-git --package-manager npm
118
+ ```
119
+
120
+ **Express:**
121
+
122
+ ```bash
123
+ # Initialize package.json
124
+ npm init -y
125
+
126
+ # Install core dependencies with latest versions
127
+ npm install express cors helmet dotenv
128
+
129
+ # Install dev dependencies
130
+ npm install -D typescript @types/node @types/express ts-node nodemon
131
+
132
+ # Create src/app.ts from template (see section 8.2.6.4)
133
+ ```
134
+
135
+ **Django:**
136
+
137
+ ```bash
138
+ django-admin startproject config .
139
+ ```
140
+
141
+ **FastAPI:**
142
+
143
+ ```bash
144
+ # Install FastAPI with latest stable
145
+ pip install "fastapi[standard]" uvicorn[standard]
146
+
147
+ # Create app/main.py from template (see section 8.2.6.4)
148
+ ```
149
+
150
+ **Spring Boot:**
151
+
152
+ ```bash
153
+ spring init --dependencies=web,data-jpa --build=maven --name=[ProjectName] .
154
+ ```
155
+
156
+ **Laravel:**
157
+
158
+ ```bash
159
+ composer create-project laravel/laravel .
160
+ ```
161
+
162
+ **Go (Gin):**
163
+
164
+ ```bash
165
+ go mod init [module-name]
166
+ go get -u github.com/gin-gonic/gin
167
+ ```
168
+
169
+ **Ruby on Rails:**
170
+
171
+ ```bash
172
+ rails new . --api --skip-git --database=postgresql
173
+ ```
174
+
175
+ **.NET Core:**
176
+
177
+ ```bash
178
+ dotnet new webapi -n [ProjectName] -o .
179
+ ```
180
+
181
+ **Show progress as command executes:**
182
+
183
+ ```
184
+ 🚀 Executing: npx @nestjs/cli new . --skip-git
185
+
186
+ [Real CLI output from Bash tool]
187
+
188
+ ✅ Framework initialized successfully!
189
+ ```
190
+
191
+ **Result:** Framework CLI creates:
192
+
193
+ - ✅ package.json / requirements.txt / pom.xml (with latest versions)
194
+ - ✅ tsconfig.json / pyproject.toml (optimized configs)
195
+ - ✅ Basic src/ structure
196
+ - ✅ Test setup
197
+ - ✅ Linting/formatting configs
198
+
199
+ **Next:** Only add what framework doesn't include (see 8.2.6)
200
+
201
+ ### 8.2.4: Restore AI Flow Documentation
202
+
203
+ ```
204
+ 📥 Restoring AI Flow documentation...
205
+
206
+ Moving files from .ai-flow/temp-backup/ back to .ai-flow/
207
+
208
+ ✅ All AI Flow docs restored!
209
+ ```
210
+
211
+ ### 8.2.5: Handle README.md Conflict
212
+
213
+ **If framework created README.md:**
214
+
215
+ ```
216
+ ⚠️ Framework generated its own README.md
217
+
218
+ I'll merge it with AI Flow's comprehensive README:
219
+
220
+ Strategy:
221
+ 1. Keep framework's quick start section (if valuable)
222
+ 2. Replace with AI Flow's comprehensive content
223
+ 3. Preserve any framework-specific setup instructions
224
+
225
+ Merging...
226
+ ```
227
+
228
+ **Merge Logic:**
229
+
230
+ - Extract framework's "Getting Started" or "Installation" section (usually first 50-100 lines)
231
+ - Use AI Flow's README template as base
232
+ - Insert framework's quick start in appropriate section
233
+ - Ensure no duplication
234
+ - Keep AI Flow's structure (overview, features, tech stack, etc.)
235
+
236
+ **If user chooses B (skip):**
237
+
238
+ ```
239
+ ⏭️ Skipping framework initialization.
240
+
241
+ You can initialize manually later with:
242
+ [Show appropriate CLI command]
243
+
244
+ Proceeding to documentation generation...
245
+ ```
246
+
247
+ ### 8.2.6: Minimal Post-Init Enhancements
248
+
249
+ **IMPORTANT:** Only add what the framework CLI doesn't include. **DO NOT** create business logic, entity modules, or complete features.
250
+
251
+ ```
252
+ 📦 Adding minimal enhancements...
253
+
254
+ Framework base created by CLI ✅
255
+ Now adding only essential files that framework doesn't include...
256
+ ```
257
+
258
+ **Based on selected framework and database from previous phases:**
259
+
260
+ ### 8.2.6.1: Environment Variables Template
261
+
262
+ **Copy `.env.example` template to project root:**
263
+
264
+ ```bash
265
+ # Copy from .ai-flow/templates/.env.example.template to .env.example
266
+ ```
267
+
268
+ **Template content (adapt based on framework and database):**
269
+
270
+ ```env
271
+ # Database
272
+ DATABASE_URL="postgresql://postgres:password@localhost:5432/{{PROJECT_NAME}}_dev?schema=public"
273
+
274
+ # JWT Authentication
275
+ JWT_SECRET="your-secret-key-here-change-in-production"
276
+ JWT_EXPIRES_IN="24h"
277
+
278
+ # Application
279
+ NODE_ENV="development"
280
+ PORT=3000
281
+ API_PREFIX="/api"
282
+
283
+ # CORS
284
+ CORS_ORIGIN="http://localhost:3000"
285
+
286
+ # Redis (if using)
287
+ REDIS_HOST="localhost"
288
+ REDIS_PORT=6379
289
+
290
+ # Email (if using)
291
+ SMTP_HOST=""
292
+ SMTP_PORT=587
293
+ SMTP_USER=""
294
+ SMTP_PASS=""
295
+ ```
296
+
297
+ **User must copy to `.env` manually:**
298
+
299
+ ```
300
+ 📝 Created .env.example template
301
+ ⚠️ User must copy to .env and configure: cp .env.example .env
302
+ ```
303
+
304
+ ### 8.2.6.2: Docker Compose (Optional)
305
+
306
+ **Only if user selected Docker in Phase 7.**
307
+
308
+ **Copy appropriate docker-compose template based on database:**
309
+
310
+ **PostgreSQL:**
311
+
312
+ ```yaml
313
+ # Copy from templates/docker-compose/postgres.template.yml
314
+ version: '3.8'
315
+
316
+ services:
317
+ postgres:
318
+ image: postgres:15-alpine
319
+ restart: unless-stopped
320
+ environment:
321
+ POSTGRES_DB: ${DB_NAME:-myapp_dev}
322
+ POSTGRES_USER: ${DB_USER:-postgres}
323
+ POSTGRES_PASSWORD: ${DB_PASSWORD:-password}
324
+ ports:
325
+ - '${DB_PORT:-5432}:5432'
326
+ volumes:
327
+ - postgres_data:/var/lib/postgresql/data
328
+ healthcheck:
329
+ test: ['CMD-SHELL', 'pg_isready -U postgres']
330
+ interval: 10s
331
+ timeout: 5s
332
+ retries: 5
333
+
334
+ volumes:
335
+ postgres_data:
336
+ ```
337
+
338
+ **MySQL:**
339
+
340
+ ```yaml
341
+ # Copy from templates/docker-compose/mysql.template.yml
342
+ version: '3.8'
343
+
344
+ services:
345
+ mysql:
346
+ image: mysql:8-oracle
347
+ restart: unless-stopped
348
+ environment:
349
+ MYSQL_DATABASE: ${DB_NAME:-myapp_dev}
350
+ MYSQL_ROOT_PASSWORD: ${DB_PASSWORD:-password}
351
+ ports:
352
+ - '${DB_PORT:-3306}:3306'
353
+ volumes:
354
+ - mysql_data:/var/lib/mysql
355
+
356
+ volumes:
357
+ mysql_data:
358
+ ```
359
+
360
+ **MongoDB:**
361
+
362
+ ```yaml
363
+ # Copy from templates/docker-compose/mongodb.template.yml
364
+ version: '3.8'
365
+
366
+ services:
367
+ mongodb:
368
+ image: mongo:7
369
+ restart: unless-stopped
370
+ environment:
371
+ MONGO_INITDB_DATABASE: ${DB_NAME:-myapp_dev}
372
+ MONGO_INITDB_ROOT_USERNAME: ${DB_USER:-root}
373
+ MONGO_INITDB_ROOT_PASSWORD: ${DB_PASSWORD:-password}
374
+ ports:
375
+ - '${DB_PORT:-27017}:27017'
376
+ volumes:
377
+ - mongodb_data:/data/db
378
+
379
+ volumes:
380
+ mongodb_data:
381
+ ```
382
+
383
+ ### 8.2.6.3: ORM Setup (If Framework Doesn't Include)
384
+
385
+ **Only for frameworks that don't auto-configure ORM:**
386
+
387
+ **NestJS + Prisma:**
388
+
389
+ ```bash
390
+ npx prisma init
391
+ # Creates prisma/schema.prisma automatically with DATABASE_URL from .env
392
+ ```
393
+
394
+ **Express + Prisma:**
395
+
396
+ ```bash
397
+ npm install prisma @prisma/client
398
+ npx prisma init
399
+ ```
400
+
401
+ **FastAPI + SQLAlchemy:**
402
+
403
+ ```bash
404
+ # SQLAlchemy setup (create app/core/database.py)
405
+ # Follow FastAPI documentation: https://fastapi.tiangolo.com/tutorial/sql-databases/
406
+ ```
407
+
408
+ **Django:**
409
+
410
+ ```bash
411
+ # ORM already configured by django-admin startproject
412
+ # Just configure DATABASE settings in config/settings/base.py
413
+ ```
414
+
415
+ **Result:**
416
+
417
+ ```
418
+ ✅ ORM initialized
419
+ ✅ schema.prisma created (or equivalent)
420
+ ✅ Migrations ready to run
421
+ ```
422
+
423
+ ### 8.2.6.4: Starter Files for Express/FastAPI (Optional)
424
+
425
+ **Only if user needs a basic starting point. Otherwise, skip and let them follow official docs.**
426
+
427
+ **Express:**
428
+
429
+ - Create `src/app.ts` with basic Express setup (middleware, health endpoint)
430
+ - Reference: https://expressjs.com/en/starter/hello-world.html
431
+
432
+ **FastAPI:**
433
+
434
+ - Create `app/main.py` with basic FastAPI setup (CORS, health endpoint)
435
+ - Reference: https://fastapi.tiangolo.com/tutorial/first-steps/
436
+
437
+ **Docker Compose (if needed):**
438
+
439
+ - Reference official Docker Hub documentation:
440
+ - PostgreSQL: https://hub.docker.com/_/postgres
441
+ - MySQL: https://hub.docker.com/_/mysql
442
+ - MongoDB: https://hub.docker.com/_/mongo
443
+
444
+ ### 8.2.6.5: Summary
445
+
446
+ ```
447
+ ✅ Minimal enhancements complete!
448
+
449
+ Files created (2-3 max):
450
+ ✅ .env.example (environment template)
451
+ ✅ docker-compose.yml (if Docker selected)
452
+ ✅ prisma/schema.prisma (if Prisma ORM)
453
+
454
+ 🎯 Total: 2-3 files (vs 40-60 files in old approach)
455
+ 📚 For Express/FastAPI starter code, refer to official documentation
456
+
457
+ Next steps:
458
+ 1. Generate .gitignore (step 8.2.7 - runs for all projects)
459
+ 2. Copy .env.example to .env and configure
460
+ 3. Start database: docker-compose up -d (if applicable)
461
+ 4. Run migrations: npm run db:migrate or equivalent
462
+ 5. Start dev server: npm run start:dev or equivalent
463
+ 6. Create features with /feature command
464
+ ```
465
+
466
+ **CRITICAL RULES:**
467
+
468
+ - ❌ **DO NOT** create entity modules (User, Product, Order, etc.)
469
+ - ❌ **DO NOT** create controllers/routes for business logic
470
+ - ❌ **DO NOT** create authentication endpoints
471
+ - ❌ **DO NOT** create complete folder structures
472
+ - ❌ **DO NOT** install 40+ packages manually
473
+ - ✅ **ONLY** create .env.example, .gitignore, docker-compose (optional), ORM init
474
+ - ✅ **LET** framework CLI handle structure, configs, dependencies
475
+ - ✅ **REFER** to official docs for starter code when needed
476
+ ---
477
+ ## 8.2.7: Generate .gitignore (Always)
478
+
479
+ **IMPORTANT:** This step runs for ALL projects, regardless of framework initialization choice.
480
+
481
+ ```
482
+ 📝 Generating .gitignore for your tech stack...
483
+ ```
484
+
485
+ **Strategy:**
486
+
487
+ 1. **Detect framework from Phase 3** (NestJS, Express, Django, FastAPI, etc.)
488
+ 2. **Detect language** (Node.js, Python, Go, etc.)
489
+ 3. **Detect tools from Phase 7** (Docker, Prisma, etc.)
490
+ 4. **Combine relevant patterns**
491
+
492
+ **Base patterns by technology:**
493
+
494
+ **Node.js projects (NestJS, Express):**
495
+
496
+ ```gitignore
497
+ # Dependencies
498
+ node_modules/
499
+ npm-debug.log*
500
+ yarn-debug.log*
501
+ yarn-error.log*
502
+ .pnpm-debug.log*
503
+
504
+ # Build outputs
505
+ dist/
506
+ build/
507
+ *.tsbuildinfo
508
+
509
+ # Environment variables
510
+ .env
511
+ .env.local
512
+ .env.*.local
513
+
514
+ # IDE
515
+ .vscode/
516
+ .idea/
517
+ *.swp
518
+ *.swo
519
+ *~
520
+
521
+ # OS
522
+ .DS_Store
523
+ Thumbs.db
524
+
525
+ # Testing
526
+ coverage/
527
+ .nyc_output/
528
+
529
+ # Logs
530
+ logs/
531
+ *.log
532
+
533
+ # Prisma (if using)
534
+ prisma/migrations/dev.db
535
+ prisma/*.db
536
+
537
+ # TypeScript
538
+ *.tsbuildinfo
539
+ ```
540
+
541
+ **Python projects (Django, FastAPI):**
542
+
543
+ ```gitignore
544
+ # Python
545
+ __pycache__/
546
+ *.py[cod]
547
+ *$py.class
548
+ *.so
549
+ .Python
550
+
551
+ # Virtual environments
552
+ venv/
553
+ env/
554
+ ENV/
555
+ .venv
556
+
557
+ # Django
558
+ *.log
559
+ db.sqlite3
560
+ db.sqlite3-journal
561
+ media/
562
+ staticfiles/
563
+
564
+ # FastAPI
565
+ .pytest_cache/
566
+
567
+ # Environment
568
+ .env
569
+ .env.local
570
+
571
+ # IDE
572
+ .vscode/
573
+ .idea/
574
+ *.swp
575
+
576
+ # OS
577
+ .DS_Store
578
+ ```
579
+
580
+ **Go projects:**
581
+
582
+ ```gitignore
583
+ # Binaries
584
+ *.exe
585
+ *.exe~
586
+ *.dll
587
+ *.so
588
+ *.dylib
589
+ bin/
590
+
591
+ # Test binary
592
+ *.test
593
+
594
+ # Output
595
+ *.out
596
+
597
+ # Go workspace
598
+ go.work
599
+
600
+ # Environment
601
+ .env
602
+
603
+ # IDE
604
+ .vscode/
605
+ .idea/
606
+ ```
607
+
608
+ **Docker additions (if Docker selected in Phase 7):**
609
+
610
+ ```gitignore
611
+ # Docker
612
+ docker-compose.override.yml
613
+ .docker/
614
+ ```
615
+
616
+ **📝 Action:** Generate and write `.gitignore` to project root.
617
+
618
+ **Selection logic:**
619
+
620
+ - If NestJS/Express → Use Node.js patterns
621
+ - If Django/FastAPI → Use Python patterns
622
+ - If Go/Gin → Use Go patterns
623
+ - If Prisma detected in Phase 3 → Add Prisma patterns
624
+ - If Docker selected in Phase 7 → Add Docker patterns
625
+
626
+ ```
627
+ ✅ Generated: .gitignore
628
+ Patterns included: [Node.js | Python | Go] + [Prisma] + [Docker]
629
+ ```
630
+ ---
631
+ ## 8.3: Generate Final Documentation
632
+
633
+ ```
634
+ 📖 Re-reading all generated documents to ensure accuracy...
635
+
636
+ ✅ Re-reading project-brief.md
637
+ ✅ Re-reading docs/data-model.md
638
+ ✅ Re-reading docs/architecture.md
639
+ ✅ Re-reading ai-instructions.md
640
+ ✅ Re-reading specs/security.md
641
+ ✅ Re-reading docs/code-standards.md
642
+ ✅ Re-reading docs/testing.md
643
+ ✅ Re-reading docs/operations.md
644
+ ✅ Re-reading specs/configuration.md
645
+ ✅ Re-reading .env.example
646
+
647
+ ✅ Context fully loaded and updated!
648
+
649
+ 🎉 Now generating final 5 documents:
650
+
651
+ 1. docs/business-flows.md - Business process flows and mermaid diagrams
652
+ 2. docs/api.md - API endpoints and conventions reference
653
+ 3. docs/contributing.md - Contribution guidelines
654
+ 4. README.md - Project overview (consolidates all phases)
655
+ 5. AGENT.md - Universal AI configuration (master index)
656
+
657
+ Generating...
658
+ ```
659
+
660
+ ### 8.3.1: Generate docs/business-flows.md
661
+
662
+ - **Template:** `.ai-flow/templates/docs/business-flows.template.md`
663
+ - **Content from:** Phase 1 (questions 1.3, 1.4, 1.5)
664
+ - **Requirements:**
665
+ - List all business flows from Phase 1
666
+ - Generate mermaid sequence/flow diagram for EACH flow
667
+ - Include actors, steps, decision points
668
+ - Add error handling scenarios
669
+ - Link to relevant entities from data-model.md
670
+
671
+ **Example format:**
672
+
673
+ ```markdown
674
+ ## User Registration Flow
675
+
676
+ **Actors:** User, System, Email Service
677
+
678
+ **Steps:**
679
+
680
+ 1. User submits registration form
681
+ 2. System validates input
682
+ 3. System creates user account
683
+ 4. System sends verification email
684
+ 5. User clicks verification link
685
+ 6. System activates account
686
+
687
+ **Mermaid Diagram:**
688
+
689
+ [Generate mermaid sequence diagram]
690
+ ```
691
+
692
+ **📝 Action:** Write the complete file to `docs/business-flows.md`
693
+
694
+ ```
695
+ ✅ Generated: docs/business-flows.md
696
+ ```
697
+ ---
698
+ ### 8.3.2: Generate docs/api.md
699
+
700
+ - **Template:** `.ai-flow/templates/docs/api.template.md`
701
+ - **Content from:** Phase 2 (entities) + Phase 3 (question 3.5 - API conventions)
702
+ - **Requirements:**
703
+ - Auto-generate CRUD endpoints for each entity from data-model.md
704
+ - Apply REST/GraphQL conventions from Phase 3
705
+ - Include authentication requirements
706
+ - Document pagination format
707
+ - Document error response format
708
+ - Include example requests/responses
709
+
710
+ **Example format:**
711
+
712
+ ````markdown
713
+ ## Users API
714
+
715
+ ### List Users
716
+
717
+ `GET /api/users`
718
+
719
+ **Authentication:** Required (Bearer token)
720
+
721
+ **Query Parameters:**
722
+
723
+ - `page` (number): Page number (default: 1)
724
+ - `limit` (number): Items per page (default: 20)
725
+ - `sort` (string): Sort field (default: createdAt)
726
+
727
+ **Response:**
728
+
729
+ ```json
730
+ {
731
+ "data": [...],
732
+ "meta": {
733
+ "page": 1,
734
+ "limit": 20,
735
+ "total": 150
736
+ }
737
+ }
738
+ ```
739
+ ````
740
+
741
+ ````
742
+
743
+ ### 8.3.3: Generate docs/contributing.md
744
+
745
+ - **Template:** `.ai-flow/templates/docs/contributing.template.md`
746
+ - **Content from:** Phase 5 (questions 5.1-5.5) + Phase 7 (setup)
747
+ - **Requirements:**
748
+ - Git workflow from Phase 5
749
+ - Commit message format from Phase 5
750
+ - Code review process from Phase 5
751
+ - Setup instructions from Phase 3 & 7
752
+ - Testing requirements from Phase 6
753
+
754
+ **Example format:**
755
+
756
+ ```markdown
757
+ ## Getting Started
758
+
759
+ 1. Clone repository
760
+ 2. Install dependencies: `[command from Phase 7]`
761
+ 3. Copy `.env.example` to `.env`
762
+ 4. Run migrations: `[command from Phase 7]`
763
+ 5. Start dev server: `[command from Phase 7]`
764
+
765
+ ## Git Workflow
766
+
767
+ We use [workflow from Phase 5]
768
+
769
+ ## Commit Format
770
+
771
+ [Format from Phase 5.2]
772
+ ````
773
+
774
+ **📝 Action:** Write the complete file to `docs/contributing.md`
775
+
776
+ ```
777
+ ✅ Generated: docs/contributing.md
778
+ ```
779
+ ---
780
+ ## 8.4: Generate AGENT.md (Master Index)
781
+
782
+ - **Template:** `.ai-flow/templates/AGENT.template.md`
783
+ - **Content from:** ALL phases (this is the aggregator)
784
+ - **Requirements:**
785
+ - **CRITICAL:** Re-read ALL 10 previously generated documents before filling
786
+ - List all 15 documents with descriptions
787
+ - Provide quick reference to tech stack
788
+ - Include critical architecture rules
789
+ - Link to all specs and docs
790
+ - Summarize key decisions from each phase
791
+ - Include common commands
792
+
793
+ **Structure:**
794
+
795
+ ```markdown
796
+ # 🤖 AGENT.md - Universal AI Assistant Configuration
797
+
798
+ ## 📚 Documentation Index
799
+
800
+ ### Core Documents
801
+
802
+ 1. **project-brief.md** - [1-sentence description]
803
+ 2. **ai-instructions.md** - [1-sentence description]
804
+
805
+ ### Specifications
806
+
807
+ 3. **specs/security.md** - [1-sentence description]
808
+ 4. **specs/configuration.md** - [1-sentence description]
809
+
810
+ ### Documentation
811
+
812
+ 5. **docs/data-model.md** - [1-sentence description]
813
+ 6. **docs/architecture.md** - [1-sentence description]
814
+ 7. **docs/business-flows.md** - [1-sentence description]
815
+ 8. **docs/api.md** - [1-sentence description]
816
+ 9. **docs/code-standards.md** - [1-sentence description]
817
+ 10. **docs/testing.md** - [1-sentence description]
818
+ 11. **docs/operations.md** - [1-sentence description]
819
+ 12. **docs/contributing.md** - [1-sentence description]
820
+
821
+ ### Quick Start
822
+
823
+ 13. **.env.example** - Environment variables template
824
+ 14. **README.md** - Project overview and setup
825
+
826
+ ## 🎯 Quick Reference
827
+
828
+ ### Tech Stack
829
+
830
+ [List from Phase 3]
831
+
832
+ ### Critical Rules
833
+
834
+ [Key rules from code-standards.md and ai-instructions.md]
835
+
836
+ ### Common Commands
837
+
838
+ [From operations.md and contributing.md]
839
+ ```
840
+ ---
841
+ ## 8.5: Generate README.md (Intelligent Merge)
842
+
843
+ - **Template:** `.ai-flow/templates/README.template.md`
844
+ - **Content from:** ALL phases (most comprehensive document)
845
+ - **Requirements:**
846
+ - **CRITICAL:** Re-read ALL documents before generating
847
+ - Include project overview from Phase 1
848
+ - List features from Phase 1
849
+ - Show tech stack from Phase 3
850
+ - Include quick start from Phase 7
851
+ - Link to all documentation
852
+ - Include deployment info from Phase 7
853
+ - Add badges, license, contact info
854
+
855
+ **Merge Strategy (if framework README exists):**
856
+
857
+ 1. **Read framework's README.md** (if exists from step 8.2)
858
+ 2. **Extract valuable sections:**
859
+ - Installation commands specific to framework
860
+ - Framework-specific setup instructions
861
+ - Any auto-generated content that's useful
862
+ 3. **Use AI Flow template as base structure:**
863
+ - Project name and description (from Phase 1)
864
+ - Features (from Phase 1)
865
+ - Tech stack (from Phase 3)
866
+ - Architecture overview (link to docs/architecture.md)
867
+ - Getting started (merge with framework's instructions)
868
+ - API documentation (link to docs/api.md)
869
+ - Testing (link to docs/testing.md)
870
+ - Deployment (from Phase 7)
871
+ - Contributing (link to docs/contributing.md)
872
+ - License
873
+ 4. **Insert framework-specific content** in "Getting Started" section
874
+ 5. **Ensure no duplication** between sections
875
+ 6. **Validate all links** work correctly
876
+
877
+ **Example merged section:**
878
+
879
+ ````markdown
880
+ ## 🚀 Getting Started
881
+
882
+ ### Prerequisites
883
+
884
+ - Node.js 18+ (from Phase 3)
885
+ - PostgreSQL 14+ (from Phase 3)
886
+ - Redis 6+ (from Phase 3)
887
+
888
+ ### Installation
889
+
890
+ 1. Clone the repository:
891
+
892
+ ```bash
893
+ git clone [repo-url]
894
+ cd [project-name]
895
+ ```
896
+ ````
897
+
898
+ 2. Install dependencies:
899
+
900
+ ```bash
901
+ npm install # From framework
902
+ ```
903
+
904
+ 3. Set up environment variables:
905
+
906
+ ```bash
907
+ cp .env.example .env
908
+ # Edit .env with your configuration (see specs/configuration.md)
909
+ ```
910
+
911
+ 4. Run database migrations:
912
+
913
+ ```bash
914
+ npm run migration:run # From Phase 7
915
+ ```
916
+
917
+ 5. Start development server:
918
+
919
+ ```bash
920
+ npm run start:dev # From framework
921
+ ```
922
+
923
+ The API will be available at `http://localhost:3000`
924
+
925
+ ````
926
+
927
+ **📝 Action:** Write the complete file to `README.md` (project root)
928
+
929
+ ```
930
+ ✅ Generated: README.md
931
+ [If merged] Merged with framework's setup instructions
932
+ ```
933
+ ---
934
+ ## 8.6: Generate AGENT.md (Master Index)
935
+
936
+ **CRITICAL:** Before generating AGENT.md, re-read ALL previously generated documents to have complete context.
937
+
938
+ **📝 Action:**
939
+
940
+ ```
941
+ 🔄 Re-reading all generated documents for AGENT.md generation...
942
+
943
+ ✅ Reading project-brief.md
944
+ ✅ Reading ai-instructions.md
945
+ ✅ Reading docs/data-model.md
946
+ ✅ Reading docs/architecture.md
947
+ ✅ Reading docs/code-standards.md
948
+ ✅ Reading docs/testing.md
949
+ ✅ Reading docs/operations.md
950
+ ✅ Reading specs/security.md
951
+ ✅ Reading specs/configuration.md
952
+ ✅ Reading docs/business-flows.md
953
+ ✅ Reading docs/api.md
954
+ ✅ Reading docs/contributing.md
955
+
956
+ ✅ All context loaded!
957
+ ```
958
+
959
+ Now generate AGENT.md with complete information from all documents.
960
+
961
+ **📝 Action:** Write the complete file to `.ai-flow/AGENT.md`
962
+
963
+ ```
964
+ ✅ Generated: .ai-flow/AGENT.md (Master Index)
965
+ ```
966
+ ---
967
+ ## 8.7: Create Tool-Specific Configs
968
+
969
+ **Based on AI tool selection from Phase 3 (question 3.8):**
970
+
971
+ ### If Claude selected:
972
+
973
+ **Create `.clauderules`:**
974
+
975
+ ```markdown
976
+ # Claude AI Configuration
977
+
978
+ This project uses AI Flow documentation structure.
979
+
980
+ ## Primary Reference
981
+
982
+ Read `.ai-flow/AGENT.md` first for complete documentation index.
983
+
984
+ ## Key Documents
985
+
986
+ - Project overview: `.ai-flow/project-brief.md`
987
+ - AI instructions: `.ai-flow/ai-instructions.md`
988
+ - Architecture: `docs/architecture.md`
989
+ - API reference: `docs/api.md`
990
+ - Code standards: `docs/code-standards.md`
991
+
992
+ ## Working Instructions
993
+
994
+ When writing code:
995
+
996
+ 1. Follow patterns in `docs/code-standards.md`
997
+ 2. Reference data model in `docs/data-model.md`
998
+ 3. Implement security rules from `specs/security.md`
999
+ 4. Write tests per `docs/testing.md`
1000
+
1001
+ ## Critical Rules
1002
+
1003
+ [Extract top 5-10 rules from ai-instructions.md]
1004
+ ```
1005
+
1006
+ ### If Cursor selected:
1007
+
1008
+ **Create `.cursorrules`:**
1009
+
1010
+ ```markdown
1011
+ # Cursor AI Configuration
1012
+
1013
+ Project uses AI Flow documentation in `.ai-flow/` directory.
1014
+
1015
+ ## Documentation Index
1016
+
1017
+ See `.ai-flow/AGENT.md` for complete document list.
1018
+
1019
+ ## Quick Reference
1020
+
1021
+ - Tech Stack: [from Phase 3]
1022
+ - Architecture: `docs/architecture.md`
1023
+ - Code Standards: `docs/code-standards.md`
1024
+ - API Conventions: `docs/api.md`
1025
+
1026
+ ## Code Generation Rules
1027
+
1028
+ [Extract key rules from ai-instructions.md]
1029
+
1030
+ ## Testing Requirements
1031
+
1032
+ [Extract from docs/testing.md]
1033
+ ```
1034
+
1035
+ ### If GitHub Copilot selected:
1036
+
1037
+ **Create `.github/copilot-instructions.md`:**
1038
+
1039
+ ```markdown
1040
+ # GitHub Copilot Instructions
1041
+
1042
+ ## Project Context
1043
+
1044
+ [Project description from Phase 1]
1045
+
1046
+ ## Documentation Structure
1047
+
1048
+ This project uses AI Flow. All documentation is in `.ai-flow/` directory.
1049
+
1050
+ Master index: `.ai-flow/AGENT.md`
1051
+
1052
+ ## Key References
1053
+
1054
+ - Architecture: `docs/architecture.md`
1055
+ - Data Model: `docs/data-model.md`
1056
+ - API: `docs/api.md`
1057
+ - Code Standards: `docs/code-standards.md`
1058
+ - Testing: `docs/testing.md`
1059
+
1060
+ ## Code Generation Guidelines
1061
+
1062
+ [Extract guidelines from ai-instructions.md and code-standards.md]
1063
+
1064
+ ## Tech Stack
1065
+
1066
+ [From Phase 3]
1067
+
1068
+ ## Common Patterns
1069
+
1070
+ [Extract from code-standards.md]
1071
+ ```
1072
+
1073
+ ### If Antigravity selected:
1074
+
1075
+ **Create `.antigravityrules`:**
1076
+
1077
+ ```markdown
1078
+ # Antigravity AI Configuration
1079
+
1080
+ Project uses AI Flow documentation in `.ai-flow/` directory.
1081
+
1082
+ ## Documentation Index
1083
+
1084
+ See `.ai-flow/AGENT.md` for complete document list.
1085
+
1086
+ ## Quick Reference
1087
+
1088
+ - Tech Stack: [from Phase 3]
1089
+ - Architecture: `docs/architecture.md`
1090
+ - Code Standards: `docs/code-standards.md`
1091
+ - API Conventions: `docs/api.md`
1092
+
1093
+ ## Workflow Commands
1094
+
1095
+ - `/flow-build` - Generate documentation
1096
+ - `/flow-dev-feature` - Create new features
1097
+ - `/flow-dev-fix` - Fix bugs
1098
+ - `/flow-dev-commit` - Automate commits
1099
+
1100
+ ## Code Generation Rules
1101
+
1102
+ [Extract key rules from ai-instructions.md]
1103
+
1104
+ ## Testing Requirements
1105
+
1106
+ [Extract from docs/testing.md]
1107
+ ```
1108
+
1109
+ **📝 Action:** Generate the tool-specific config files based on selection:
1110
+
1111
+ - If Claude → Write `.clauderules`
1112
+ - If Cursor → Write `.cursorrules`
1113
+ - If Copilot → Write `.github/copilot-instructions.md`
1114
+ - If Antigravity → Write `.antigravityrules`
1115
+ - If "All" → Write all four files
1116
+
1117
+ ```
1118
+ ✅ Generated tool-specific configs:
1119
+ [List generated files based on selection]
1120
+ ```
1121
+ ---
1122
+ ## 8.8: Final Validation & Success Message
1123
+
1124
+ ```
1125
+ 🔍 Validating all generated files...
1126
+
1127
+ ✅ Checking for placeholder text...
1128
+ ✅ Validating file references...
1129
+ ✅ Ensuring all links work...
1130
+ ✅ Verifying template completeness...
1131
+
1132
+ All validations passed!
1133
+ ```
1134
+
1135
+ **Show complete summary:**
1136
+
1137
+ ```
1138
+ 🎉 AI Flow Complete!
1139
+
1140
+ Generated 16 documents successfully:
1141
+
1142
+ Phase 1:
1143
+ ✅ project-brief.md
1144
+
1145
+ Phase 2:
1146
+ ✅ docs/data-model.md
1147
+
1148
+ Phase 3:
1149
+ ✅ docs/architecture.md
1150
+ ✅ ai-instructions.md
1151
+
1152
+ Phase 4:
1153
+ ✅ specs/security.md
1154
+
1155
+ Phase 5:
1156
+ ✅ docs/code-standards.md
1157
+
1158
+ Phase 6:
1159
+ ✅ docs/testing.md
1160
+
1161
+ Phase 7:
1162
+ ✅ docs/operations.md
1163
+ ✅ specs/configuration.md
1164
+ ✅ .env.example
1165
+
1166
+ Phase 8:
1167
+ ✅ docs/business-flows.md
1168
+ ✅ docs/api.md
1169
+ ✅ docs/contributing.md
1170
+ ✅ README.md
1171
+ ✅ AGENT.md
1172
+ ✅ .gitignore
1173
+
1174
+ [If framework initialized:]
1175
+ ✅ [FRAMEWORK_NAME] project initialized
1176
+
1177
+ [If README merged:]
1178
+ ✅ README.md merged with framework's setup instructions
1179
+
1180
+ Tool-specific configs:
1181
+ ✅ [List generated configs: .clauderules, .cursorrules, .github/copilot-instructions.md, .antigravityrules]
1182
+ ---
1183
+ 📁 Project Structure:
1184
+ ```
1185
+
1186
+ your-project/
1187
+ ├── .ai-flow/ # AI Flow documentation
1188
+ │ ├── project-brief.md
1189
+ │ ├── AGENT.md ⭐ Start here!
1190
+ │ ├── ai-instructions.md
1191
+ │ ├── docs/
1192
+ │ │ ├── data-model.md
1193
+ │ │ ├── architecture.md
1194
+ │ │ ├── business-flows.md
1195
+ │ │ ├── api.md
1196
+ │ │ ├── code-standards.md
1197
+ │ │ ├── testing.md
1198
+ │ │ ├── operations.md
1199
+ │ │ └── contributing.md
1200
+ ├── specs/
1201
+ │ ├── security.md
1202
+ │ └── configuration.md
1203
+ │ └── templates/ # Original templates
1204
+ ├── [framework files] # If initialized
1205
+ ├── README.md
1206
+ ├── .env.example
1207
+ ├── .gitignore
1208
+ └── [tool configs] # .clauderules, .cursorrules, etc.
1209
+
1210
+ ````
1211
+ ---
1212
+ Next steps:
1213
+
1214
+ 1. ⭐ **Read `.ai-flow/AGENT.md`** - Master index of all documentation
1215
+ 2. 📖 **Review generated documents** - Customize as needed
1216
+ 3. 🔧 **Set up environment** - Copy `.env.example` to `.env` and configure
1217
+ [If NOT initialized:]
1218
+ 4. 🚀 **Initialize framework** - Run: `[show command from Phase 3]`
1219
+ [If initialized:]
1220
+ 5. 🚀 **Install dependencies** - Run: `[show command from Phase 7]`
1221
+ 6. 💾 **Initialize git** (if not done) - `git init && git add . && git commit -m "Initial commit with AI Flow docs"`
1222
+ 7. 🧪 **Start building!** - Your AI assistant now has complete project context
1223
+ ---
1224
+ 💡 **Remember:**
1225
+
1226
+ - Documents are **living artifacts** - update them as project evolves
1227
+ - All AI assistants will reference these docs for future work
1228
+ - AGENT.md is the **single source of truth** for AI context
1229
+
1230
+ 🤖 **AI Assistant Usage:**
1231
+ Your AI assistant (Claude, Cursor, Copilot, Antigravity) will now:
1232
+
1233
+ - ✅ Understand complete project context
1234
+ - ✅ Follow your architecture patterns
1235
+ - ✅ Generate code matching your standards
1236
+ - ✅ Reference your data model
1237
+ - ✅ Apply your security rules
1238
+ - ✅ Write tests per your guidelines
1239
+
1240
+ Happy building! 🎉
1241
+
1242
+ ```
1243
+ ---
1244
+ ## EXECUTION CHECKLIST FOR AI ASSISTANT
1245
+
1246
+ When executing Phase 8:
1247
+
1248
+ **8.1 Project State Detection:**
1249
+
1250
+ - [ ] Scan for source directories (src/, app/, lib/, etc.)
1251
+ - [ ] Check for framework files (nest-cli.json, manage.py, etc.)
1252
+ - [ ] Check for package managers (package.json, requirements.txt, etc.)
1253
+ - [ ] Check for existing README.md
1254
+ - [ ] Classify project: New / Initialized / Existing
1255
+ - [ ] Present detection results with recommendation
1256
+
1257
+ **8.2 Framework Initialization (if new project):**
1258
+
1259
+ - [ ] Ask user if they want to initialize framework
1260
+ - [ ] If yes:
1261
+ - [ ] Backup .ai-flow/ docs to temp-backup/
1262
+ - [ ] Execute appropriate framework CLI command
1263
+ - [ ] Restore .ai-flow/ docs from temp-backup/
1264
+ - [ ] Handle README.md conflict if framework created one
1265
+ - [ ] If no: Show manual command and continue
1266
+ - [ ] Generate .gitignore (ALWAYS - step 8.2.7, runs for all projects)
1267
+
1268
+ **8.3 Generate Final Documentation:**
1269
+
1270
+ - [ ] Re-read ALL 10 previously generated documents
1271
+ - [ ] Generate docs/business-flows.md (from Phase 1)
1272
+ - [ ] Generate docs/api.md (from Phase 2 + Phase 3)
1273
+ - [ ] Generate docs/contributing.md (from Phase 5 + Phase 7)
1274
+
1275
+ **8.4 Generate AGENT.md:**
1276
+
1277
+ - [ ] Re-read ALL documents again to ensure accuracy
1278
+ - [ ] Create master index listing all 16 documents
1279
+ - [ ] Include quick reference (tech stack, rules, commands)
1280
+ - [ ] Validate all links
1281
+
1282
+ **8.5 Generate README.md:**
1283
+
1284
+ - [ ] Re-read ALL documents for complete context
1285
+ - [ ] If framework README exists: merge intelligently
1286
+ - [ ] If no framework README: create from template
1287
+ - [ ] Ensure comprehensive content from all phases
1288
+ - [ ] Validate all internal links
1289
+
1290
+ **8.6 Create Tool-Specific Configs:**
1291
+
1292
+ - [ ] Based on Phase 3 (question 3.8) AI tool selection
1293
+ - [ ] Create .clauderules (if Claude)
1294
+ - [ ] Create .cursorrules (if Cursor)
1295
+ - [ ] Create .github/copilot-instructions.md (if Copilot)
1296
+ - [ ] Create .antigravityrules (if Antigravity)
1297
+ - [ ] Create all four (if "All")
1298
+
1299
+ **8.7 Final Validation:**
1300
+
1301
+ - [ ] Check for placeholder text in all files
1302
+ - [ ] Validate file references
1303
+ - [ ] Ensure all links work
1304
+ - [ ] Verify template completeness
1305
+ - [ ] Show complete success message with next steps
1306
+
1307
+ **DO NOT:**
1308
+
1309
+ - ❌ Skip project state detection
1310
+ - ❌ Force framework initialization without asking
1311
+ - ❌ Overwrite framework README without merging
1312
+ - ❌ Generate documents without re-reading previous ones
1313
+ - ❌ Leave placeholder text in final documents
1314
+ - ❌ Skip tool-specific config generation
1315
+ - ❌ Forget to show next steps
1316
+
1317
+ **ESTIMATED TIME:**
1318
+
1319
+ - 8.1: Detection - 1-2 min
1320
+ - 8.2: Framework init (optional) - 2-5 min
1321
+ - 8.3: Final docs - 3-5 min
1322
+ - 8.4: AGENT.md - 1-2 min
1323
+ - 8.5: README.md - 2-3 min
1324
+ - 8.6: Tool configs - 1 min
1325
+ - 8.7: Validation - 1 min
1326
+ - **Total: 10-15 minutes**
1327
+ ---
1328
+ **FINAL STEP: Offer Phase 9 (Implementation Roadmap)**
1329
+
1330
+ ```
1331
+ ---
1332
+ ✅ PHASE 8 COMPLETE: PROJECT READY FOR DEVELOPMENT
1333
+ ---
1334
+ 🎯 All documentation generated and validated!
1335
+ 📁 Project initialized and ready
1336
+ 📖 AGENT.md and README.md created
1337
+ ⚙️ AI tool configurations in place
1338
+ ---
1339
+ 🗺️ Optional: Generate Implementation Roadmap?
1340
+ ---
1341
+ Phase 9 will analyze all your documentation and generate a complete
1342
+ implementation roadmap with:
1343
+
1344
+ ✅ Epics organized by domain
1345
+ ✅ Features with Story Point estimations (Fibonacci scale)
1346
+ ✅ Task breakdown with acceptance criteria
1347
+ ✅ Dependency graph and execution order
1348
+ ✅ Parallelization opportunities
1349
+ ✅ Production readiness checklist
1350
+ ✅ Ready-to-execute /feature commands
1351
+
1352
+ ⏱️ Estimated time: 15-30 minutes
1353
+
1354
+ Would you like to continue to Phase 9?
1355
+
1356
+ A) ✅ Yes, generate roadmap now (recommended)
1357
+ → Will analyze {{ENTITIES_COUNT}} entities, {{ENDPOINTS_COUNT}} endpoints
1358
+ → Will create complete implementation plan
1359
+
1360
+ B) ⏭️ Skip for now (you can run Phase 9 later)
1361
+ → You can start coding with /feature command manually
1362
+ → Run Phase 9 anytime: Just ask "Continue to Phase 9"
1363
+
1364
+ Your choice (A/B): \_\_
1365
+
1366
+ ```
1367
+
1368
+ **If choice A:** Continue to Phase 9 (flow-build-phase-9.md)
1369
+
1370
+ **If choice B:** Show completion message:
1371
+
1372
+ ```
1373
+ ---
1374
+ ✅ DOCUMENTATION COMPLETE - READY TO BUILD
1375
+ ---
1376
+ Your project is fully documented and initialized! 🎉
1377
+
1378
+ 📖 Next steps:
1379
+
1380
+ 1. Review your documentation in .ai-flow/
1381
+ 2. Start implementing features with /feature command
1382
+ 3. Generate roadmap anytime by asking "Continue to Phase 9"
1383
+
1384
+ Happy coding! 🚀
1385
+ ---
1386
+ ```
1387
+ ---
1388
+
1389
+ ## 📝 Generated Documents
1390
+
1391
+ After Phase 8, generate/update:
1392
+
1393
+ - `README.md` - Main project documentation
1394
+ - `docs/api.md` - API reference
1395
+ - `docs/contributing.md` - Contribution guidelines
1396
+ - `docs/business-flows.md` - Visualized business logic
1397
+
1398
+ ---
1399
+
1400
+ **Next Phase:** Phase 9 - Project Roadmap (Post-Documentation)
1401
+
1402
+ Read: `.ai-flow/prompts/backend/flow-build-phase-9.md`
1403
+
1404
+ ---
1405
+
1406
+ **Last Updated:** 2025-12-21
1407
+ **Version:** 2.1.9