ai-flow-dev 2.7.0 → 2.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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 +717 -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 +717 -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 +919 -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 +717 -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 +919 -0
  70. package/prompts/frontend/flow-release.md +519 -0
  71. package/prompts/frontend/flow-work-api.md +1547 -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 +1595 -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 +717 -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 +919 -0
  95. package/prompts/mobile/flow-release.md +751 -0
  96. package/prompts/mobile/flow-work-api.md +1500 -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 +1605 -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 +61 -47
@@ -1,626 +1,626 @@
1
- ## PHASE 1: Discovery & Business (15-20 min)
2
-
3
- > **Order for this phase:** 1.1 → 1.2 → 1.3 → 1.4 → 1.5 → 1.6 → 1.7 → 1.8 → 1.9 → 1.10
4
-
5
- > **📌 Scope-based behavior:**
6
- > - **MVP/Basic Scope:** Focus only on core requirements. Skip advanced business logic questions.
7
- > - **Production-Ready Scope:** In-depth exploration of compliance, scalability, and long-term business goals.
8
-
9
- ### Objective
10
- Define the project's core purpose, business rules, and high-level requirements to ensure the foundation is solid before technical design begins.
11
-
12
- ---
13
-
14
- ## 🔍 Pre-Flight Check (Smart Skip Logic)
15
-
16
- > 📎 **Reference:** See [prompts/shared/smart-skip-preflight.md](../../.ai-flow/prompts/shared/smart-skip-preflight.md) for the complete smart skip logic.
17
-
18
- **Execute Pre-Flight Check for Phase 1:**
19
-
20
- - **Target File**: `project-brief.md`
21
- - **Phase Name**: "BUSINESS CONTEXT"
22
- - **Key Items**: Project name, description, users, objectives, system type, features, scope, constraints, metrics, business flows
23
- - **Typical Gaps**: Business objectives, success metrics, constraints
24
-
25
- **Proceed with appropriate scenario based on audit data from `.ai-flow/cache/audit-data.json`**
26
-
27
- ---
28
-
29
- ## Phase 1 Questions (Full Mode)
30
-
31
- > **📌 Note:** If Phase 0 was executed, some questions may already be answered. Skip those and only ask what's missing.
32
-
33
- **1.1 Project Name & Description (with Smart Refinement)**
34
-
35
- > **🧠 Intelligent Refinement System**: This question detects vague descriptions and guides the developer to enrich them. It only asks what's missing and responds in the developer's language.
36
-
37
- ```
38
- [If detected from Phase 0, show:]
39
- ✅ Project Name: [detected name]
40
- ✅ Description: [detected description]
41
-
42
- Is this correct? (Y/N)
43
- If no, please provide correct values.
44
-
45
- [If NOT detected, ask:]
46
- What is the project name?
47
-
48
- Provide an initial description of your project.
49
- (Don't worry about perfection - we'll refine it together if needed!)
50
-
51
- Example: "A backend for managing gym memberships"
52
- ```
53
-
54
- **🔍 AI Internal: Ambiguity Analysis**
55
-
56
- After receiving the description, silently analyze for these criteria:
57
-
58
- | Criterion | Check For | Score +1 if present |
59
- |-----------|-----------|---------------------|
60
- | **WHO** | Specific user type mentioned (not just "users") | "gym members", "restaurant owners" |
61
- | **WHAT** | Specific action/function (not just "manage") | "track workouts", "process payments" |
62
- | **WHY** | Purpose or value mentioned | "to replace spreadsheets", "to launch app" |
63
- | **DOMAIN** | Industry/vertical indicated | "fitness", "fintech", "healthcare" |
64
- | **DETAIL** | Description has 10+ meaningful words | Not counting articles |
65
-
66
- **Scoring Rules:**
67
- - Score 4-5: ✅ Accept immediately → Proceed to 1.2
68
- - Score 0-3: ⚠️ Enter refinement loop → Ask ONLY missing criteria
69
-
70
- ---
71
-
72
- **🔄 Conditional Refinement Loop (only if score < 4)**
73
-
74
- > **CRITICAL**: Only ask about criteria that are MISSING. Do NOT repeat questions already answered. Respond in the SAME LANGUAGE the developer used.
75
-
76
- ```
77
- [LANGUAGE: Match the developer's language]
78
-
79
- 🔍 I'd like to understand your project better.
80
-
81
- Your description: "[original description]"
82
-
83
- [ONLY show questions for MISSING criteria:]
84
-
85
- [If WHO is missing:]
86
- 1️⃣ WHO will use this system?
87
- A) End consumers (B2C)
88
- B) Business users (B2B)
89
- C) Internal team
90
- D) Other systems (APIs)
91
- E) Other: __
92
-
93
- [If WHAT is missing:]
94
- 2️⃣ WHAT is the core action users will perform?
95
- A) Buy/sell products or services
96
- B) Manage/organize information
97
- C) Communicate/collaborate
98
- D) Monitor/analyze data
99
- E) Create/publish content
100
- F) Other: __
101
-
102
- [If WHY is missing:]
103
- 3️⃣ WHY is this project needed?
104
- A) Replace manual/legacy process
105
- B) Launch new product/business
106
- C) Improve existing system
107
- D) Enable new capability
108
- E) Other: __
109
-
110
- [If DOMAIN is missing:]
111
- 4️⃣ What INDUSTRY/DOMAIN is this for?
112
- A) E-commerce/Retail
113
- B) Fitness/Health
114
- C) Finance/Payments
115
- D) Education
116
- E) Social/Community
117
- F) Business tools (CRM, ERP)
118
- G) Other: __
119
-
120
- Your answers: __ (e.g., "A, B, A, E" or describe freely)
121
- ```
122
-
123
- ---
124
-
125
- **✨ Generate Professional Description Options**
126
-
127
- After gathering missing info, generate 3 polished versions:
128
-
129
- ```
130
- [LANGUAGE: Match the developer's language]
131
-
132
- ✨ Based on your input, here are 3 professional descriptions:
133
-
134
- A) Concise (for package.json):
135
- "[Generated 1-line description with WHO + WHAT]"
136
-
137
- B) Descriptive (for README.md):
138
- "[Generated 2-3 line description with WHO + WHAT + WHY]"
139
-
140
- C) Technical (for AGENT.md):
141
- "[Generated technical description with DOMAIN + WHAT]"
142
-
143
- Which do you prefer? (1-3, or 4 to edit, 5 to start over)
144
- ```
145
-
146
- ---
147
-
148
- **✅ Final Confirmation**
149
-
150
- ```
151
- ✅ Your final project description:
152
-
153
- 📋 Name: [project name]
154
- 📝 Description: "[final polished description]"
155
-
156
- Proceed to next question? (Y to continue)
157
- ```
158
-
159
- ---
160
-
161
- **1.2 Project Overview (Confirmation + Expansion)**
162
-
163
- > **📌 Smart Skip**: If 1.1 already captured WHO/WHAT/WHY completely, this becomes a quick confirmation.
164
-
165
- ```
166
- [If 1.1 refinement was complete (score >= 4), show:]
167
-
168
- ✅ Based on your description, I understand:
169
- • Users: [WHO from 1.1]
170
- • Core Action: [WHAT from 1.1]
171
- • Purpose: [WHY from 1.1]
172
-
173
- Is this complete? (Y) Or would you like to add more context? (N)
174
-
175
- [If user says Y → Skip to 1.3]
176
- [If user says N → Ask:]
177
- What additional context would you like to add?
178
-
179
- ---
180
-
181
- [If 1.1 was NOT refined OR any WHO/WHAT/WHY still missing, ask:]
182
-
183
- [ONLY ask for MISSING elements - check what was NOT captured in 1.1:]
184
-
185
- [If WHO still unclear:]
186
- Who are the primary users of this system?
187
-
188
- [If WHAT still unclear:]
189
- What is the core value proposition?
190
-
191
- [If WHY still unclear:]
192
- What makes this project necessary?
193
-
194
- Example:
195
- "A backend for a fitness tracking mobile app used by gym-goers (users). It allows users to log workouts, track progress over time, and share achievements with friends (value). This project is necessary to replace our legacy spreadsheet-based system and support our new iOS app launch."
196
- ```
197
-
198
- **1.3 Target Users (Confirmation + Additional Types)**
199
-
200
- > **📌 Smart Skip**: If 1.1 already identified user types, this confirms and expands.
201
-
202
- ```
203
- [If WHO was captured in 1.1, show:]
204
-
205
- ✅ Based on your description, your target users are: [WHO from 1.1]
206
-
207
- Would you like to add any additional user types? Select any that apply:
208
-
209
- A) 🌐 External end-users (B2C) - Public-facing application
210
- B) 🏢 Internal employees (B2B/Enterprise) - Company internal tool
211
- C) 🔌 Other systems/services (API consumers) - Integration platform
212
- D) 👥 Partners/Third-parties - Partner ecosystem
213
- E) 📱 Mobile/Web apps - Backend for frontend
214
- F) ✅ No additional users - [WHO from 1.1] is complete
215
-
216
- ---
217
-
218
- [If WHO was NOT captured in 1.1, ask normally:]
219
-
220
- Who will use this system? Select all that apply:
221
-
222
- A) 🌐 External end-users (B2C) - Public-facing application
223
- B) 🏢 Internal employees (B2B/Enterprise) - Company internal tool
224
- C) 🔌 Other systems/services (API consumers) - Integration platform
225
- D) 👥 Partners/Third-parties - Partner ecosystem
226
- E) 📱 Mobile/Web apps - Backend for frontend
227
-
228
- (Can select multiple)
229
- ```
230
-
231
- **1.4 Business Objectives**
232
-
233
- ```
234
- What are the top 3 measurable objectives for this project?
235
-
236
- Examples:
237
- - Process 10,000 transactions/day
238
- - Reduce customer onboarding time by 50%
239
- - Support 1M active users
240
- - Achieve 99.9% uptime SLA
241
-
242
- Your objectives:
243
- 1.
244
- 2.
245
- 3.
246
- ```
247
-
248
- **1.5 System Type (Confirmation + Validation)**
249
-
250
- > **📌 Smart Skip**: If 1.1 already identified the domain/industry, this confirms it.
251
-
252
- ```
253
- [If DOMAIN was captured in 1.1, show:]
254
-
255
- ✅ Based on your description, this appears to be a: [DOMAIN from 1.1] system
256
-
257
- Is this correct?
258
-
259
- A) ✅ Yes, that's correct
260
- B) 🔄 No, it's actually: [show options below]
261
-
262
- ---
263
-
264
- [If DOMAIN was NOT captured in 1.1, OR user selected B above:]
265
-
266
- What type of system are you building? (This helps suggest common features)
267
-
268
- A) 🛒 E-commerce/Marketplace
269
- B) 📱 SaaS/B2B Platform
270
- C) 📊 CRM/ERP/Business Tool
271
- D) 🎮 Social/Community Platform
272
- E) 📋 Content Management
273
- F) 🏦 FinTech/Payment
274
- G) 🏥 Healthcare/Booking
275
- H) 📚 Education/Learning
276
- I) 🔧 DevTools/API Platform
277
- J) Other: __
278
-
279
- Your choice: __
280
- ```
281
-
282
- **1.6 Core Features**
283
-
284
- ```
285
- What are the main functionalities your system needs?
286
-
287
- Think about what your users will be able to do with your system. You can list them freely, or select from common features suggested below based on your system type.
288
-
289
- 🛒 E-commerce common features:
290
- 1) User authentication (register/login)
291
- 2) Product catalog with search/filters
292
- 3) Shopping cart
293
- 4) Checkout and payment processing
294
- 5) Order management
295
- 6) Inventory tracking
296
- 7) Admin dashboard
297
- 📱 SaaS common features:
298
- 1) User authentication with SSO
299
- 2) Multi-tenant organization/workspace management
300
- 3) Role-based access control (RBAC)
301
- 4) Subscription and billing
302
- 5) Dashboard and analytics
303
- 6) API access
304
- 7) Admin panel
305
- 📊 CRM/Business Tool common features:
306
- 1) User/team management
307
- 2) Contact/customer database
308
- 3) Activity tracking and logging
309
- 4) Reporting and analytics
310
- 5) Integrations (email, calendar, etc.)
311
- 6) Search and filters
312
- 7) Export functionality
313
- 🎮 Social/Community common features:
314
- 1) User profiles
315
- 2) Posts/content creation
316
- 3) Feed/timeline
317
- 4) Comments and reactions
318
- 5) Follow/friend system
319
- 6) Notifications
320
- 7) Moderation tools
321
- ⭐ Your specific features (add any custom functionalities):
322
- -
323
- -
324
- -
325
-
326
- List all functionalities your system needs (select from above or add your own):
327
- ```
328
-
329
- **1.7 Scope Definition**
330
-
331
- ```
332
- Now let's prioritize: What will you build in this first version, and what will you leave for future versions?
333
-
334
- This helps us focus the documentation on what you're building now, while noting what comes later.
335
-
336
- 📋 What will you build in this first version? (Select from the features listed above)
337
-
338
- [Show features from question 1.6 and allow selection]
339
- ---
340
- ⏭️ What will you leave for future versions? (What you're NOT building now)
341
-
342
- Common things to defer:
343
- 1) Mobile native apps (building web/API first)
344
- 2) Advanced analytics/ML features
345
- 3) Third-party integrations (v2)
346
- 4) White-label/multi-branding
347
- 5) Internationalization (i18n)
348
- 6) Advanced automation/workflows
349
- 7) Video/live streaming features
350
- ⭐ Other features to defer (add your own):
351
- -
352
- -
353
- -
354
-
355
- 💡 Tip: It's okay to start simple! You can always expand later. This helps us create focused documentation for your current needs.
356
- ```
357
-
358
- **1.8 Constraints**
359
-
360
- ```
361
- What constraints does this project have? Select all that apply:
362
-
363
- A) ⏰ Time - Must launch by specific date
364
- B) 💰 Budget - Limited development resources
365
- C) 📜 Compliance - Regulatory requirements (GDPR, HIPAA, SOC2, etc.)
366
- D) 🔧 Technology - Must use specific tech stack
367
- E) 📊 Scale - Must handle specific traffic/data volume
368
- F) 🔐 Security - High security requirements
369
- G) ⚡ Performance - Strict latency/throughput requirements
370
-
371
- For each selected, provide details:
372
-
373
- Example:
374
- - Time: Must launch MVP by Q3 2024
375
- - Compliance: Must be GDPR compliant as we serve EU users
376
- ```
377
-
378
- **1.9 Success Metrics**
379
-
380
- ```
381
- How will you measure success?
382
-
383
- 1. Expected Users:
384
- - Initial launch: __ users
385
- - Year 1 goal: __ users
386
-
387
- 2. Performance Targets:
388
- - Response time: < __ ms
389
- - Uptime: __ %
390
-
391
- 3. Business Goals:
392
- - [Goal 1]
393
- - [Goal 2]
394
-
395
- ⭐ Standard for MVP:
396
- - Users: 1,000 initial / 10,000 Year 1
397
- - Response time: < 500ms (API), < 100ms (DB)
398
- - Uptime: 99.9% (Standard cloud SLA)
399
-
400
- 🏆 Standard for Production/Scale:
401
- - Users: 100,000+ active
402
- - Response time: < 200ms (API), < 50ms (DB)
403
- - Uptime: 99.99% (High Availability)
404
- ```
405
-
406
- **1.10 Main Business Flows**
407
-
408
- > Note: If you omit any common flow or functionality, the AI will suggest and document typical processes relevant to your system type, based on best practices and common use cases.
409
-
410
- `````
411
- List the main business flows of the system (e.g., sales, inventory update, invoicing, user registration).
412
-
413
- For each flow, you can add a brief description (optional).
414
-
415
- If you wish, you can specify the main steps of any flow (numbered format). If you do not specify them, the AI will deduce typical steps based on the name and description.
416
-
417
- Example:
418
- - Sales: Process of purchasing products by the customer.
419
- 1. Customer selects products
420
- 2. Order is created
421
- 3. Inventory is updated
422
- 4. Invoice is generated
423
- - Inventory: Automatic stock update after each sale.
424
- - Invoicing: Invoice generation after purchase.
425
-
426
- The AI will automatically generate flow diagrams (mermaid) for each documented process.
427
- ---
428
- #### 🎨 MERMAID BUSINESS FLOW DIAGRAM FORMAT - CRITICAL
429
-
430
- **Use this exact format** for business process flows:
431
-
432
- ````markdown
433
- ```mermaid
434
- flowchart TD
435
- Start([User Visits Site]) --> Browse[Browse Product Catalog]
436
- Browse --> Search{Search or<br/>Browse Categories?}
437
-
438
- Search -->|Use Search| Filter[Apply Search Filters]
439
- Search -->|Browse| Category[Select Category]
440
-
441
- Filter --> Results[View Search Results]
442
- Category --> Results
443
-
444
- Results --> Select[Select Product]
445
- Select --> Details[View Product Details]
446
- Details --> Decision{Add to Cart?}
447
-
448
- Decision -->|Yes| AddCart[Add Item to Cart]
449
- Decision -->|No| Browse
450
-
451
- AddCart --> MoreShopping{Continue<br/>Shopping?}
452
- MoreShopping -->|Yes| Browse
453
- MoreShopping -->|No| Cart[View Shopping Cart]
454
-
455
- Cart --> ReviewCart{Cart OK?}
456
- ReviewCart -->|Modify| Browse
457
- ReviewCart -->|Proceed| Checkout[Start Checkout]
458
-
459
- Checkout --> Address[Enter/Confirm Address]
460
- Address --> Payment[Enter Payment Info]
461
- Payment --> Review[Review Order]
462
- Review --> ProcessPayment[Process Payment]
463
-
464
- ProcessPayment --> PaymentResult{Payment<br/>Success?}
465
-
466
- PaymentResult -->|Success| Confirm[Order Confirmation]
467
- PaymentResult -->|Declined| Retry{Retry<br/>Payment?}
468
-
469
- Retry -->|Yes| Payment
470
- Retry -->|No| SaveCart[Save Cart for Later]
471
- SaveCart --> End1([Exit: Saved])
472
-
473
- Confirm --> Email[Send Confirmation Email]
474
- Email --> Inventory[Update Inventory]
475
- Inventory --> Invoice[Generate Invoice]
476
- Invoice --> End2([Order Complete])
477
-
478
- style Start fill:#e1f5ff
479
- style End1 fill:#ffe1e1
480
- style End2 fill:#e1ffe1
481
- style ProcessPayment fill:#fff4e1
482
- style Confirm fill:#d4edda
483
- `````
484
-
485
- ````
486
-
487
- **Flowchart Syntax:**
488
- - `flowchart TD` = Top-Down flow (recommended)
489
- - `flowchart LR` = Left-Right flow
490
- - `flowchart BT` = Bottom-Top
491
- - `flowchart RL` = Right-Left
492
-
493
- **Node Shapes:**
494
- - `[Rectangle]` = Process step/action
495
- - `{Diamond}` = Decision point (Yes/No, multiple options)
496
- - `([Rounded Rectangle])` = Start/End terminal
497
- - `[(Cylinder)]` = Database operation
498
- - `[[Subroutine]]` = Sub-process
499
- - `[/Parallelogram/]` = Input/Output
500
- - `((Circle))` = Connection point
501
-
502
- **Arrow Types:**
503
- - `-->` = Solid arrow (standard flow)
504
- - `-.->` = Dotted arrow (optional/conditional)
505
- - `==>` = Thick arrow (emphasis)
506
- - `-->|Label|` = Labeled arrow (decision branch)
507
-
508
- **Best Practices for Business Flows:**
509
- 1. **Always start with a terminal**: `([Start])`
510
- 2. **Always end with a terminal**: `([End])`
511
- 3. **Label decision branches**: Use `-->|Yes|` or `-->|No|`
512
- 4. **Use line breaks in labels**: `{Continue<br/>Shopping?}` for readability
513
- 5. **Apply consistent styling**: Same colors for similar node types
514
- 6. **Keep it readable**: Avoid spaghetti flows, group related steps
515
- 7. **Show all paths**: Every decision should have all branches defined
516
- 8. **Include error paths**: Payment failures, validation errors, etc.
517
-
518
- **Multiple Flow Example (Advanced):**
519
-
520
- ```mermaid
521
- flowchart TD
522
- subgraph "Customer Journey"
523
- C1[Browse] --> C2[Select]
524
- C2 --> C3[Purchase]
525
- end
526
-
527
- subgraph "Backend Processing"
528
- B1[Validate Order] --> B2[Process Payment]
529
- B2 --> B3[Update Inventory]
530
- B3 --> B4[Send Notifications]
531
- end
532
-
533
- C3 --> B1
534
- B4 --> C4[Confirmation]
535
- ```
536
-
537
- **Color Coding Guide:**
538
- - Blue (`#e1f5ff`): Start/Entry points
539
- - Green (`#e1ffe1`): Success/Completion
540
- - Red (`#ffe1e1`): Failure/Error states
541
- - Yellow (`#fff4e1`): Critical operations (Payment, Auth)
542
- - Purple (`#f0e1ff`): External integrations
543
-
544
- **Common Business Flows to Document:**
545
- - User Registration/Login
546
- - Purchase/Checkout Process
547
- - Content Creation/Publishing
548
- - Approval/Review Workflows
549
- - Data Import/Export
550
- - Notification/Alert Flows
551
- - Customer Support Ticket Lifecycle
552
-
553
- **Validation:** Test at https://mermaid.live/ before saving
554
- ---
555
- ```
556
-
557
- ### Phase 1 Output
558
-
559
- After gathering all information, confirm:
560
-
561
- ```
562
- 📋 PHASE 1 SUMMARY:
563
-
564
- Project: [name]
565
- Description: [1 sentence]
566
- Users: [list]
567
- Objectives: [3 objectives]
568
- System Type: [E-commerce/SaaS/etc.]
569
- Core Features: [list of main functionalities]
570
- First Version Features: [what will be built now]
571
- Future Features: [what will be deferred]
572
- Constraints: [list with details]
573
- Success Metrics: [KPIs]
574
- Business Flows: [list of main flows]
575
-
576
- Is this correct? (Yes/No)
577
- If corrections needed, specify which section.
578
- ```
579
- ---
580
- ### 📄 Generate Phase 1 Documents
581
-
582
- **Generate `project-brief.md` automatically:**
583
-
584
- - Use template: `.ai-flow/templates/project-brief.template.md`
585
- - Fill with all Phase 1 information
586
- - Write to project root: `project-brief.md`
587
-
588
- ```
589
- ✅ Generated: project-brief.md
590
-
591
- The document has been created with all the information from Phase 1.
592
-
593
- 📝 Would you like to make any corrections before continuing?
594
-
595
- → If yes: Edit project-brief.md and type "ready" when done. I'll re-read it.
596
- → If no: Type "continue" to proceed to Phase 2.
597
- ```
598
-
599
- **If user edits the file:**
600
- Execute `read_file('project-brief.md')` to refresh context before continuing.
601
- ---
602
-
603
- ## 📝 Generated Documents
604
-
605
- After Phase 1, generate/update:
606
- - `project-brief.md` - Core project discovery and requirements
607
-
608
- ---
609
-
610
- **Next Phase:** Phase 2 - Data Architecture (15-20 min)
611
-
612
- Read: `.ai-flow/prompts/backend/flow-build-phase-2.md`
613
-
614
- ---
615
-
616
- **Last Updated:** 2025-12-20
617
- **Version:** 2.1.8
618
-
619
- ---
620
-
621
- ## PHASE 2: Data Architecture (15-20 min)
622
-
623
- ````
624
-
625
-
626
-
1
+ ## PHASE 1: Discovery & Business (15-20 min)
2
+
3
+ > **Order for this phase:** 1.1 → 1.2 → 1.3 → 1.4 → 1.5 → 1.6 → 1.7 → 1.8 → 1.9 → 1.10
4
+
5
+ > **📌 Scope-based behavior:**
6
+ > - **MVP/Basic Scope:** Focus only on core requirements. Skip advanced business logic questions.
7
+ > - **Production-Ready Scope:** In-depth exploration of compliance, scalability, and long-term business goals.
8
+
9
+ ### Objective
10
+ Define the project's core purpose, business rules, and high-level requirements to ensure the foundation is solid before technical design begins.
11
+
12
+ ---
13
+
14
+ ## 🔍 Pre-Flight Check (Smart Skip Logic)
15
+
16
+ > 📎 **Reference:** See [prompts/shared/smart-skip-preflight.md](../../.ai-flow/prompts/shared/smart-skip-preflight.md) for the complete smart skip logic.
17
+
18
+ **Execute Pre-Flight Check for Phase 1:**
19
+
20
+ - **Target File**: `project-brief.md`
21
+ - **Phase Name**: "BUSINESS CONTEXT"
22
+ - **Key Items**: Project name, description, users, objectives, system type, features, scope, constraints, metrics, business flows
23
+ - **Typical Gaps**: Business objectives, success metrics, constraints
24
+
25
+ **Proceed with appropriate scenario based on audit data from `.ai-flow/cache/audit-data.json`**
26
+
27
+ ---
28
+
29
+ ## Phase 1 Questions (Full Mode)
30
+
31
+ > **📌 Note:** If Phase 0 was executed, some questions may already be answered. Skip those and only ask what's missing.
32
+
33
+ **1.1 Project Name & Description (with Smart Refinement)**
34
+
35
+ > **🧠 Intelligent Refinement System**: This question detects vague descriptions and guides the developer to enrich them. It only asks what's missing and responds in the developer's language.
36
+
37
+ ```
38
+ [If detected from Phase 0, show:]
39
+ ✅ Project Name: [detected name]
40
+ ✅ Description: [detected description]
41
+
42
+ Is this correct? (Y/N)
43
+ If no, please provide correct values.
44
+
45
+ [If NOT detected, ask:]
46
+ What is the project name?
47
+
48
+ Provide an initial description of your project.
49
+ (Don't worry about perfection - we'll refine it together if needed!)
50
+
51
+ Example: "A backend for managing gym memberships"
52
+ ```
53
+
54
+ **🔍 AI Internal: Ambiguity Analysis**
55
+
56
+ After receiving the description, silently analyze for these criteria:
57
+
58
+ | Criterion | Check For | Score +1 if present |
59
+ |-----------|-----------|---------------------|
60
+ | **WHO** | Specific user type mentioned (not just "users") | "gym members", "restaurant owners" |
61
+ | **WHAT** | Specific action/function (not just "manage") | "track workouts", "process payments" |
62
+ | **WHY** | Purpose or value mentioned | "to replace spreadsheets", "to launch app" |
63
+ | **DOMAIN** | Industry/vertical indicated | "fitness", "fintech", "healthcare" |
64
+ | **DETAIL** | Description has 10+ meaningful words | Not counting articles |
65
+
66
+ **Scoring Rules:**
67
+ - Score 4-5: ✅ Accept immediately → Proceed to 1.2
68
+ - Score 0-3: ⚠️ Enter refinement loop → Ask ONLY missing criteria
69
+
70
+ ---
71
+
72
+ **🔄 Conditional Refinement Loop (only if score < 4)**
73
+
74
+ > **CRITICAL**: Only ask about criteria that are MISSING. Do NOT repeat questions already answered. Respond in the SAME LANGUAGE the developer used.
75
+
76
+ ```
77
+ [LANGUAGE: Match the developer's language]
78
+
79
+ 🔍 I'd like to understand your project better.
80
+
81
+ Your description: "[original description]"
82
+
83
+ [ONLY show questions for MISSING criteria:]
84
+
85
+ [If WHO is missing:]
86
+ 1️⃣ WHO will use this system?
87
+ A) End consumers (B2C)
88
+ B) Business users (B2B)
89
+ C) Internal team
90
+ D) Other systems (APIs)
91
+ E) Other: __
92
+
93
+ [If WHAT is missing:]
94
+ 2️⃣ WHAT is the core action users will perform?
95
+ A) Buy/sell products or services
96
+ B) Manage/organize information
97
+ C) Communicate/collaborate
98
+ D) Monitor/analyze data
99
+ E) Create/publish content
100
+ F) Other: __
101
+
102
+ [If WHY is missing:]
103
+ 3️⃣ WHY is this project needed?
104
+ A) Replace manual/legacy process
105
+ B) Launch new product/business
106
+ C) Improve existing system
107
+ D) Enable new capability
108
+ E) Other: __
109
+
110
+ [If DOMAIN is missing:]
111
+ 4️⃣ What INDUSTRY/DOMAIN is this for?
112
+ A) E-commerce/Retail
113
+ B) Fitness/Health
114
+ C) Finance/Payments
115
+ D) Education
116
+ E) Social/Community
117
+ F) Business tools (CRM, ERP)
118
+ G) Other: __
119
+
120
+ Your answers: __ (e.g., "A, B, A, E" or describe freely)
121
+ ```
122
+
123
+ ---
124
+
125
+ **✨ Generate Professional Description Options**
126
+
127
+ After gathering missing info, generate 3 polished versions:
128
+
129
+ ```
130
+ [LANGUAGE: Match the developer's language]
131
+
132
+ ✨ Based on your input, here are 3 professional descriptions:
133
+
134
+ A) Concise (for package.json):
135
+ "[Generated 1-line description with WHO + WHAT]"
136
+
137
+ B) Descriptive (for README.md):
138
+ "[Generated 2-3 line description with WHO + WHAT + WHY]"
139
+
140
+ C) Technical (for AGENT.md):
141
+ "[Generated technical description with DOMAIN + WHAT]"
142
+
143
+ Which do you prefer? (1-3, or 4 to edit, 5 to start over)
144
+ ```
145
+
146
+ ---
147
+
148
+ **✅ Final Confirmation**
149
+
150
+ ```
151
+ ✅ Your final project description:
152
+
153
+ 📋 Name: [project name]
154
+ 📝 Description: "[final polished description]"
155
+
156
+ Proceed to next question? (Y to continue)
157
+ ```
158
+
159
+ ---
160
+
161
+ **1.2 Project Overview (Confirmation + Expansion)**
162
+
163
+ > **📌 Smart Skip**: If 1.1 already captured WHO/WHAT/WHY completely, this becomes a quick confirmation.
164
+
165
+ ```
166
+ [If 1.1 refinement was complete (score >= 4), show:]
167
+
168
+ ✅ Based on your description, I understand:
169
+ • Users: [WHO from 1.1]
170
+ • Core Action: [WHAT from 1.1]
171
+ • Purpose: [WHY from 1.1]
172
+
173
+ Is this complete? (Y) Or would you like to add more context? (N)
174
+
175
+ [If user says Y → Skip to 1.3]
176
+ [If user says N → Ask:]
177
+ What additional context would you like to add?
178
+
179
+ ---
180
+
181
+ [If 1.1 was NOT refined OR any WHO/WHAT/WHY still missing, ask:]
182
+
183
+ [ONLY ask for MISSING elements - check what was NOT captured in 1.1:]
184
+
185
+ [If WHO still unclear:]
186
+ Who are the primary users of this system?
187
+
188
+ [If WHAT still unclear:]
189
+ What is the core value proposition?
190
+
191
+ [If WHY still unclear:]
192
+ What makes this project necessary?
193
+
194
+ Example:
195
+ "A backend for a fitness tracking mobile app used by gym-goers (users). It allows users to log workouts, track progress over time, and share achievements with friends (value). This project is necessary to replace our legacy spreadsheet-based system and support our new iOS app launch."
196
+ ```
197
+
198
+ **1.3 Target Users (Confirmation + Additional Types)**
199
+
200
+ > **📌 Smart Skip**: If 1.1 already identified user types, this confirms and expands.
201
+
202
+ ```
203
+ [If WHO was captured in 1.1, show:]
204
+
205
+ ✅ Based on your description, your target users are: [WHO from 1.1]
206
+
207
+ Would you like to add any additional user types? Select any that apply:
208
+
209
+ A) 🌐 External end-users (B2C) - Public-facing application
210
+ B) 🏢 Internal employees (B2B/Enterprise) - Company internal tool
211
+ C) 🔌 Other systems/services (API consumers) - Integration platform
212
+ D) 👥 Partners/Third-parties - Partner ecosystem
213
+ E) 📱 Mobile/Web apps - Backend for frontend
214
+ F) ✅ No additional users - [WHO from 1.1] is complete
215
+
216
+ ---
217
+
218
+ [If WHO was NOT captured in 1.1, ask normally:]
219
+
220
+ Who will use this system? Select all that apply:
221
+
222
+ A) 🌐 External end-users (B2C) - Public-facing application
223
+ B) 🏢 Internal employees (B2B/Enterprise) - Company internal tool
224
+ C) 🔌 Other systems/services (API consumers) - Integration platform
225
+ D) 👥 Partners/Third-parties - Partner ecosystem
226
+ E) 📱 Mobile/Web apps - Backend for frontend
227
+
228
+ (Can select multiple)
229
+ ```
230
+
231
+ **1.4 Business Objectives**
232
+
233
+ ```
234
+ What are the top 3 measurable objectives for this project?
235
+
236
+ Examples:
237
+ - Process 10,000 transactions/day
238
+ - Reduce customer onboarding time by 50%
239
+ - Support 1M active users
240
+ - Achieve 99.9% uptime SLA
241
+
242
+ Your objectives:
243
+ 1.
244
+ 2.
245
+ 3.
246
+ ```
247
+
248
+ **1.5 System Type (Confirmation + Validation)**
249
+
250
+ > **📌 Smart Skip**: If 1.1 already identified the domain/industry, this confirms it.
251
+
252
+ ```
253
+ [If DOMAIN was captured in 1.1, show:]
254
+
255
+ ✅ Based on your description, this appears to be a: [DOMAIN from 1.1] system
256
+
257
+ Is this correct?
258
+
259
+ A) ✅ Yes, that's correct
260
+ B) 🔄 No, it's actually: [show options below]
261
+
262
+ ---
263
+
264
+ [If DOMAIN was NOT captured in 1.1, OR user selected B above:]
265
+
266
+ What type of system are you building? (This helps suggest common features)
267
+
268
+ A) 🛒 E-commerce/Marketplace
269
+ B) 📱 SaaS/B2B Platform
270
+ C) 📊 CRM/ERP/Business Tool
271
+ D) 🎮 Social/Community Platform
272
+ E) 📋 Content Management
273
+ F) 🏦 FinTech/Payment
274
+ G) 🏥 Healthcare/Booking
275
+ H) 📚 Education/Learning
276
+ I) 🔧 DevTools/API Platform
277
+ J) Other: __
278
+
279
+ Your choice: __
280
+ ```
281
+
282
+ **1.6 Core Features**
283
+
284
+ ```
285
+ What are the main functionalities your system needs?
286
+
287
+ Think about what your users will be able to do with your system. You can list them freely, or select from common features suggested below based on your system type.
288
+
289
+ 🛒 E-commerce common features:
290
+ 1) User authentication (register/login)
291
+ 2) Product catalog with search/filters
292
+ 3) Shopping cart
293
+ 4) Checkout and payment processing
294
+ 5) Order management
295
+ 6) Inventory tracking
296
+ 7) Admin dashboard
297
+ 📱 SaaS common features:
298
+ 1) User authentication with SSO
299
+ 2) Multi-tenant organization/workspace management
300
+ 3) Role-based access control (RBAC)
301
+ 4) Subscription and billing
302
+ 5) Dashboard and analytics
303
+ 6) API access
304
+ 7) Admin panel
305
+ 📊 CRM/Business Tool common features:
306
+ 1) User/team management
307
+ 2) Contact/customer database
308
+ 3) Activity tracking and logging
309
+ 4) Reporting and analytics
310
+ 5) Integrations (email, calendar, etc.)
311
+ 6) Search and filters
312
+ 7) Export functionality
313
+ 🎮 Social/Community common features:
314
+ 1) User profiles
315
+ 2) Posts/content creation
316
+ 3) Feed/timeline
317
+ 4) Comments and reactions
318
+ 5) Follow/friend system
319
+ 6) Notifications
320
+ 7) Moderation tools
321
+ ⭐ Your specific features (add any custom functionalities):
322
+ -
323
+ -
324
+ -
325
+
326
+ List all functionalities your system needs (select from above or add your own):
327
+ ```
328
+
329
+ **1.7 Scope Definition**
330
+
331
+ ```
332
+ Now let's prioritize: What will you build in this first version, and what will you leave for future versions?
333
+
334
+ This helps us focus the documentation on what you're building now, while noting what comes later.
335
+
336
+ 📋 What will you build in this first version? (Select from the features listed above)
337
+
338
+ [Show features from question 1.6 and allow selection]
339
+ ---
340
+ ⏭️ What will you leave for future versions? (What you're NOT building now)
341
+
342
+ Common things to defer:
343
+ 1) Mobile native apps (building web/API first)
344
+ 2) Advanced analytics/ML features
345
+ 3) Third-party integrations (v2)
346
+ 4) White-label/multi-branding
347
+ 5) Internationalization (i18n)
348
+ 6) Advanced automation/workflows
349
+ 7) Video/live streaming features
350
+ ⭐ Other features to defer (add your own):
351
+ -
352
+ -
353
+ -
354
+
355
+ 💡 Tip: It's okay to start simple! You can always expand later. This helps us create focused documentation for your current needs.
356
+ ```
357
+
358
+ **1.8 Constraints**
359
+
360
+ ```
361
+ What constraints does this project have? Select all that apply:
362
+
363
+ A) ⏰ Time - Must launch by specific date
364
+ B) 💰 Budget - Limited development resources
365
+ C) 📜 Compliance - Regulatory requirements (GDPR, HIPAA, SOC2, etc.)
366
+ D) 🔧 Technology - Must use specific tech stack
367
+ E) 📊 Scale - Must handle specific traffic/data volume
368
+ F) 🔐 Security - High security requirements
369
+ G) ⚡ Performance - Strict latency/throughput requirements
370
+
371
+ For each selected, provide details:
372
+
373
+ Example:
374
+ - Time: Must launch MVP by Q3 2024
375
+ - Compliance: Must be GDPR compliant as we serve EU users
376
+ ```
377
+
378
+ **1.9 Success Metrics**
379
+
380
+ ```
381
+ How will you measure success?
382
+
383
+ 1. Expected Users:
384
+ - Initial launch: __ users
385
+ - Year 1 goal: __ users
386
+
387
+ 2. Performance Targets:
388
+ - Response time: < __ ms
389
+ - Uptime: __ %
390
+
391
+ 3. Business Goals:
392
+ - [Goal 1]
393
+ - [Goal 2]
394
+
395
+ ⭐ Standard for MVP:
396
+ - Users: 1,000 initial / 10,000 Year 1
397
+ - Response time: < 500ms (API), < 100ms (DB)
398
+ - Uptime: 99.9% (Standard cloud SLA)
399
+
400
+ 🏆 Standard for Production/Scale:
401
+ - Users: 100,000+ active
402
+ - Response time: < 200ms (API), < 50ms (DB)
403
+ - Uptime: 99.99% (High Availability)
404
+ ```
405
+
406
+ **1.10 Main Business Flows**
407
+
408
+ > Note: If you omit any common flow or functionality, the AI will suggest and document typical processes relevant to your system type, based on best practices and common use cases.
409
+
410
+ `````
411
+ List the main business flows of the system (e.g., sales, inventory update, invoicing, user registration).
412
+
413
+ For each flow, you can add a brief description (optional).
414
+
415
+ If you wish, you can specify the main steps of any flow (numbered format). If you do not specify them, the AI will deduce typical steps based on the name and description.
416
+
417
+ Example:
418
+ - Sales: Process of purchasing products by the customer.
419
+ 1. Customer selects products
420
+ 2. Order is created
421
+ 3. Inventory is updated
422
+ 4. Invoice is generated
423
+ - Inventory: Automatic stock update after each sale.
424
+ - Invoicing: Invoice generation after purchase.
425
+
426
+ The AI will automatically generate flow diagrams (mermaid) for each documented process.
427
+ ---
428
+ #### 🎨 MERMAID BUSINESS FLOW DIAGRAM FORMAT - CRITICAL
429
+
430
+ **Use this exact format** for business process flows:
431
+
432
+ ````markdown
433
+ ```mermaid
434
+ flowchart TD
435
+ Start([User Visits Site]) --> Browse[Browse Product Catalog]
436
+ Browse --> Search{Search or<br/>Browse Categories?}
437
+
438
+ Search -->|Use Search| Filter[Apply Search Filters]
439
+ Search -->|Browse| Category[Select Category]
440
+
441
+ Filter --> Results[View Search Results]
442
+ Category --> Results
443
+
444
+ Results --> Select[Select Product]
445
+ Select --> Details[View Product Details]
446
+ Details --> Decision{Add to Cart?}
447
+
448
+ Decision -->|Yes| AddCart[Add Item to Cart]
449
+ Decision -->|No| Browse
450
+
451
+ AddCart --> MoreShopping{Continue<br/>Shopping?}
452
+ MoreShopping -->|Yes| Browse
453
+ MoreShopping -->|No| Cart[View Shopping Cart]
454
+
455
+ Cart --> ReviewCart{Cart OK?}
456
+ ReviewCart -->|Modify| Browse
457
+ ReviewCart -->|Proceed| Checkout[Start Checkout]
458
+
459
+ Checkout --> Address[Enter/Confirm Address]
460
+ Address --> Payment[Enter Payment Info]
461
+ Payment --> Review[Review Order]
462
+ Review --> ProcessPayment[Process Payment]
463
+
464
+ ProcessPayment --> PaymentResult{Payment<br/>Success?}
465
+
466
+ PaymentResult -->|Success| Confirm[Order Confirmation]
467
+ PaymentResult -->|Declined| Retry{Retry<br/>Payment?}
468
+
469
+ Retry -->|Yes| Payment
470
+ Retry -->|No| SaveCart[Save Cart for Later]
471
+ SaveCart --> End1([Exit: Saved])
472
+
473
+ Confirm --> Email[Send Confirmation Email]
474
+ Email --> Inventory[Update Inventory]
475
+ Inventory --> Invoice[Generate Invoice]
476
+ Invoice --> End2([Order Complete])
477
+
478
+ style Start fill:#e1f5ff
479
+ style End1 fill:#ffe1e1
480
+ style End2 fill:#e1ffe1
481
+ style ProcessPayment fill:#fff4e1
482
+ style Confirm fill:#d4edda
483
+ `````
484
+
485
+ ````
486
+
487
+ **Flowchart Syntax:**
488
+ - `flowchart TD` = Top-Down flow (recommended)
489
+ - `flowchart LR` = Left-Right flow
490
+ - `flowchart BT` = Bottom-Top
491
+ - `flowchart RL` = Right-Left
492
+
493
+ **Node Shapes:**
494
+ - `[Rectangle]` = Process step/action
495
+ - `{Diamond}` = Decision point (Yes/No, multiple options)
496
+ - `([Rounded Rectangle])` = Start/End terminal
497
+ - `[(Cylinder)]` = Database operation
498
+ - `[[Subroutine]]` = Sub-process
499
+ - `[/Parallelogram/]` = Input/Output
500
+ - `((Circle))` = Connection point
501
+
502
+ **Arrow Types:**
503
+ - `-->` = Solid arrow (standard flow)
504
+ - `-.->` = Dotted arrow (optional/conditional)
505
+ - `==>` = Thick arrow (emphasis)
506
+ - `-->|Label|` = Labeled arrow (decision branch)
507
+
508
+ **Best Practices for Business Flows:**
509
+ 1. **Always start with a terminal**: `([Start])`
510
+ 2. **Always end with a terminal**: `([End])`
511
+ 3. **Label decision branches**: Use `-->|Yes|` or `-->|No|`
512
+ 4. **Use line breaks in labels**: `{Continue<br/>Shopping?}` for readability
513
+ 5. **Apply consistent styling**: Same colors for similar node types
514
+ 6. **Keep it readable**: Avoid spaghetti flows, group related steps
515
+ 7. **Show all paths**: Every decision should have all branches defined
516
+ 8. **Include error paths**: Payment failures, validation errors, etc.
517
+
518
+ **Multiple Flow Example (Advanced):**
519
+
520
+ ```mermaid
521
+ flowchart TD
522
+ subgraph "Customer Journey"
523
+ C1[Browse] --> C2[Select]
524
+ C2 --> C3[Purchase]
525
+ end
526
+
527
+ subgraph "Backend Processing"
528
+ B1[Validate Order] --> B2[Process Payment]
529
+ B2 --> B3[Update Inventory]
530
+ B3 --> B4[Send Notifications]
531
+ end
532
+
533
+ C3 --> B1
534
+ B4 --> C4[Confirmation]
535
+ ```
536
+
537
+ **Color Coding Guide:**
538
+ - Blue (`#e1f5ff`): Start/Entry points
539
+ - Green (`#e1ffe1`): Success/Completion
540
+ - Red (`#ffe1e1`): Failure/Error states
541
+ - Yellow (`#fff4e1`): Critical operations (Payment, Auth)
542
+ - Purple (`#f0e1ff`): External integrations
543
+
544
+ **Common Business Flows to Document:**
545
+ - User Registration/Login
546
+ - Purchase/Checkout Process
547
+ - Content Creation/Publishing
548
+ - Approval/Review Workflows
549
+ - Data Import/Export
550
+ - Notification/Alert Flows
551
+ - Customer Support Ticket Lifecycle
552
+
553
+ **Validation:** Test at https://mermaid.live/ before saving
554
+ ---
555
+ ```
556
+
557
+ ### Phase 1 Output
558
+
559
+ After gathering all information, confirm:
560
+
561
+ ```
562
+ 📋 PHASE 1 SUMMARY:
563
+
564
+ Project: [name]
565
+ Description: [1 sentence]
566
+ Users: [list]
567
+ Objectives: [3 objectives]
568
+ System Type: [E-commerce/SaaS/etc.]
569
+ Core Features: [list of main functionalities]
570
+ First Version Features: [what will be built now]
571
+ Future Features: [what will be deferred]
572
+ Constraints: [list with details]
573
+ Success Metrics: [KPIs]
574
+ Business Flows: [list of main flows]
575
+
576
+ Is this correct? (Yes/No)
577
+ If corrections needed, specify which section.
578
+ ```
579
+ ---
580
+ ### 📄 Generate Phase 1 Documents
581
+
582
+ **Generate `project-brief.md` automatically:**
583
+
584
+ - Use template: `.ai-flow/templates/project-brief.template.md`
585
+ - Fill with all Phase 1 information
586
+ - Write to project root: `project-brief.md`
587
+
588
+ ```
589
+ ✅ Generated: project-brief.md
590
+
591
+ The document has been created with all the information from Phase 1.
592
+
593
+ 📝 Would you like to make any corrections before continuing?
594
+
595
+ → If yes: Edit project-brief.md and type "ready" when done. I'll re-read it.
596
+ → If no: Type "continue" to proceed to Phase 2.
597
+ ```
598
+
599
+ **If user edits the file:**
600
+ Execute `read_file('project-brief.md')` to refresh context before continuing.
601
+ ---
602
+
603
+ ## 📝 Generated Documents
604
+
605
+ After Phase 1, generate/update:
606
+ - `project-brief.md` - Core project discovery and requirements
607
+
608
+ ---
609
+
610
+ **Next Phase:** Phase 2 - Data Architecture (15-20 min)
611
+
612
+ Read: `.ai-flow/prompts/backend/flow-build-phase-2.md`
613
+
614
+ ---
615
+
616
+ **Last Updated:** 2025-12-20
617
+ **Version:** 2.1.8
618
+
619
+ ---
620
+
621
+ ## PHASE 2: Data Architecture (15-20 min)
622
+
623
+ ````
624
+
625
+
626
+