ai-flow-dev 2.1.9 → 2.2.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 (77) hide show
  1. package/README.md +26 -29
  2. package/dist/cli.js +10 -4
  3. package/dist/cli.js.map +1 -1
  4. package/package.json +1 -1
  5. package/prompts/backend/flow-build-phase-0.md +278 -1738
  6. package/prompts/backend/flow-build-phase-1.md +19 -0
  7. package/prompts/backend/flow-build-phase-10.md +1 -0
  8. package/prompts/backend/flow-build-phase-2.md +19 -0
  9. package/prompts/backend/flow-build-phase-3.md +19 -0
  10. package/prompts/backend/flow-build-phase-4.md +19 -0
  11. package/prompts/backend/flow-build-phase-5.md +19 -0
  12. package/prompts/backend/flow-build-phase-6.md +19 -0
  13. package/prompts/backend/flow-build-phase-7.md +19 -0
  14. package/prompts/backend/flow-build-phase-8.md +6 -7
  15. package/prompts/backend/flow-build-phase-9.md +15 -0
  16. package/prompts/backend/flow-build.md +59 -836
  17. package/prompts/backend/flow-check-review.md +20 -0
  18. package/prompts/backend/flow-check-test.md +14 -0
  19. package/prompts/backend/flow-check.md +65 -0
  20. package/prompts/backend/flow-commit.md +51 -0
  21. package/prompts/backend/flow-docs-sync.md +53 -53
  22. package/prompts/backend/flow-work-feature.md +42 -0
  23. package/prompts/backend/flow-work-fix.md +33 -0
  24. package/prompts/backend/flow-work-refactor.md +32 -0
  25. package/prompts/backend/flow-work-resume.md +32 -0
  26. package/prompts/backend/flow-work.md +127 -0
  27. package/prompts/frontend/flow-build-phase-0.md +323 -426
  28. package/prompts/frontend/flow-build-phase-1.md +433 -404
  29. package/prompts/frontend/flow-build-phase-10.md +33 -0
  30. package/prompts/frontend/flow-build-phase-2.md +508 -872
  31. package/prompts/frontend/flow-build-phase-3.md +629 -562
  32. package/prompts/frontend/flow-build-phase-4.md +438 -382
  33. package/prompts/frontend/flow-build-phase-5.md +559 -362
  34. package/prompts/frontend/flow-build-phase-6.md +383 -452
  35. package/prompts/frontend/flow-build-phase-7.md +818 -392
  36. package/prompts/frontend/flow-build-phase-8.md +27 -16
  37. package/prompts/frontend/flow-build-phase-9.md +94 -0
  38. package/prompts/frontend/flow-build.md +68 -414
  39. package/prompts/frontend/flow-check-review.md +20 -0
  40. package/prompts/frontend/flow-check-test.md +14 -0
  41. package/prompts/frontend/flow-check.md +65 -0
  42. package/prompts/frontend/flow-commit.md +51 -0
  43. package/prompts/frontend/flow-docs-sync.md +36 -34
  44. package/prompts/frontend/flow-work-feature.md +42 -0
  45. package/prompts/frontend/flow-work-fix.md +33 -0
  46. package/prompts/frontend/flow-work-refactor.md +32 -0
  47. package/prompts/frontend/flow-work-resume.md +32 -0
  48. package/prompts/frontend/flow-work.md +127 -0
  49. package/prompts/mobile/flow-build-phase-0.md +335 -319
  50. package/prompts/mobile/flow-build-phase-1.md +438 -493
  51. package/prompts/mobile/flow-build-phase-10.md +32 -0
  52. package/prompts/mobile/flow-build-phase-2.md +458 -464
  53. package/prompts/mobile/flow-build-phase-3.md +613 -487
  54. package/prompts/mobile/flow-build-phase-4.md +439 -258
  55. package/prompts/mobile/flow-build-phase-5.md +582 -250
  56. package/prompts/mobile/flow-build-phase-6.md +389 -359
  57. package/prompts/mobile/flow-build-phase-7.md +871 -285
  58. package/prompts/mobile/flow-build-phase-8.md +27 -16
  59. package/prompts/mobile/flow-build-phase-9.md +90 -0
  60. package/prompts/mobile/flow-build.md +67 -426
  61. package/prompts/mobile/flow-check-review.md +20 -0
  62. package/prompts/mobile/flow-check-test.md +14 -0
  63. package/prompts/mobile/flow-check.md +65 -0
  64. package/prompts/mobile/flow-commit.md +51 -0
  65. package/prompts/mobile/flow-docs-sync.md +37 -40
  66. package/prompts/mobile/flow-work-feature.md +42 -0
  67. package/prompts/mobile/flow-work-fix.md +33 -0
  68. package/prompts/mobile/flow-work-refactor.md +32 -0
  69. package/prompts/mobile/flow-work-resume.md +32 -0
  70. package/prompts/mobile/flow-work.md +127 -0
  71. package/prompts/shared/smart-skip-preflight.md +214 -0
  72. package/prompts/backend/flow-dev-commit.md +0 -829
  73. package/prompts/backend/flow-dev-feature.md +0 -1948
  74. package/prompts/backend/flow-dev-fix.md +0 -952
  75. package/prompts/backend/flow-dev-refactor.md +0 -690
  76. package/prompts/backend/flow-dev-review.md +0 -372
  77. package/prompts/backend/flow-dev-work.md +0 -1081
@@ -0,0 +1,51 @@
1
+ ---
2
+ description: Conventional Commits Automation
3
+ ---
4
+
5
+ # AI Flow - Commit Automation
6
+
7
+ **YOU ARE AN EXPERT GIT WORKFLOW SPECIALIST.**
8
+
9
+ Your mission is to analyze changes, group them intelligently, and create atomic commits following Conventional Commits standard when the user executes `/flow-commit`.
10
+
11
+ ---
12
+ ## Command: `/flow-commit`
13
+
14
+ ### Objective
15
+ Automate commit creation with:
16
+ - **Intelligent grouping** by functional relationship.
17
+ - **Conventional Commits** compliance (type, scope, description).
18
+ - **Atomic commits** (one logical change per commit).
19
+
20
+ ---
21
+ ## Workflow: 4 Steps
22
+
23
+ ### Step 1: Detect Changes
24
+ - Modified files (unstaged/staged).
25
+ - **Untracked files** (`git status --porcelain`).
26
+ - Deleted files.
27
+
28
+ ### Step 2: Intelligent Grouping
29
+ Group files by:
30
+ - **Feature Complete**: Entity + Service + Controller + Tests + Docs.
31
+ - **Refactoring**: Helper + Tests + Usages.
32
+ - **Configuration**: Docker, Env, CI/CD.
33
+ - **Independent Tests/Docs**.
34
+
35
+ ### Step 3: Create Commits
36
+ 1. Generate Conventional Commit message.
37
+ 2. `git add [files] && git commit -m "[message]"`.
38
+ 3. **Wait for user confirmation.**
39
+
40
+ ### Step 4: Summary & Push
41
+ - Show `git log` of new commits.
42
+ - Suggest `git push origin [branch]`.
43
+
44
+ ---
45
+ ## Integration with `status.json`
46
+ - Update `git.commits` array.
47
+ - Set `git.uncommittedChanges: false` when done.
48
+ - Update `finalChecklist.committed: true`.
49
+
50
+ ---
51
+ **BEGIN EXECUTION when user runs `/flow-commit`**
@@ -18,31 +18,33 @@ Detect changes in the mobile codebase compared to the last documented state (sto
18
18
 
19
19
  ### Step 1: Check for Analysis File
20
20
 
21
+ // turbo
22
+ ```bash
23
+ cat .ai-flow/cache/docs-analysis.json
21
24
  ```
22
- First, check if `.ai-flow/cache/docs-analysis.json` exists:
23
25
 
24
26
  - ✅ If exists → Proceed to Step 2 (Compare Changes)
25
27
  - ❌ If NOT exists → Execute full Phase 0 analysis first:
26
- - Run complete mobile code analysis (as described in Phase 0)
28
+ - Run complete mobile code analysis (Project Discovery)
27
29
  - Create `.ai-flow/cache/docs-analysis.json` with current state
28
30
  - Then proceed to Step 2
29
- ```
30
31
 
31
32
  ### Step 2: Detect Changes
32
33
 
33
34
  **Reuse Phase 0 Analysis Logic:**
34
35
 
35
36
  1. **Perform Current Code Analysis:**
36
-
37
- - Execute the same analysis as Phase 0 (mobile/flow-build-phase-0-context.md):
38
- - File structure analysis
39
- - Screen and component detection
40
- - Navigation pattern detection
41
- - State management pattern detection
42
- - Permission detection (iOS Info.plist, Android AndroidManifest.xml)
43
- - Native module detection
44
- - Build configuration analysis
45
- - Dependency analysis
37
+ - Execute project-wide discovery using cross-platform commands:
38
+ // turbo
39
+ ```bash
40
+ ls -R . --exclude-standard
41
+ ```
42
+ - Analyze current state for:
43
+ - View structures (Screens, Components, Layouts)
44
+ - Navigation hierarchies and routing patterns
45
+ - State management and data flow (Stores, Providers, Hooks)
46
+ - Platform-specific manifestations (Permissions, Native bridges, Config files)
47
+ - Manifest changes (build.gradle, Podfile, pubspec.yaml, package.json)
46
48
  - Generate current state snapshot
47
49
 
48
50
  2. **Compare with Previous State:**
@@ -50,15 +52,12 @@ First, check if `.ai-flow/cache/docs-analysis.json` exists:
50
52
  - Load `.ai-flow/cache/docs-analysis.json`
51
53
  - Compare current state vs previous state
52
54
  - Detect changes in:
53
- - **Screens:** New, modified, or deleted screens
54
- - **Navigation:** New routes, navigation pattern changes
55
- - **State Management:** New stores, hooks, or state patterns
56
- - **Permissions:** New permissions requested
57
- - **Native Features:** New native modules or integrations
58
- - **Dependencies:** New libraries, updated versions
59
- - **Architecture:** New modules, changed patterns
60
- - **Build Configuration:** Changes in build.gradle, Podfile, app.json
61
- - **Configuration:** New environment variables, external services
55
+ - **Interfaces:** New, modified, or deleted "entry points" (Screens, Routes)
56
+ - **State Logic:** New, modified, or deleted state containers/logic
57
+ - **Capabilities:** New permissions or native feature integrations
58
+ - **Dependencies:** Manifest changes (version bumps, new packages)
59
+ - **Architecture:** Structural changes (new modules, moved folders)
60
+ - **Configuration:** New environment keys or build settings
62
61
 
63
62
  3. **Generate Change Report:**
64
63
  - Categorize changes by type
@@ -221,35 +220,33 @@ Update cancelled. Run `/flow-docs-sync` when you're ready to update the document
221
220
  ---
222
221
  ## Change Detection Rules
223
222
 
224
- ### Screens Detection
223
+ ### View & Interface Detection (Agnostic)
225
224
 
226
- **What triggers `docs/navigation.md` update:**
225
+ **What triggers document update (e.g., `docs/navigation.md`):**
227
226
 
228
- - New screen files (`.tsx`, `.jsx`, `.dart`, `.swift`, `.kt`)
229
- - New screen directories (`screens/`, `pages/`)
230
- - Modified navigation structure
231
- - Deleted screens
227
+ - New view markers (e.g., Screen definitions, route mappings, or public component exports)
228
+ - Modified navigation paths, hierarchies, or routing logic
229
+ - Deleted views or screens
232
230
 
233
231
  **How to update:**
234
232
 
235
- - Add new screens following existing navigation conventions from Phase 2
236
- - Use same format, navigation patterns as existing screens
237
- - Maintain all existing screens unchanged
233
+ - Add new views following the established patterns in the project
234
+ - Update navigation diagrams (Mermaid) to reflect new hierarchies
235
+ - Maintain existing documentation for unchanged segments
238
236
 
239
- ### Permissions Detection
237
+ ### Capabilities & Native Detection (Agnostic)
240
238
 
241
- **What triggers `docs/permissions.md` update:**
239
+ **What triggers document update (e.g., `docs/permissions.md`, `docs/native-features.md`):**
242
240
 
243
- - New permissions in `Info.plist` (iOS)
244
- - New permissions in `AndroidManifest.xml` (Android)
245
- - Modified permission descriptions
246
- - Deleted permissions
241
+ - New platform capabilities requested (e.g., Info.plist keys, AndroidManifest permissions, or native package declarations)
242
+ - New native bridges or modules detected in codebase
243
+ - Modified permission usage or descriptions
247
244
 
248
245
  **How to update:**
249
246
 
250
- - Add new permissions to permissions documentation
251
- - Update permission descriptions if changed
252
- - Maintain all existing permissions
247
+ - Document new capabilities and their usage rationale
248
+ - Update native integration guides if patterns changed
249
+ - Maintain existing documentation for stable features
253
250
 
254
251
  ### Native Features Detection
255
252
 
@@ -0,0 +1,42 @@
1
+ ---
2
+ description: Internal logic for Feature implementation within flow-work
3
+ ---
4
+
5
+ # AI Flow - Feature Logic
6
+
7
+ This file contains the detailed execution logic for implementing new features, imported by `@flow-work.md`.
8
+
9
+ ---
10
+ ## 🚀 Feature Implementation Flow
11
+
12
+ ### 1. Specification (auto-skip if User Story)
13
+ - Extract requirements from User Story or Roadmap.
14
+ - If interactive, ask clarification questions (Multiple Choice).
15
+ - Save to `specs/ai-flow/work/[feature]/spec.md`.
16
+
17
+ ### 2. Technical Planning
18
+ - Analyze codebase for patterns.
19
+ - Generate `plan.md` with Fibonacci estimation.
20
+ - Organize tasks into layers (Data, Logic, API, Test, Docs).
21
+ - **User Confirmation Required.**
22
+
23
+ ### 3. Progressive Implementation
24
+ Choose mode:
25
+ - **Auto**: Complete all tasks without pausing.
26
+ - **Phase-by-phase**: Pause and validate after each phase.
27
+ - **Task-by-task**: Pause after each task.
28
+
29
+ ### 4. Definition of Done (DoD)
30
+ - If HU mode: Validate against Gherkin scenarios.
31
+ - Run tests and linting.
32
+ - Perform security check.
33
+
34
+ ---
35
+ ## 🌿 Git Branching Strategy
36
+ - Generate slug from name.
37
+ - Execute `git checkout -b feature/[slug]`.
38
+ - Maintain `status.json` with commit history.
39
+
40
+ ---
41
+ ## 📦 status.json Persistence
42
+ Ensure `progress`, `git`, and `metadata` sections are always updated.
@@ -0,0 +1,33 @@
1
+ ---
2
+ description: Internal logic for Bug Fixes within flow-work
3
+ ---
4
+
5
+ # AI Flow - Fix Logic
6
+
7
+ This file contains the detailed execution logic for bug fixes, imported by `@flow-work.md`.
8
+
9
+ ---
10
+ ## 🔧 Bug Fix Workflow
11
+
12
+ ### 1. Classification
13
+ - **QUICK**: 1 file, obvious cause (typo, null check).
14
+ - **COMPLEX**: Multiple files, investigation needed.
15
+
16
+ ### 2. Deep Analysis (Complex Fix)
17
+ - Create work directory.
18
+ - Document root cause in `analysis.md`.
19
+ - Map side effects.
20
+
21
+ ### 3. Implementation
22
+ - **Test-First Approach**: Add a failing test case that reproduces the bug before fixing it.
23
+ - Apply the fix.
24
+ - Verify tests pass.
25
+
26
+ ---
27
+ ## 🌿 Git Branching Strategy
28
+ - **QUICK**: Usually work on current branch.
29
+ - **COMPLEX**: Execute `git checkout -b fix/[slug]`.
30
+
31
+ ---
32
+ ## 📦 status.json Persistence
33
+ Track root cause details and verification test status.
@@ -0,0 +1,32 @@
1
+ ---
2
+ description: Internal logic for Refactor implementation within flow-work
3
+ ---
4
+
5
+ # AI Flow - Refactor Logic
6
+
7
+ This file contains the detailed execution logic for code refactoring, imported by `@flow-work.md`.
8
+
9
+ ---
10
+ ## 🔄 Refactoring Workflow
11
+
12
+ ### 1. Scope Identification
13
+ - Map affected files and dependencies.
14
+ - Confirm no behavior change is expected.
15
+ - Validate against architecture patterns.
16
+
17
+ ### 2. Implementation Strategy
18
+ - Use `plan.md` to map extraction/renaming/moving steps.
19
+ - Set "No behavior change" as the primary constraint.
20
+
21
+ ### 3. Execution & Safety
22
+ - Update imports and references across the codebase.
23
+ - **Critical**: Existing tests must pass without modification (unless test itself is refactored).
24
+ - Run `/flow-check` to verify no regressions.
25
+
26
+ ---
27
+ ## 🌿 Git Branching Strategy
28
+ - Execute `git checkout -b refactor/[slug]`.
29
+
30
+ ---
31
+ ## 📦 status.json Persistence
32
+ Track `percentage` of updated occurrences and updated file paths.
@@ -0,0 +1,32 @@
1
+ ---
2
+ description: Internal logic for Resuming work within flow-work
3
+ ---
4
+
5
+ # AI Flow - Resume Logic
6
+
7
+ This file contains the logic for detecting and resuming paused work items, imported by `@flow-work.md`.
8
+
9
+ ---
10
+ ## ⏸️ Resume Workflow
11
+
12
+ ### 1. Work Detection
13
+ - Scan `specs/ai-flow/work/` for any directories.
14
+ - Group by type and last updated timestamp.
15
+
16
+ ### 2. Selection Menu
17
+ - Show active tasks with percentage and current branch.
18
+ - Identify current Git branch and match with work items (⭐⭐ marker).
19
+
20
+ ### 3. Context Restoration
21
+ - Load `spec.md`, `plan.md`, `task.md`, and `status.json`.
22
+ - Verify Git branch:
23
+ - If mismatch: Prompt to switch to `git.branchName`.
24
+ - Identify the first incomplete task in `task.md`.
25
+
26
+ ### 4. Implementation Continuation
27
+ - Resume with the previously saved `implementationMode`.
28
+ - Continue execution from where it was paused.
29
+
30
+ ---
31
+ ## 📦 status.json Persistence
32
+ Update `timestamps.lastUpdated` upon resuming.
@@ -0,0 +1,127 @@
1
+ ---
2
+ description: Central Orchestrator for Feature, Refactor, and Fix workflows
3
+ ---
4
+
5
+ # AI Flow - Unified Work Orchestrator
6
+
7
+ **YOU ARE AN EXPERT SOFTWARE ARCHITECT AND WORKFLOW COORDINATOR.**
8
+
9
+ Your mission is to orchestrate development tasks through an interactive workflow when the user executes `/flow-work`.
10
+
11
+ ---
12
+ ## Command: `/flow-work`
13
+
14
+ ### Objective
15
+ Provide a single, intelligent entry point for all development work (New Features, Refactorings, and Bug Fixes) with automatic context detection and interactive planning.
16
+
17
+ ### Usage Modes
18
+ - **`/flow-work`** → Resume paused work (if exists) or Interactive mode.
19
+ - **`/flow-work [description]`** → Semantic detection (Feature, Refactor, or Fix).
20
+ - **`/flow-work HU-XXX-XXX`** → Implement specific User Story.
21
+ - **`/flow-work [Feature Name]`** → Implement feature from roadmap.md.
22
+
23
+ ---
24
+ ## Phase 0: Detection & Strategy (Automatic)
25
+
26
+ **1. Semantic Analysis of Input:**
27
+
28
+ | Input Pattern | Mode | Source / Action |
29
+ |---------------|------|-----------------|
30
+ | `HU-\d{3}-\d{3}` | `USER_STORY` | Load from `docs/user-stories/**/HU-XXX-XXX.md` |
31
+ | `EP-\d{3}` | `EPIC` | Analyze/List User Stories for Epic `EP-XXX` |
32
+ | `T\d{3}(-T\d{3})?` | `TASKS` | Target specific task or range (e.g., `T025-T030`) |
33
+ | `HU-XXX-XXX TXXX-TXXX`| `STORY_TASKS` | Targeted tasks within a specific User Story |
34
+ | Matches `docs/roadmap.md` | `ROADMAP_FEATURE`| Extract section from `docs/roadmap.md` (Partial matches allowed) |
35
+ | "refactor", "move", "extract" | `REFACTOR` | Use `flow-work-refactor.md` |
36
+ | "fix", "bug", "error", "falla" | `FIX` | Detect complexity (Quick vs Complex) |
37
+ | "implement", "create", "new" | `FEATURE` | Use `flow-work-feature.md` |
38
+ | No arguments | `RESUME` | Search for paused work in `specs/ai-flow/work/` |
39
+
40
+ **2. Detection Logic Details:**
41
+ - **USER_STORY / EPIC**: Load metadata from `docs/user-stories/` or `docs/roadmap.md`.
42
+ - **ROADMAP_FEATURE**: Fuzzy search in `docs/roadmap.md` for titles like "User Management" or "Feature 2.2".
43
+ - **TASK RANGES**: If `T025-T030` is provided, find the parent Story or Feature in current context or roadmap.
44
+ - **SIMPLE FIX**: Affects 1 file, obvious cause, <10 lines fix. → Use `flow-work-fix.md` (Quick).
45
+ - **COMPLEX FIX**: Multi-file, architectural, performance/security. → Use `flow-work-fix.md` (Deep).
46
+
47
+ ---
48
+ ## Phase 1: Interactive Analysis
49
+
50
+ **1. Context Loading (Multi-Source):**
51
+ **CRITICAL**: Regardless of whether a `USER_STORY` ID or a `ROADMAP_FEATURE` name is provided, you MUST attempt to load context from **BOTH** sources:
52
+ - **`docs/roadmap.md`**: To understand high-level scope, epic relationships, and technical dependencies.
53
+ - **`docs/user-stories/**/HU-XXX-XXX.md`**: To get granular details (Acceptance Criteria, Gherkin Scenarios, QA cases).
54
+
55
+ **2. Interactive Questions:**
56
+ - IF both sources provide 100% clarity: Skip questions.
57
+ - IF there is missing info or ambiguity: Ask 3-5 key questions with **Multiple Choice Options** and **Defaults (marked with ⭐)**.
58
+
59
+ **Example Interaction:**
60
+ > 📝 I need to clarify some details for this feature:
61
+ > 1. What authentication provider should we use? [default: A]
62
+ > A) JWT (Local) ⭐
63
+ > B) OAuth2 (Google/GitHub)
64
+ > C) Firebase Auth
65
+ >
66
+ > 2. Should we implement audit logs for this? [default: B]
67
+ > A) Yes
68
+ > B) No ⭐
69
+
70
+ ---
71
+ ## Phase 2: Planning & Documentation
72
+
73
+ 1. **`spec.md`**: Generate/Update in `specs/ai-flow/work/[task-name]/spec.md`.
74
+ - Ask for user approval.
75
+ 2. **`plan.md`**: Generate technical approach and task list.
76
+ - Assign Feature Number (NNN).
77
+ - Story Points estimation (Fibonacci).
78
+ - Phase organization.
79
+ - Ask for user approval.
80
+ 3. **`task.md`**: Generate the checklist of tactical tasks.
81
+ 4. **`status.json`**: Initialize/Update metadata (progress, branch, validation state).
82
+
83
+ ---
84
+ ## Phase 3: Execution (Branch Creation)
85
+
86
+ **Upon confirmation to start implementation:**
87
+
88
+ 1. **Generate Branch Name**:
89
+ - `feature/[slug]`
90
+ - `refactor/[slug]`
91
+ - `fix/[slug]`
92
+ 2. **Execute**: `git checkout -b [branch-name]`.
93
+ 3. **Update `status.json`**: Record branch name and start timestamp.
94
+ 4. **Implementation**: Proceed according to the selected mode (Auto, Phase-by-phase, Task-by-task).
95
+
96
+ ---
97
+ ## Phase 4: Finalization & Archiving
98
+
99
+ **When all tasks in `task.md` are complete (✅) and validated:**
100
+
101
+ 1. **Sugerir Próximos Pasos**:
102
+ - **`/flow-check`**: Ejecutar tests y revisión de código combinada.
103
+ - **`/flow-docs-sync`**: Sincronizar la documentación técnica.
104
+ - **`/flow-commit`**: Crear commits atómicos.
105
+
106
+ 2. **Proceso de Archivado (Automático tras aprobación)**:
107
+ - Una vez el usuario confirma que el trabajo está listo para ser cerrado:
108
+ - **Mover**: `specs/ai-flow/work/[task-name]/` → `specs/ai-flow/archive/YYYY-MM/[task-name]/`.
109
+ - **Actualizar `status.json`**: Cambiar `status` a `"COMPLETED"` y registrar `timestamps.completed`.
110
+ - **Cleanup**: Mantener limpia la carpeta `work` para que `/flow-work` detecte solo tareas activas.
111
+
112
+ 3. **Resumen Final**:
113
+ - Mostrar estadísticas finales de tiempo, archivos y cobertura antes de archivar.
114
+
115
+ ---
116
+ ## Orchestration Rules
117
+
118
+ - **DRY Logic**: This file handles the high-level orchestration.
119
+ - **Delegation**:
120
+ - Detailed Feature logic → `@flow-work-feature.md`
121
+ - Detailed Refactor logic → `@flow-work-refactor.md`
122
+ - Detailed Fix logic → `@flow-work-fix.md`
123
+ - Resume logic → `@flow-work-resume.md`
124
+ - **State Persistence**: Always read/write to `specs/ai-flow/work/[name]/status.json` to maintain state across sessions.
125
+
126
+ ---
127
+ **BEGIN EXECUTION when user runs `/flow-work [args]`**
@@ -0,0 +1,214 @@
1
+ # Smart Skip Pre-Flight Check (Shared Template)
2
+
3
+ ## 🔍 Pre-Flight Check Logic
4
+
5
+ **This section is automatically included in Phases 1-7 to enable smart skip functionality.**
6
+
7
+ ### How It Works
8
+
9
+ 1. **Read audit data** from Phase 0: `.ai-flow/cache/audit-data.json`
10
+ 2. **Check consistency score** for the current phase
11
+ 3. **Execute appropriate scenario** based on score
12
+
13
+ ---
14
+
15
+ ## Execution Flow
16
+
17
+ ```javascript
18
+ // Read audit data from Phase 0
19
+ const auditData = readJSON('.ai-flow/cache/audit-data.json');
20
+ const phaseData = auditData?.phases?.[currentPhase];
21
+
22
+ if (phaseData?.exists) {
23
+ // Documentation exists, check consistency
24
+ if (phaseData.consistencyScore >= 95) {
25
+ executeScenarioA(); // SKIP
26
+ } else if (phaseData.consistencyScore >= 80) {
27
+ executeScenarioB(); // HYBRID
28
+ } else {
29
+ executeScenarioC(); // FULL
30
+ }
31
+ } else {
32
+ // No existing docs, proceed with full phase
33
+ executeScenarioC();
34
+ }
35
+ ```
36
+
37
+ ---
38
+
39
+ ## Scenario A: High Confidence (≥95%) - SKIP
40
+
41
+ **Display format:**
42
+
43
+ ```
44
+ ---
45
+ ✅ [PHASE NAME] ALREADY DOCUMENTED
46
+
47
+ File: [target-file]
48
+ Consistency: [score]%
49
+ Status: Complete documentation
50
+
51
+ Documented Information:
52
+ ✅ [Key item 1]
53
+ ✅ [Key item 2]
54
+ ✅ [Key item 3]
55
+ ...
56
+
57
+ ---
58
+
59
+ Use existing documentation? (Y/n) ⭐
60
+ > _
61
+ ```
62
+
63
+ **User Actions:**
64
+ - **Y**: Skip to next phase
65
+ - **n**: Proceed with full phase questionnaire
66
+
67
+ ---
68
+
69
+ ## Scenario B: Medium Confidence (80-94%) - HYBRID
70
+
71
+ **Display format:**
72
+
73
+ ```
74
+ ---
75
+ 📚 [PHASE NAME] PARTIALLY DOCUMENTED
76
+
77
+ File: [target-file]
78
+ Consistency: [score]%
79
+ Status: Most information present, some gaps
80
+
81
+ Documented:
82
+ ✅ [Item 1]
83
+ ✅ [Item 2]
84
+
85
+ Missing:
86
+ ❌ [Gap 1]
87
+ ❌ [Gap 2]
88
+
89
+ ---
90
+
91
+ Options:
92
+ A) Answer only [N] missing questions ⭐
93
+ B) Re-answer everything (full phase)
94
+ C) Skip entirely (use docs as-is)
95
+
96
+ > _
97
+ ```
98
+
99
+ **User Actions:**
100
+ - **A**: Ask only missing questions, merge with existing docs
101
+ - **B**: Full phase questionnaire
102
+ - **C**: Skip with warning
103
+
104
+ ---
105
+
106
+ ## Scenario C: Low Confidence (<80%) or No Docs - FULL PHASE
107
+
108
+ **Display format:**
109
+
110
+ ```
111
+ ---
112
+ ⚠️ [PHASE NAME] NEEDS DOCUMENTATION
113
+
114
+ Reason: [target-file] is outdated or missing
115
+ Consistency: [score]% (or N/A if file doesn't exist)
116
+
117
+ Issues detected:
118
+ ❌ [Issue 1]
119
+ ❌ [Issue 2]
120
+
121
+ Recommendation: Complete full phase questionnaire
122
+
123
+ Proceeding with full phase...
124
+ [Continue to first question]
125
+ ```
126
+
127
+ ---
128
+
129
+ ## Phase-Specific Configuration
130
+
131
+ Each phase references this template with specific parameters:
132
+
133
+ ### Phase 1: Discovery & Business
134
+ - **Target File**: `project-brief.md`
135
+ - **Phase Name**: "BUSINESS CONTEXT"
136
+ - **Key Items**: Project name, description, users, objectives, system type, features, scope, constraints, metrics, business flows
137
+ - **Typical Gaps**: Business objectives, success metrics, constraints
138
+
139
+ ### Phase 2: Data Architecture
140
+ - **Target File**: `docs/data-model.md`
141
+ - **Phase Name**: "DATA ARCHITECTURE"
142
+ - **Key Items**: Entities, relationships, data patterns, indexes
143
+ - **Typical Gaps**: Missing entities, undocumented relationships, missing fields
144
+
145
+ ### Phase 3: System Architecture
146
+ - **Target File**: `docs/architecture.md`
147
+ - **Phase Name**: "SYSTEM ARCHITECTURE"
148
+ - **Key Items**: Framework, architecture pattern, API style, database, caching, background jobs, integrations
149
+ - **Typical Gaps**: API versioning, rate limiting, caching strategy
150
+
151
+ ### Phase 4: Security & Authentication
152
+ - **Target File**: `specs/security.md`
153
+ - **Phase Name**: "SECURITY & AUTHENTICATION"
154
+ - **Key Items**: Auth strategy, encryption, security patterns, compliance
155
+ - **Typical Gaps**: Compliance requirements, audit logging, security policies
156
+
157
+ ### Phase 5: Code Standards
158
+ - **Target File**: `docs/code-standards.md`
159
+ - **Phase Name**: "CODE STANDARDS"
160
+ - **Key Items**: Linters, formatters, naming conventions, code review process
161
+ - **Typical Gaps**: Team-specific conventions, code review workflow
162
+
163
+ ### Phase 6: Testing Strategy
164
+ - **Target File**: `docs/testing.md`
165
+ - **Phase Name**: "TESTING STRATEGY"
166
+ - **Key Items**: Test framework, coverage targets, test types, CI/CD integration
167
+ - **Typical Gaps**: E2E strategy, load testing, performance testing
168
+
169
+ ### Phase 7: Operations & Deployment
170
+ - **Target File**: `docs/deployment.md`
171
+ - **Phase Name**: "OPERATIONS & DEPLOYMENT"
172
+ - **Key Items**: CI/CD pipeline, deployment platform, monitoring, logging
173
+ - **Typical Gaps**: Incident runbooks, disaster recovery, scaling strategy
174
+
175
+ ---
176
+
177
+ ## Usage in Phase Prompts
178
+
179
+ **In each phase prompt (1-7), add this reference:**
180
+
181
+ ```markdown
182
+ ## 🔍 Pre-Flight Check (Smart Skip Logic)
183
+
184
+ > 📎 **Reference:** See [prompts/shared/smart-skip-preflight.md](../shared/smart-skip-preflight.md) for the complete smart skip logic.
185
+
186
+ **Execute Pre-Flight Check for this phase:**
187
+
188
+ - **Phase**: [Phase Number]
189
+ - **Target File**: [file path]
190
+ - **Phase Name**: [display name]
191
+
192
+ [Proceed with appropriate scenario based on audit data]
193
+
194
+ ---
195
+
196
+ ## Phase [N] Questions (Full Mode)
197
+
198
+ [Continue with phase-specific questions...]
199
+ ```
200
+
201
+ ---
202
+
203
+ ## Benefits of This Approach
204
+
205
+ ✅ **DRY Principle**: Single source of truth for skip logic
206
+ ✅ **Easy Maintenance**: Update once, applies to all phases
207
+ ✅ **Consistency**: Same UX across all phases
208
+ ✅ **Reduced File Size**: Each phase prompt is ~100 lines shorter
209
+ ✅ **Clear Separation**: Logic vs content
210
+
211
+ ---
212
+
213
+ **Last Updated:** 2025-12-22
214
+ **Version:** 1.0