ai-flow-dev 2.1.9 → 2.2.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.
@@ -14,6 +14,7 @@ Your mission is to guide the user through creating **comprehensive, production-r
14
14
 
15
15
  ### Detectar Argumento de Fase
16
16
 
17
+ // turbo
17
18
  Buscar en el mensaje del usuario patrones como:
18
19
 
19
20
  - "fase 0", "fase 1", "fase 2", ..., "fase 10"
@@ -26,7 +27,7 @@ Buscar en el mensaje del usuario patrones como:
26
27
  **Si se detecta "fase N" (donde N = 0-10):**
27
28
 
28
29
  1. **Validar que la fase existe para backend:**
29
- - Fase 0: Context Discovery (opcional, solo proyectos existentes)
30
+ - Fase 0: Context Discovery
30
31
  - Fase 1: Discovery & Business
31
32
  - Fase 2: Data Architecture
32
33
  - Fase 3: System Architecture
@@ -35,878 +36,100 @@ Buscar en el mensaje del usuario patrones como:
35
36
  - Fase 6: Testing Strategy
36
37
  - Fase 7: Operations & Deployment
37
38
  - Fase 8: Project Setup & Final Documentation
38
- - Fase 9: Implementation Roadmap (opcional)
39
- - Fase 10: User Stories Generation (opcional)
39
+ - Fase 9: Implementation Roadmap
40
+ - Fase 10: User Stories Generation
40
41
 
41
42
  2. **Si la fase es válida:**
42
43
  - Leer el archivo: `.ai-flow/prompts/backend/flow-build-phase-N.md`
43
- - Ejecutar SOLO esa fase
44
- - NO continuar con otras fases
45
- - Al finalizar, informar al usuario que puede continuar con la siguiente fase usando `/flow-build fase N+1`
44
+ - Ejecutar SOLO esa fase y seguir sus instrucciones internas.
45
+ - Al finalizar, informar que puede continuar con la siguiente fase usando `/flow-build fase N+1`.
46
46
 
47
47
  3. **Si la fase es inválida:**
48
- - Mostrar mensaje de error amigable
49
- - Listar las fases válidas (0-10) con descripción de una línea
48
+ - Listar las fases válidas (0-10) con descripción de una línea.
50
49
 
51
50
  **Si NO se detecta "fase N":**
52
-
53
- - Ejecutar el flujo completo normal (todas las fases en orden)
54
- - Comenzar con Mode Selection (Interactive vs Smart Auto-Suggest)
55
- - Continuar con Scope Selection (MVP/Production-Ready/Enterprise)
56
- - Ejecutar Phases 0-10 según corresponda
57
-
58
- ### Ejemplo de Lista de Fases Válidas
59
-
60
- Si el usuario especifica una fase inválida, mostrar:
61
-
62
- ```
63
- ❌ Fase inválida. Las fases válidas para backend son:
64
- ---
65
- 📋 Fases Disponibles - Backend
66
- ---
67
- /flow-build fase 0 - Context Discovery (solo proyectos existentes)
68
- /flow-build fase 1 - Discovery & Business (problema, usuarios, objetivos)
69
- /flow-build fase 2 - Data Architecture (entidades, relaciones, database)
70
- /flow-build fase 3 - System Architecture (tech stack, patrones, APIs)
71
- /flow-build fase 4 - Security & Authentication (auth, autorización, compliance)
72
- /flow-build fase 5 - Code Standards (convenciones, formato, git workflow)
73
- /flow-build fase 6 - Testing Strategy (tipos de tests, coverage, CI)
74
- /flow-build fase 7 - Operations & Deployment (deployment, monitoreo, logging)
75
- /flow-build fase 8 - Project Setup & Final Documentation (inicializar proyecto)
76
- /flow-build fase 9 - Implementation Roadmap (plan con Story Points - opcional)
77
- /flow-build fase 10 - User Stories Generation (Gherkin AC & Test Cases - opcional)
78
- ---
79
- 💡 Tip: Usa /flow-build sin argumentos para ejecutar todas las fases en orden.
80
- ```
51
+ - Ejecutar el flujo completo comenzando por la Selección de Modo (A/B).
81
52
  ---
82
53
  ## Important Instructions
83
54
 
84
- 1. **Ask for Questionnaire Mode FIRST** - Before anything else, ask the user to select: Interactive Mode or Smart Auto-Suggest Mode (see "Mode Selection" section below)
85
- 2. **Ask for Project Scope SECOND** - After mode selection, ask the user to select: MVP, Production-Ready, or Enterprise
86
- 3. **Adapt questions based on mode and scope** - Skip or simplify questions according to the selected mode and scope level
87
- 4. **Execute ALL applicable phases in order** - Do not skip phases, but adjust depth based on scope
88
- 5. **Ask questions ONE BY ONE** - Do not present multiple questions at once. Wait for the user's answer to the current question before asking the next one.
89
- 6. **Show progress indicator before EVERY question** - Use this format:
90
- ```
91
- ---
92
- 📋 Phase [N]: [Phase Name] | Question [X]/[Total] | Phase Progress: [%]%
93
- ---
94
- ```
95
- Example for Phase 1, Question 3 of 8:
96
- ```
97
- ---
98
- 📋 Phase 1: Discovery & Business | Question 3/8 | Phase Progress: 37%
99
- ---
100
- ```
101
- 7. **Provide recommendations** using these markers:
102
- - ⭐ **Recommended** - Best choice for most projects
103
- - 🔥 **Popular** - Widely used in industry
104
- - ⚡ **Modern** - Cutting-edge, newer approach
105
- - 🏆 **Enterprise** - Best for large-scale projects
106
- 8. **Use multiple choice when possible** - Give 3-4 options (A, B, C, D)
107
- 9. **Validate completeness** - Ensure all critical information is gathered
108
- 10. **Generate documents incrementally** - After each phase, generate corresponding documents with validation
109
- 11. **Show summary at the end** - Present both a quick summary (1 paragraph) and an extended report
55
+ 1. **Ask for Questionnaire Mode FIRST** (Interactive vs Smart Auto-Suggest).
56
+ 2. **Ask for Project Scope SECOND** (MVP, Production-Ready, or Enterprise).
57
+ 3. **Execute ALL applicable phases in order**, adjusting depth based on scope.
58
+ 4. **Ask questions ONE BY ONE**. Wait for the user's answer.
59
+ 5. **Show progress indicator before EVERY question**.
60
+ 6. **Provide recommendations** using markers: **Recommended**, 🔥 **Popular**, **Modern**, 🏆 **Enterprise**.
61
+ 7. **Generate documents incrementally** after each phase.
110
62
  ---
111
63
  ## 🚀 Mode Selection
112
64
 
113
65
  **BEFORE STARTING ANY PHASE**, ask the user to select the questionnaire mode:
114
66
 
115
- ```
116
- ---
117
- 🚀 Welcome to AI Flow!
118
- ---
119
- Let's create comprehensive documentation for your backend project.
120
-
121
- **How would you like to proceed?**
122
-
123
67
  A) ⭐ **Interactive Mode (Recommended)**
124
- You answer each question step-by-step
125
- • Full control over every decision
126
- • Takes 90-120 min for new projects, 35-70 min for existing
127
- • Best for: Custom requirements, specific needs
68
+ Full control, step-by-step questions. (90-120 min)
128
69
 
129
70
  B) ⚡ **Smart Auto-Suggest Mode**
130
- • AI suggests best practices for most questions
131
- • You only answer 6 critical business questions
132
- • Takes 15-25 minutes
133
- • Best for: MVPs, standard projects, quick setup
71
+ • AI suggests best practices, you answer 6 critical questions. (15-25 min)
134
72
 
135
73
  Your choice (A/B): __
136
- ```
137
74
 
138
75
  **Based on the selection:**
76
+ - **Mode A (Interactive):** Proceed with normal sequential flow (Phases 0-10).
77
+ - **Mode B (Smart Auto-Suggest):** Ask the following 6 critical questions one by one, then auto-generate all suggestions based on industry standards and the system type:
139
78
 
140
- - **Mode A (Interactive):** Proceed with normal flow - execute all phases, ask all questions one by one
141
- - **Mode B (Smart Auto-Suggest):** Execute "Smart Auto-Suggest Flow" (see section below)
142
- ---
143
- ## Smart Auto-Suggest Flow (Mode B)
144
-
145
- **This flow only asks 6 critical business questions and auto-suggests the rest based on best practices.**
146
-
147
- ### Step 1: Ask Critical Questions Only
148
-
149
- Ask these 6 questions one by one with progress indicator:
150
-
151
- ```
152
- ---
153
- ⚡ Smart Auto-Suggest Mode | Question 1/6 | Progress: 17%
154
- ---
155
- ```
156
-
157
- **Critical Questions:**
158
-
159
- 1. **Project Name & Description** (if new project - skip if Phase 0 detected)
160
- - What is the project name?
161
- - Provide a short description (1 sentence)
162
-
163
- 2. **Project Overview**
164
- - What problem does this backend system solve? (2-3 sentences)
165
-
166
- 3. **Business Objectives**
167
- - What are the top 3 measurable objectives for this project?
168
-
169
- 4. **System Type** (Critical for auto-suggestions)
170
- - What type of system are you building?
171
-
172
- **Options:**
173
- - A) E-commerce (Product catalog, cart, checkout)
174
- - B) SaaS (Multi-tenant, subscriptions, RBAC)
175
- - C) CRM (Contacts, leads, sales pipeline)
176
- - D) Social Network (Users, posts, feeds, messaging)
177
- - E) Content Management (Articles, media, publishing)
178
- - F) Project Management (Projects, tasks, boards)
179
- - G) API Platform (API keys, rate limiting, webhooks)
180
- - H) Marketplace (Buyers, sellers, listings)
181
- - I) IoT Platform (Devices, sensors, commands)
182
- - J) Other (will use generic defaults)
183
-
184
- 5. **Core Data Entities** (if new project - skip if Phase 0 detected)
185
- - List the main entities/models your system needs (e.g., User, Product, Order)
186
-
187
- 6. **Backend Framework** (if new project - skip if Phase 0 detected)
188
- - Which backend framework will you use? (NestJS/FastAPI/Spring Boot/etc.)
189
-
190
- ### Step 2: Auto-Generate Intelligent Suggestions
191
-
192
- Based on the 6 critical answers, automatically generate comprehensive suggestions using AI reasoning.
193
-
194
- **Suggestion Logic:**
195
-
196
- For each phase, suggest defaults based on:
197
-
198
- - **System Type** - E-commerce needs cart/checkout, SaaS needs multi-tenancy, etc.
199
- - **Framework** - NestJS → Prisma, FastAPI → SQLAlchemy, Django → Django ORM
200
- - **Scope** - MVP → simple setup, Production → robust setup, Enterprise → full observability
201
-
202
- **What Gets Auto-Generated:**
203
-
204
- **Phase 1 (Business):**
205
-
206
- - ✅ Target users based on system type
207
- - ✅ Core features typical for the system type
208
- - ✅ Success metrics appropriate for the domain
209
-
210
- **Phase 2 (Data):**
211
-
212
- - ✅ Database: PostgreSQL (most common)
213
- - ✅ ORM: Match framework idiomatically
214
- - ✅ Caching: Redis for Production/Enterprise
215
- - ✅ Search: Elasticsearch only for Enterprise
216
-
217
- **Phase 3 (Architecture):**
218
-
219
- - ✅ Pattern: Monolith (MVP) → Clean Architecture (Production) → Microservices (Enterprise)
220
- - ✅ API: REST only (MVP) → REST + GraphQL (Production) → + gRPC (Enterprise)
221
- - ✅ Scaling strategy based on scope
222
-
223
- **Phase 4 (Security):**
224
-
225
- - ✅ Auth: JWT for MVP/Production, OAuth2 + SSO for Enterprise
226
- - ✅ Authorization: RBAC standard, ABAC for Enterprise
227
- - ✅ Password policies per scope
228
- - ✅ Rate limiting and CORS enabled
229
-
230
- **Phase 5 (Code Standards):**
231
-
232
- - ✅ Formatter/Linter matching framework (Prettier+ESLint, Black+pylint, etc.)
233
- - ✅ Git workflow: GitHub Flow (MVP), Git Flow (Production)
234
- - ✅ Conventional Commits
235
-
236
- **Phase 6 (Testing):**
237
-
238
- - ✅ Framework matching tech stack
239
- - ✅ Coverage: 20% (MVP), 70% (Production), 85% (Enterprise)
240
- - ✅ Test types distribution
241
-
242
- **Phase 7 (Operations):**
243
-
244
- - ✅ Deployment: PaaS (MVP), Cloud (Production), Multi-region (Enterprise)
245
- - ✅ CI/CD: GitHub Actions
246
- - ✅ Monitoring: Basic (MVP), APM (Production), Full observability (Enterprise)
247
-
248
- ### Step 3: Present Summary for Review
249
-
250
- After auto-generating all suggestions, present a clear summary:
251
-
252
- #### **Quick Summary (1 paragraph)**
253
-
254
- ```
255
- ---
256
- ✅ Configuration Complete - Quick Summary
257
- ---
258
- Your [System Type] backend will use [Framework] with [Database], following
259
- [Architecture Pattern] with [X] entities ([entity names]). Security includes
260
- [Auth Method] with [Authorization], [Password Policy]. Code follows
261
- [Formatter] + [Linter], targeting [Coverage Target] test coverage. Deployment
262
- to [Deployment Platform] with [Monitoring] for production readiness.
263
- ---
264
- ```
265
-
266
- **Example (E-commerce + NestJS + Production):**
267
-
268
- ```
269
- Your E-commerce backend will use NestJS with PostgreSQL, following Clean
270
- Architecture with 8 entities (User, Product, Category, Cart, Order, Payment,
271
- Address, Review). Security includes JWT + Refresh Tokens with RBAC,
272
- 12+ characters bcrypt 12 rounds. Code follows Prettier + ESLint +
273
- @typescript-eslint, targeting 70% test coverage. Deployment to Cloud
274
- (AWS/GCP/Azure) with APM (Datadog/New Relic) + Sentry for production
275
- readiness.
276
- ```
277
-
278
- #### **Extended Report (Organized by Phase)**
279
-
280
- ```
281
- ---
282
- 📋 Extended Configuration Report
283
- ---
284
- **Phase 1: Business & Discovery**
285
- • System Type: [From user input]
286
- • Target Users: [AI-suggested based on system type]
287
- • Core Features: [AI-suggested based on system type]
288
- • Success Metrics: [AI-suggested based on system type]
289
-
290
- **Phase 2: Data Architecture**
291
- • Database: [AI-suggested from scope]
292
- • ORM: [AI-suggested from framework]
293
- • Caching: [AI-suggested from scope]
294
- • Core Entities: [From user input]
295
-
296
- **Phase 3: System Architecture**
297
- • Framework: [From user input]
298
- • Pattern: [AI-suggested from scope]
299
- • API Style: [AI-suggested from scope]
300
- • Scaling: [AI-suggested from scope]
301
-
302
- **Phase 4: Security**
303
- • Authentication: [AI-suggested from scope]
304
- • Authorization: [AI-suggested from scope]
305
- • Password Policy: [AI-suggested from scope]
306
-
307
- **Phase 5: Code Standards**
308
- • Formatter: [AI-suggested from framework]
309
- • Linter: [AI-suggested from framework]
310
- • Git Workflow: [AI-suggested from scope]
311
-
312
- **Phase 6: Testing**
313
- • Coverage Target: [AI-suggested from scope]
314
- • Framework: [AI-suggested from framework]
315
-
316
- **Phase 7: Operations**
317
- • Deployment: [AI-suggested from scope]
318
- • Monitoring: [AI-suggested from scope]
319
- ---
320
- 💡 These suggestions can be customized during document review.
321
- ---
322
- ```
323
-
324
- ### Step 4: Confirmation & Override Option
325
-
326
- ```
327
- Would you like to:
328
-
329
- A) ✅ **Accept all suggestions** (Generate documentation now - 2 minutes)
330
- B) 📝 **Review & customize specific sections** (Show which phase to modify)
331
- C) ❌ **Cancel and switch to Interactive Mode** (Full control)
332
-
333
- Your choice (A/B/C): __
334
- ```
335
-
336
- **If user selects B:**
337
-
338
- - Show list of phases
339
- - Ask which phase they want to customize
340
- - Show that phase's suggested values
341
- - Allow modifications
342
- - Return to confirmation
343
-
344
- **If user selects A:**
345
-
346
- - Proceed directly to document generation with all suggested values
347
-
348
- **If user selects C:**
349
-
350
- - Restart with Interactive Mode (Mode A)
351
-
352
- ### Step 5: Generate Documentation
353
-
354
- Generate all 17 documents using the confirmed values (either AI-suggested or user-customized).
355
- ---
356
- ## 📚 How to Use This Guide
357
-
358
- This documentation is **modularized** for better maintainability and performance. Each phase is in a separate file.
359
-
360
- ### For Complete Build (All Phases)
361
-
362
- Execute phases sequentially by reading each file in order:
363
-
364
- 1. **Phase 0 (Optional - Existing Projects Only):** Read `.ai-flow/prompts/backend/flow-build-phase-0-context.md`
365
- 2. **Phase 1 (Discovery & Business):** Read `.ai-flow/prompts/backend/flow-build-phase-1-business.md`
366
- 3. **Phase 2 (Data Architecture):** Read `.ai-flow/prompts/backend/flow-build-phase-2-data.md`
367
- 4. **Phase 3 (System Architecture):** Read `.ai-flow/prompts/backend/flow-build-phase-3-architecture.md`
368
- 5. **Phase 4 (Security & Authentication):** Read `.ai-flow/prompts/backend/flow-build-phase-4-security.md`
369
- 6. **Phase 5 (Code Standards):** Read `.ai-flow/prompts/backend/flow-build-phase-5-standards.md`
370
- 7. **Phase 6 (Testing Strategy):** Read `.ai-flow/prompts/backend/flow-build-phase-6-testing.md`
371
- 8. **Phase 7 (Operations & Deployment):** Read `.ai-flow/prompts/backend/flow-build-phase-7-operations.md`
372
- 9. **Phase 8 (Project Setup & Final Documentation):** Read `.ai-flow/prompts/backend/flow-build-phase-8.md`
373
- 10. **Phase 9 (Implementation Roadmap):** Read `.ai-flow/prompts/backend/flow-build-phase-9.md`
374
- 11. **Phase 10 (User Stories Generation):** Read `.ai-flow/prompts/backend/flow-build-phase-10.md`
375
-
376
- ### For Individual Phases
377
-
378
- You can execute any phase independently by reading its file. For example:
379
-
380
- ```
381
- Read .ai-flow/prompts/backend/flow-build-phase-4-security.md and execute only Phase 4
382
- ```
383
- ---
384
- ## 🎯 Phase Overview
385
-
386
- ### Phase 0: Context Discovery (Optional)
387
-
388
- **File:** `backend/flow-build-phase-0-context.md`
389
- **For:** Existing projects with code/documentation
390
- **Duration:** 1-5 minutes (automated analysis)
391
- **Output:** Pre-populated answers, project analysis
392
-
393
- **What it does:**
394
-
395
- - **Layer 0:** Checks cache (0-2 seconds)
396
- - **Layer 1:** Fast metadata scan (10-20 seconds) - Detects language, framework, ORM
397
- - **Layer 2:** Structural analysis (30-90 seconds) - Analyzes directory structure, entities
398
- - **Layer 3:** Selective deep analysis (optional) - Extracts endpoints, relationships, security patterns
399
-
400
- **Supports:** 12 languages, 60+ frameworks, 35+ ORMs (98% market coverage)
401
-
402
- **Skip if:** Starting a completely new project from scratch
403
- ---
404
- ### Phase 1: Discovery & Business
405
-
406
- **File:** `backend/flow-build-phase-1-business.md`
407
- **Duration:** 15-20 minutes
408
- **Key Questions:**
409
-
410
- - What problem are you solving?
411
- - Who are your target users?
412
- - What are your business objectives?
413
- - What is your project scope?
414
-
415
- **Generates:**
416
-
417
- - `project-brief.md`
418
- - Parts of `AGENT.md`
419
- ---
420
- ### Phase 2: Data Architecture
421
-
422
- **File:** `backend/flow-build-phase-2-data.md`
423
- **Duration:** 15-20 minutes
424
- **Key Questions:**
425
-
426
- - What entities/models do you need?
427
- - How are they related?
428
- - What database will you use?
429
- - What are the data ownership rules?
430
-
431
- **Generates:**
432
-
433
- - `docs/data-model.md`
434
- - Parts of `ai-instructions.md`
435
- ---
436
- ### Phase 3: System Architecture
437
-
438
- **File:** `backend/flow-build-phase-3-architecture.md`
439
- **Duration:** 15-20 minutes
440
- **Key Questions:**
441
-
442
- - What tech stack will you use?
443
- - How will you structure your code?
444
- - What external services do you need?
445
- - How will you handle caching and background jobs?
446
-
447
- **Generates:**
448
-
449
- - `docs/architecture.md`
450
- - `docs/business-flows.md`
451
- - `docs/api.md`
452
- - Parts of `ai-instructions.md`
453
- ---
454
- ### Phase 4: Security & Authentication
455
-
456
- **File:** `backend/flow-build-phase-4-security.md`
457
- **Duration:** 15-20 minutes
458
- **Key Questions:**
459
-
460
- - How will users authenticate?
461
- - What authorization model will you use?
462
- - What compliance requirements do you have?
463
- - How will you handle sensitive data?
464
-
465
- **Generates:**
466
-
467
- - `specs/security.md`
468
- - Parts of `ai-instructions.md`
469
- ---
470
- ### Phase 5: Code Standards
471
-
472
- **File:** `backend/flow-build-phase-5-standards.md`
473
- **Duration:** 15-20 minutes
474
- **Key Questions:**
475
-
476
- - What naming conventions will you use?
477
- - How will you handle errors?
478
- - What logging strategy will you use?
479
- - What validation approach will you use?
480
-
481
- **Generates:**
482
-
483
- - `docs/code-standards.md`
484
- - Parts of `ai-instructions.md`
485
- ---
486
- ### Phase 6: Testing Strategy
487
-
488
- **File:** `backend/flow-build-phase-6-testing.md`
489
- **Duration:** 15-25 minutes
490
- **Key Questions:**
491
-
492
- - What types of tests will you write?
493
- - What coverage targets do you have?
494
- - How will you structure your tests?
495
- - What testing tools will you use?
496
-
497
- **Generates:**
498
-
499
- - `docs/testing.md`
500
- - Parts of `ai-instructions.md`
501
- ---
502
- ### Phase 7: Operations & Deployment
503
-
504
- **File:** `backend/flow-build-phase-7-operations.md`
505
- **Duration:** 10 minutes
506
- **Key Questions:**
507
-
508
- - Where will you deploy?
509
- - How will you handle environments?
510
- - What monitoring will you use?
511
- - How will you handle logging and errors?
512
-
513
- **Generates:**
514
-
515
- - `docs/operations.md`
516
- - `specs/configuration.md`
517
- - `.env.example`
518
-
519
- **Next:** Transitions to Phase 8 for project setup and final documentation
520
- ---
521
- ### Phase 8: Project Setup & Final Documentation
522
-
523
- **File:** `backend/flow-build-phase-8.md`
524
- **Duration:** 10-15 minutes
525
- **Key Steps:**
526
-
527
- - Detect project state (new vs existing)
528
- - Initialize framework (optional, for new projects)
529
- - Generate final documentation
530
- - Create master index (AGENT.md)
531
- - Generate README.md with intelligent merge
532
-
533
- **Generates:**
534
-
535
- - `docs/business-flows.md`
536
- - `docs/api.md`
537
- - `docs/contributing.md`
538
- - `AGENT.md` (master index)
539
- - `README.md`
540
- - Tool-specific configs (`.clauderules`, `.cursorrules`, `.github/copilot-instructions.md`)
541
-
542
- **Next:** Offers optional Phase 9 for implementation roadmap generation
543
- ---
544
- ### Phase 9: Implementation Roadmap (Optional)
545
-
546
- **File:** `backend/flow-build-phase-9.md`
547
- **Duration:** 15-30 minutes
548
- **Key Steps:**
549
-
550
- - Analyze all generated documentation
551
- - Define Epics by domain
552
- - Break down Features with Story Points (Fibonacci scale)
553
- - Generate dependency graph and execution order
554
- - Identify parallelization opportunities
555
- - Create production readiness checklist
556
-
557
- **Generates:**
558
-
559
- - `docs/roadmap.md` (complete implementation plan)
560
-
561
- **Output includes:**
562
-
563
- - Epics organized by priority
564
- - Features with Story Point estimations
565
- - Task breakdown with acceptance criteria
566
- - Ready-to-execute `/feature` commands
567
- - Dependency graph (Mermaid)
568
- - Time estimates (1 dev, 2 devs, 3 devs)
569
-
570
- **Skip if:** You prefer to start coding immediately without a detailed roadmap
571
- ---
572
- ### Phase 10: User Stories Generation (Optional)
573
-
574
- **File:** `backend/flow-build-phase-10.md`
575
- **Duration:** 30-60 minutes
576
- **Key Steps:**
577
-
578
- - Load context from Phase 9 roadmap
579
- - Generate detailed User Stories for selected Epics/Features
580
- - Create Gherkin-style Acceptance Criteria (Given/When/Then)
581
- - Inherit technical tasks from roadmap
582
- - Generate QA Test Cases with specific data
583
- - Update roadmap with links to User Stories
584
-
585
- **Generates:**
586
-
587
- - `docs/user-stories/EP-XXX/HU-XXX-YYY.md` (User Story)
588
- - `docs/user-stories/EP-XXX/tests/TC-XXX-YYY.md` (Test Cases)
589
-
590
- **Skip if:** You don't need detailed user stories or Gherkin AC for your workflow
591
- ---
592
- ## 🚀 Quick Start Guide
593
-
594
- ### For New Projects
595
-
596
- ```
597
- 1. Skip Phase 0
598
- 2. Start with Phase 1 (Discovery & Business)
599
- 3. Continue through Phases 2-7 sequentially
600
- 4. Review and refine generated documentation
601
- ```
602
-
603
- **Command:**
604
-
605
- ```
606
- Read .ai-flow/prompts/backend/flow-build-phase-1-business.md and execute Phase 1
607
- ```
608
- ---
609
- ### For Existing Projects
610
-
611
- ```
612
- 1. START with Phase 0 (Context Discovery)
613
- - AI will analyze your code and pre-populate answers
614
- - Saves 40-60% of time
615
-
616
- 2. Continue with Phases 1-7
617
- - Skip questions already answered in Phase 0
618
- - Only fill gaps in documentation
619
-
620
- 3. Review and refine generated documentation
621
- ```
622
-
623
- **Command:**
624
-
625
- ```
626
- Read .ai-flow/prompts/backend/flow-build-phase-0-context.md and execute Phase 0
627
- ```
628
- ---
629
- ## 📋 Scope Selection
630
-
631
- Before starting Phase 1, you'll select a scope level:
632
-
633
- > 📎 **Reference:** See [prompts/shared/scope-levels.md](../shared/scope-levels.md) for detailed scope definitions (MVP, Production-Ready, Enterprise).
634
-
635
- ### A) ⭐ MVP / Prototype
636
-
637
- **Focus:** Core functionality + basic tests. Best for POCs and internal tools.
638
-
639
- ### B) 🚀 Production-Ready
640
-
641
- **Focus:** Production-grade with best practices. Best for SaaS and customer-facing APIs.
642
-
643
- ### C) 🏢 Enterprise / Mission-Critical
644
-
645
- **Focus:** Enterprise governance, compliance, and high scalability.
646
- ---
647
- ## 📊 Benefits of Modular Structure
648
-
649
- ✅ **Faster Loading** - Load only the phase you need (~8-50 KB vs 140 KB)
650
- ✅ **Better Maintainability** - Changes to one phase don't affect others
651
- ✅ **Independent Execution** - Run individual phases without loading entire file
652
- ✅ **Reduced Context Usage** - AI assistants use 50-70% less context
653
- ✅ **Clearer Git Diffs** - Changes are isolated to specific phase files
654
- ✅ **Easier Collaboration** - Multiple people can work on different phases
655
- ✅ **Better Performance** - Smaller files process faster in AI tools
656
- ---
657
- ## 🎓 Best Practices
79
+ 1. **Project Name & Description** (Skip if Phase 0 detected context)
80
+ 2. **Project Overview:** What problem does this system solve?
81
+ 3. **Business Objectives:** Top 3 measurable objectives.
82
+ 4. **System Type:** E-commerce, SaaS, CRM, Social, CMS, API Platform, etc.
83
+ 5. **Core Data Entities:** Main models (User, Product, Order, etc.).
84
+ 6. **Backend Framework:** NestJS, FastAPI, Spring Boot, Go, etc.
658
85
 
659
- ### Before Starting
660
-
661
- 1. Have a clear problem statement
662
- 2. Know your approximate tech stack (or let Phase 0 detect it)
663
- 3. Understand your target users
664
- 4. Choose your scope (MVP/Production-Ready/Enterprise)
665
- 5. Set aside appropriate time based on scope
666
-
667
- ### During Execution
668
-
669
- 1. Take your time with each question
670
- 2. Use recommendations (⭐🔥⚡🏆) as guides
671
- 3. Be specific - more detail = better docs
672
- 4. Confirm each phase before proceeding
673
- 5. Review generated docs after each phase
674
-
675
- ### After Completion
676
-
677
- 1. Review all generated documents
678
- 2. Customize as needed for your specific project
679
- 3. Share `AGENT.md` with your team
680
- 4. Update documents as your project evolves
681
- 5. Use `/flow-build-phase-[N]` commands to regenerate individual sections
682
- ---
683
- ## 💡 Tips
684
-
685
- - **Use cache:** If you run Phase 0, it saves results for instant re-runs
686
- - **Start selective:** For quick updates, run only the phases you need
687
- - **Iterate:** You can re-run phases to refine documentation
688
- - **Universal support:** Works with 12 languages, 60+ frameworks, 35+ ORMs
689
- - **AI-agnostic:** Works with Claude, Copilot, Cursor, Gemini, any AI tool
86
+ **AI Logic for Auto-Suggest:**
87
+ - Generate comprehensive suggestions for all phases (1-10).
88
+ - Use idiomatic tools for the selected framework (e.g., NestJS -> Prisma).
89
+ - Adjust complexity based on scope (MVP vs Enterprise).
90
+ - Present a summary for confirmation before generating documentation.
690
91
  ---
691
- ## 🔄 Maintaining Documentation
692
-
693
- As your project evolves, your documentation may become out of sync with your code. Use the `/flow-docs-sync` command to keep documentation synchronized.
694
-
695
- ### Command: `/flow-docs-sync`
696
-
697
- **Purpose:** Detect code changes and automatically update affected documentation files.
698
-
699
- **How it works:**
700
-
701
- 1. Compares current code state with last documented state (`.ai-flow/cache/docs-analysis.json`)
702
- 2. Detects changes in endpoints, entities, dependencies, architecture, configuration
703
- 3. Shows report of documents that need updating
704
- 4. Asks for confirmation to update all detected documents
705
- 5. Updates documents incrementally (only changed sections)
706
- 6. Updates `docs-analysis.json` with new state
707
-
708
- **When to use:**
709
-
710
- - After adding new API endpoints
711
- - After modifying database entities
712
- - After adding new dependencies
713
- - After changing project structure
714
- - After adding new environment variables
715
- - Periodically to ensure documentation stays current
716
-
717
- **Usage:**
718
92
 
719
- ```
720
- /flow-docs-sync
721
- ```
93
+ ## 📚 Flow Overview & Modular Phases
722
94
 
723
- **For detailed instructions:** Read `.ai-flow/prompts/backend/flow-docs-sync.md`
724
- ---
725
- ## 📞 Need Help?
95
+ Each phase is modularized for better maintainability and reduced context usage.
726
96
 
727
- - **Issues:** [GitHub Issues](https://github.com/victorvelazquez/ai-flow/issues)
728
- - **Documentation:** [README.md](../../README.md)
729
- - **Contributing:** [CONTRIBUTING.md](../../CONTRIBUTING.md)
730
- - **Maintaining Docs:** Use `/flow-docs-sync` command (see AI Flow README for details)
731
- ---
732
- **Ready to start?** Choose your path:
97
+ | Phase | Description | File |
98
+ |-------|-------------|------|
99
+ | **Phase 0** | Context Discovery | `backend/flow-build-phase-0.md` |
100
+ | **Phase 1** | Business & Discovery | `backend/flow-build-phase-1.md` |
101
+ | **Phase 2** | Data Architecture | `backend/flow-build-phase-2.md` |
102
+ | **Phase 3** | System Architecture | `backend/flow-build-phase-3.md` |
103
+ | **Phase 4** | Security & Auth | `backend/flow-build-phase-4.md` |
104
+ | **Phase 5** | Code Standards | `backend/flow-build-phase-5.md` |
105
+ | **Phase 6** | Testing Strategy | `backend/flow-build-phase-6.md` |
106
+ | **Phase 7** | Operations & Deployment | `backend/flow-build-phase-7.md` |
107
+ | **Phase 8** | Setup & Final Docs | `backend/flow-build-phase-8.md` |
108
+ | **Phase 9** | Roadmap (Optional) | `backend/flow-build-phase-9.md` |
109
+ | **Phase 10** | User Stories (Optional) | `backend/flow-build-phase-10.md` |
733
110
 
734
- 1. **First:** Ask user to select Mode (A: Interactive or B: Smart Auto-Suggest)
735
- 2. **Then:**
736
- - 🆕 **New Project + Mode A:** Execute all phases sequentially, ask all questions
737
- - 🆕 **New Project + Mode B:** Ask 6 critical questions, auto-suggest the rest, show summary
738
- - 📁 **Existing Project + Mode A:** Read `flow-build-phase-0-context.md` first, then proceed with all phases
739
- - 📁 **Existing Project + Mode B:** Read `flow-build-phase-0-context.md` first, then ask remaining critical questions
740
- - 🔄 **Update Docs:** Use `/flow-docs-sync` command
741
111
  ---
742
- ## 📊 Final Summary (After Completion)
743
-
744
- **CRITICAL:** After generating all documentation, ALWAYS present a two-tier summary:
745
-
746
- ### **Tier 1: Quick Summary (1 paragraph max)**
112
+ ## 📋 Scope Selection (MVP / Production / Enterprise)
747
113
 
748
- Present a concise overview in 1-2 sentences covering:
114
+ Before starting Phase 1, ask the user to select the Project Scope.
115
+ > 📎 **Reference:** See [shared/scope-levels.md](../shared/scope-levels.md)
749
116
 
750
- - System type and framework
751
- - Database and main entities (count + examples)
752
- - Key architectural decisions
753
- - Security approach
754
- - Deployment platform
755
-
756
- **Format:**
757
-
758
- ```
759
- ---
760
- ✅ Configuration Complete - Quick Summary
761
- ---
762
- Your [System Type] backend will use [Framework] with [Database], following [Architecture] with [X] entities ([list 2-3 main ones]). Security includes [Auth Method] with [Authorization], and deployment to [Platform] with [Monitoring].
763
117
  ---
764
- ```
118
+ ## 🔄 Documentation Sync
765
119
 
766
- ### **Tier 2: Extended Report (Organized, Not Too Long)**
120
+ As your project grows, use the following to keep docs updated:
121
+ **Command:** `/flow-docs-sync`
122
+ **Logic:** Read `.ai-flow/prompts/backend/flow-docs-sync.md`.
767
123
 
768
- Present a structured report covering each phase's key decisions (3-5 bullets per phase max):
769
-
770
- ```
771
- ---
772
- 📋 Extended Configuration Report
773
124
  ---
774
- **Phase 1: Business**
775
- • System Type: [Type]
776
- • Target Users: [Who]
777
- • Core Features: [3-5 main features]
778
- • Success Metrics: [Key goals]
779
-
780
- **Phase 2: Data Architecture**
781
- • Database: [Type + Version]
782
- • ORM: [Tool]
783
- • Entities: [List main entities]
784
- • Relationships: [Key patterns]
785
-
786
- **Phase 3: System Architecture**
787
- • Framework: [Name + Version]
788
- • Language: [Name + Version]
789
- • API Style: [REST/GraphQL/etc.]
790
- • Architecture: [Pattern]
791
- • External Services: [List]
125
+ ## 🎯 After Completion
792
126
 
793
- **Phase 4: Security**
794
- Auth: [Method + token config]
795
- Authorization: [Model + roles]
796
- Password: [Policy]
797
- • Rate Limiting: [Strategy]
127
+ ALWAYS present a final summary:
128
+ 1. **Quick Summary:** 1 paragraph overview.
129
+ 2. **Extended Report:** Key decisions by phase.
130
+ 3. **Scaffolding:** Offer to initialize or commit changes.
798
131
 
799
- **Phase 5: Code Standards**
800
- • Formatter: [Tool + config]
801
- • Naming: [Conventions]
802
- • Structure: [Pattern]
803
- • Git Workflow: [Strategy]
804
-
805
- **Phase 6: Testing**
806
- • Framework: [Tool]
807
- • Coverage: [Target %]
808
- • Types: [Unit/Integration/E2E split]
809
- • CI: [Platform]
810
-
811
- **Phase 7: Operations**
812
- • Platform: [Deployment]
813
- • Containerization: [Docker/etc.]
814
- • Environments: [Dev/Staging/Prod]
815
- • Monitoring: [Tools]
816
132
  ---
817
- **Documentation Generated Successfully!**
818
-
819
- Created 17 professional documents in your project:
820
- • AGENT.md, ai-instructions.md, project-brief.md, README.md
821
- • 9 technical docs (architecture, data-model, api, etc.)
822
- • 2 specs (security, configuration)
823
- • .env.example
824
- ---
825
- Ready to commit the documentation?
826
-
827
- A) ✅ Yes, create initial commit now
828
- B) No, I'll review first and commit manually later
829
-
830
- Your choice (A): __
831
- ```
832
-
833
- **If choice A (recommended):**
834
-
835
- ```bash
836
- # Initialize git repository (if not already initialized)
837
- git init
838
-
839
- # Stage all generated documentation
840
- git add .ai-flow/
841
-
842
- # Create initial commit with documentation metadata
843
- git commit -m "docs: initial project documentation
844
-
845
- Generated by AI Flow /flow-build command:
846
- - 17 documentation files (backend)
847
- - Architecture: {{ARCHITECTURE_PATTERN}}
848
- - Tech stack: {{FRAMEWORK}}, {{DATABASE}}, {{ORM}}
849
- - Testing strategy: {{TEST_STRATEGY}}
850
- - Deployment: {{DEPLOYMENT_PLATFORM}}
851
-
852
- Ready for project scaffold with /project-scaffold"
853
- ```
854
-
855
- ```
856
- ✅ Initial commit created
857
-
858
- Commit hash: {{COMMIT_HASH}}
859
- Files tracked: 17 documentation files
860
- ---
861
- 🎯 Next Step: Initialize Project & Optional Roadmap
862
- ---
863
- Your documentation is ready! Now let's initialize your project.
864
-
865
- Continue with Phase 8?
866
-
867
- A) ✅ Yes, continue to Phase 8 (recommended) - 10-15 min
868
- → Initialize project + Generate final docs
869
- → Then option to continue to Phase 9 (roadmap) and Phase 10 (user stories)
870
-
871
- B) No, I'll review documentation first
872
-
873
- Your choice (A): __
874
- ```
875
-
876
- **If choice A:** Automatically transitions to Phase 8
877
-
878
- - Phase 8 will detect project state and offer framework initialization
879
- - Generates final documentation (business-flows, api, contributing)
880
- - Creates AGENT.md and README.md
881
- - Sets up AI tool configs
882
-
883
- **If choice B:** Show manual workflow:
884
-
885
- ```
886
- **Manual Workflow (resume anytime):**
887
-
888
- 1. Review documentation in .ai-flow/templates/
889
- 2. When ready, run Phase 8:
890
- → Read .ai-flow/prompts/backend/flow-build-phase-8.md
891
- → Detects project state, initializes framework (optional), generates final docs
892
- 3. (Optional) Continue to Phase 9: Implementation Roadmap (15-30 min)
893
- → Generates complete implementation plan with Story Points
894
- → Includes Epics, Features, Tasks, and execution order
895
- 4. (Optional) Continue to Phase 10: User Stories Generation (30-60 min)
896
- → Generates Gherkin AC, technical details, and QA test cases
897
- 5. Start implementing: /feature <feature-name>
898
- → Implements features following your architecture
899
-
900
- 💡 Tip: All phases are independent and re-executable.
901
- ---
902
- ```
903
- ---
904
- _Version: 4.1 (Phase 10 integrated - User Stories Generation with Gherkin AC)_
905
- _Last Updated: 2025-12-20_
906
- _Version: 4.0 (Phase 9 integrated - Implementation Roadmap with Story Points)_
907
- _Version: 3.0 (Unified workflow: Phase 8 integrates project setup + final docs generation)_
133
+ _Version: 4.2 (v2.1.9) (Antigravity Optimized - Modularized & Turbo-Enabled)_
134
+ _Last Updated: 2025-12-21_
908
135
  _AI Flow - Transform your idea into production-ready code in minutes_
909
-
910
-
911
-
912
-