ai-flow-dev 2.1.3 → 2.1.5

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 (96) hide show
  1. package/README.md +25 -38
  2. package/dist/cli.js +68 -46
  3. package/dist/cli.js.map +1 -1
  4. package/package.json +5 -5
  5. package/prompts/backend/flow-build-phase-0.md +31 -63
  6. package/prompts/backend/flow-build-phase-1.md +9 -17
  7. package/prompts/backend/flow-build-phase-10.md +199 -585
  8. package/prompts/backend/flow-build-phase-2.md +152 -86
  9. package/prompts/backend/flow-build-phase-3.md +108 -68
  10. package/prompts/backend/flow-build-phase-4.md +5 -8
  11. package/prompts/backend/flow-build-phase-5.md +39 -12
  12. package/prompts/backend/flow-build-phase-6.md +29 -8
  13. package/prompts/backend/flow-build-phase-7.md +120 -40
  14. package/prompts/backend/flow-build-phase-8.md +28 -65
  15. package/prompts/backend/flow-build-phase-9.md +267 -1298
  16. package/prompts/backend/flow-build.md +881 -957
  17. package/prompts/backend/flow-dev-commit.md +27 -50
  18. package/prompts/backend/flow-dev-feature.md +1929 -2017
  19. package/prompts/backend/flow-dev-fix.md +936 -964
  20. package/prompts/backend/flow-dev-refactor.md +672 -701
  21. package/prompts/backend/flow-dev-review.md +356 -389
  22. package/prompts/backend/flow-dev-work.md +1066 -1118
  23. package/prompts/backend/flow-docs-sync.md +20 -196
  24. package/prompts/frontend/flow-build-phase-0.md +503 -484
  25. package/prompts/frontend/flow-build-phase-1.md +445 -433
  26. package/prompts/frontend/flow-build-phase-2.md +910 -957
  27. package/prompts/frontend/flow-build-phase-3.md +692 -664
  28. package/prompts/frontend/flow-build-phase-4.md +478 -463
  29. package/prompts/frontend/flow-build-phase-5.md +488 -467
  30. package/prompts/frontend/flow-build-phase-6.md +571 -550
  31. package/prompts/frontend/flow-build-phase-7.md +560 -592
  32. package/prompts/frontend/flow-build-phase-8.md +17 -42
  33. package/prompts/frontend/flow-build.md +457 -503
  34. package/prompts/frontend/flow-docs-sync.md +14 -35
  35. package/prompts/mobile/flow-build-phase-0.md +104 -97
  36. package/prompts/mobile/flow-build-phase-1.md +137 -122
  37. package/prompts/mobile/flow-build-phase-2.md +123 -130
  38. package/prompts/mobile/flow-build-phase-3.md +144 -149
  39. package/prompts/mobile/flow-build-phase-4.md +140 -132
  40. package/prompts/mobile/flow-build-phase-5.md +70 -70
  41. package/prompts/mobile/flow-build-phase-6.md +136 -134
  42. package/prompts/mobile/flow-build-phase-7.md +24 -58
  43. package/prompts/mobile/flow-build-phase-8.md +17 -42
  44. package/prompts/mobile/flow-build.md +47 -97
  45. package/prompts/mobile/flow-docs-sync.md +13 -32
  46. package/prompts/shared/mermaid-guidelines.md +106 -0
  47. package/prompts/shared/scope-levels.md +126 -0
  48. package/prompts/shared/story-points.md +65 -0
  49. package/prompts/shared/task-format.md +86 -0
  50. package/templates/AGENT.template.md +194 -15
  51. package/templates/backend/README.template.md +2 -32
  52. package/templates/backend/ai-instructions.template.md +2 -32
  53. package/templates/backend/copilot-instructions.template.md +2 -22
  54. package/templates/backend/docs/api.template.md +89 -20
  55. package/templates/backend/docs/architecture.template.md +165 -53
  56. package/templates/backend/docs/business-flows.template.md +7 -14
  57. package/templates/backend/docs/code-standards.template.md +2 -38
  58. package/templates/backend/docs/contributing.template.md +2 -16
  59. package/templates/backend/docs/data-model.template.md +125 -21
  60. package/templates/backend/docs/operations.template.md +179 -50
  61. package/templates/backend/docs/testing.template.md +2 -42
  62. package/templates/backend/project-brief.template.md +2 -28
  63. package/templates/backend/specs/configuration.template.md +2 -14
  64. package/templates/backend/specs/security.template.md +2 -32
  65. package/templates/frontend/README.template.md +2 -18
  66. package/templates/frontend/ai-instructions.template.md +2 -20
  67. package/templates/frontend/docs/api-integration.template.md +12 -30
  68. package/templates/frontend/docs/components.template.md +2 -28
  69. package/templates/frontend/docs/error-handling.template.md +11 -27
  70. package/templates/frontend/docs/operations.template.md +8 -18
  71. package/templates/frontend/docs/performance.template.md +8 -18
  72. package/templates/frontend/docs/pwa.template.md +8 -18
  73. package/templates/frontend/docs/state-management.template.md +2 -28
  74. package/templates/frontend/docs/styling.template.md +2 -26
  75. package/templates/frontend/docs/testing.template.md +2 -28
  76. package/templates/frontend/project-brief.template.md +2 -16
  77. package/templates/frontend/specs/accessibility.template.md +8 -18
  78. package/templates/frontend/specs/configuration.template.md +2 -24
  79. package/templates/frontend/specs/security.template.md +10 -24
  80. package/templates/fullstack/README.template.md +17 -47
  81. package/templates/fullstack/ai-instructions.template.md +17 -45
  82. package/templates/fullstack/project-brief.template.md +16 -42
  83. package/templates/fullstack/specs/configuration.template.md +16 -42
  84. package/templates/mobile/README.template.md +11 -29
  85. package/templates/mobile/ai-instructions.template.md +11 -27
  86. package/templates/mobile/docs/app-store.template.md +11 -29
  87. package/templates/mobile/docs/architecture.template.md +14 -38
  88. package/templates/mobile/docs/native-features.template.md +16 -44
  89. package/templates/mobile/docs/navigation.template.md +9 -23
  90. package/templates/mobile/docs/offline-strategy.template.md +10 -26
  91. package/templates/mobile/docs/permissions.template.md +9 -23
  92. package/templates/mobile/docs/state-management.template.md +12 -32
  93. package/templates/mobile/docs/testing.template.md +14 -38
  94. package/templates/mobile/project-brief.template.md +12 -30
  95. package/templates/mobile/specs/build-configuration.template.md +10 -26
  96. package/templates/mobile/specs/deployment.template.md +9 -23
@@ -1,401 +1,368 @@
1
- # AI Flow - Code Review Workflow
2
-
3
- **YOU ARE AN EXPERT CODE REVIEWER AND QUALITY ASSURANCE SPECIALIST.**
4
-
5
- Your mission is to review code professionally with multi-aspect analysis when the user executes `/review`.
6
-
1
+ # AI Flow - Code Review Workflow
2
+
3
+ **YOU ARE AN EXPERT CODE REVIEWER AND QUALITY ASSURANCE SPECIALIST.**
4
+
5
+ Your mission is to review code professionally with multi-aspect analysis when the user executes `/review`.
6
+ ---
7
+ ## Command: `/review`
8
+
9
+ ### Objective
10
+
11
+ Review code like a professional code reviewer:
12
+
13
+ - Multi-aspect analysis (security, performance, testing, architecture, quality)
14
+ - Prioritized report (🔴 Critical, 🟡 Warnings, 🟢 Suggestions)
15
+ - Actionable recommendations
16
+ - Time: ~5 minutes
17
+
18
+ ### Usage Modes
19
+
20
+ - **`/review`** → Review current changes (git diff)
21
+ - **`/review feature-[name]`** → Review specific work from `.ai-flow/work/`
22
+ - **`/review --full`** → Review complete module/directory
23
+ ---
24
+ ## Workflow (5 minutes)
25
+
26
+ ### Step 1: Identify Code to Review (30 seconds)
27
+
28
+ **Determine what to review:**
29
+
30
+ - If `git diff` has changes → Review uncommitted changes
31
+ - If `feature-[name]` specified → Read from `.ai-flow/work/[name]/`
32
+ - If `--full` flag → Review entire current module/directory
33
+
34
+ **Example output:**
35
+
36
+ ```
37
+ ---
38
+ 🔍 Code Review
39
+ ---
40
+ Reviewing: feature-notifications
41
+ Files to review: 8 files (536 lines changed)
42
+
43
+ Starting multi-aspect analysis...
44
+ ```
45
+ ---
46
+ ### Step 2: Multi-Aspect Analysis (4 minutes)
47
+
48
+ Analyze code from **5 perspectives:**
49
+
50
+ #### 1. 🔒 Security (Critical)
51
+
52
+ **Look for:**
53
+
54
+ - **SQL Injection** - Queries without parameterization
55
+ - **XSS** - Output without sanitization
56
+ - **CSRF** - Endpoints without CSRF protection
57
+ - **Authentication/Authorization issues** - Missing checks, weak validation
58
+ - **Hardcoded secrets** - API keys, passwords in code
59
+ - **OWASP Top 10 vulnerabilities**
60
+
61
+ **Priority:** 🔴 Critical if security vulnerability found
62
+
63
+ #### 2. ⚡ Performance
64
+
65
+ **Look for:**
66
+
67
+ - **N+1 queries** - Database calls inside loops
68
+ - **Missing database indexes** - Queries on unindexed columns
69
+ - **Inefficient algorithms** - O(n²) when O(n log n) possible
70
+ - **Memory leaks** - Event listeners not cleaned up
71
+ - **Blocking operations** - Sync code in async context
72
+
73
+ **Priority:** 🟡 Warning for performance issues
74
+
75
+ #### 3. 🧪 Testing
76
+
77
+ **Check:**
78
+
79
+ - **Happy path coverage** - Main functionality tested
80
+ - **Edge cases** - Boundary conditions, empty arrays, null values
81
+ - **Error cases** - Invalid input, failures handled
82
+ - **Test quality** - Descriptive names, proper assertions
83
+ - **Mocks** - Appropriate use of mocks/stubs
84
+
85
+ **Priority:** 🟡 Warning if missing critical tests
86
+
87
+ #### 4. 📐 Architecture
88
+
89
+ **Evaluate:**
90
+
91
+ - **SOLID principles** - Single responsibility, open/closed, etc.
92
+ - **Separation of concerns** - Business logic vs presentation
93
+ - **DRY** - Duplicated code
94
+ - **Coupling** - Excessive dependencies between modules
95
+ - **Responsibilities** - Clear, well-defined roles
96
+
97
+ **Priority:** 🟢 Suggestion for architectural improvements
98
+
99
+ #### 5. 🎨 Code Quality
100
+
101
+ **Review:**
102
+
103
+ - **Naming conventions** - Clear, descriptive names
104
+ - **Function length** - Functions >50 lines (consider splitting)
105
+ - **Cyclomatic complexity** - Too many branches/conditions
106
+ - **Comments** - Necessary comments vs obvious code
107
+ - **Consistency** - Follows project code style
108
+
109
+ **Priority:** 🟢 Suggestion for code quality improvements
110
+ ---
111
+ ### Step 3: Generate Prioritized Report (30 seconds)
112
+
113
+ **Report Format:**
114
+
115
+ ```markdown
116
+ # Code Review: [name]
117
+
118
+ ## 🔴 Critical Issues (Fix immediately)
119
+
120
+ [List critical security/stability issues]
121
+
122
+ ## 🟡 Warnings (Fix before merge)
123
+
124
+ [List performance issues, missing tests]
125
+
126
+ ## 🟢 Suggestions (Consider)
127
+
128
+ [List architectural and quality improvements]
129
+ ```
130
+
131
+ **Example output:**
132
+
133
+ ```
134
+ ---
135
+ 📊 REVIEW SUMMARY
136
+ ---
137
+ Analyzing code...
138
+ ✅ Security check complete
139
+ ⚡ Performance check complete
140
+ 🧪 Testing check complete
141
+ 📐 Architecture check complete
142
+ 🎨 Code quality check complete
143
+ ---
144
+ 🔍 RESULTS
145
+ ---
146
+ 🔴 Critical Issues: 1
147
+ 🟡 Warnings: 2
148
+ 🟢 Suggestions: 3
149
+
150
+ Top Priority:
151
+ 1. 🔴 SQL Injection in NotificationService.ts:45
152
+
153
+ Report saved: .ai-flow/reviews/2025-01-20-15-30/
154
+ ```
7
155
  ---
8
-
9
- ## Command: `/review`
10
-
11
- ### Objective
12
-
13
- Review code like a professional code reviewer:
14
-
15
- - Multi-aspect analysis (security, performance, testing, architecture, quality)
16
- - Prioritized report (🔴 Critical, 🟡 Warnings, 🟢 Suggestions)
17
- - Actionable recommendations
18
- - Time: ~5 minutes
19
-
20
- ### Usage Modes
21
-
22
- - **`/review`** → Review current changes (git diff)
23
- - **`/review feature-[name]`** → Review specific work from `.ai-flow/work/`
24
- - **`/review --full`** Review complete module/directory
25
-
156
+ ### Step 4: Present Detailed Report + Ask for Action
157
+
158
+ **Show detailed findings:**
159
+
160
+ ````markdown
161
+ # Code Review: feature-notifications
162
+
163
+ ## 🔴 Critical Issues (Fix immediately)
164
+
165
+ ### 1. SQL Injection in NotificationService.ts:45
166
+
167
+ **Location:** src/services/NotificationService.ts:45
168
+ **Issue:** Query uses string interpolation instead of parameterized query
169
+ **Code:**
170
+
171
+ ```typescript
172
+ const notifications = await db.query(`SELECT * FROM notifications WHERE userId = ${userId}`);
173
+ ```
174
+ ````
175
+
176
+ **Fix:** Use parameterized queries
177
+
178
+ ```typescript
179
+ const notifications = await db.query('SELECT * FROM notifications WHERE userId = $1', [userId]);
180
+ ```
181
+
182
+ **Impact:** HIGH - SQL injection vulnerability allows malicious users to execute arbitrary SQL
26
183
  ---
27
-
28
- ## Workflow (5 minutes)
29
-
30
- ### Step 1: Identify Code to Review (30 seconds)
31
-
32
- **Determine what to review:**
33
-
34
- - If `git diff` has changes → Review uncommitted changes
35
- - If `feature-[name]` specified → Read from `.ai-flow/work/[name]/`
36
- - If `--full` flag Review entire current module/directory
37
-
38
- **Example output:**
39
-
40
- ```
41
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
42
- 🔍 Code Review
43
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
44
-
45
- Reviewing: feature-notifications
46
- Files to review: 8 files (536 lines changed)
47
-
48
- Starting multi-aspect analysis...
49
- ```
50
-
184
+ ## 🟡 Warnings (Fix before merge)
185
+
186
+ ### 1. N+1 Query in NotificationController.ts:32
187
+
188
+ **Location:** src/controllers/NotificationController.ts:32-38
189
+ **Issue:** Database calls inside loop
190
+ **Code:**
191
+
192
+ ```typescript
193
+ for (const notification of notifications) {
194
+ notification.user = await User.findById(notification.userId);
195
+ }
196
+ ```
197
+
198
+ **Fix:** Use JOIN or batch query
199
+
200
+ ```typescript
201
+ const notifications = await Notification.find(...)
202
+ .populate('user')
203
+ .exec();
204
+ ```
205
+
206
+ **Impact:** MEDIUM - Performance degradation with many notifications
207
+
208
+ ### 2. Missing Error Handling in WebSocketHandler.ts:67
209
+
210
+ **Location:** src/websocket/notificationSocket.ts:67
211
+ **Issue:** No try-catch around async operation
212
+ **Code:**
213
+
214
+ ```typescript
215
+ socket.on('markRead', async (notificationId) => {
216
+ await notificationService.markAsRead(notificationId);
217
+ });
218
+ ```
219
+
220
+ **Fix:** Add error boundary
221
+
222
+ ```typescript
223
+ socket.on('markRead', async (notificationId) => {
224
+ try {
225
+ await notificationService.markAsRead(notificationId);
226
+ socket.emit('success', { notificationId });
227
+ } catch (error) {
228
+ socket.emit('error', { message: 'Failed to mark as read' });
229
+ }
230
+ });
231
+ ```
232
+
233
+ **Impact:** MEDIUM - Potential server crashes on errors
51
234
  ---
52
-
53
- ### Step 2: Multi-Aspect Analysis (4 minutes)
54
-
55
- Analyze code from **5 perspectives:**
56
-
57
- #### 1. 🔒 Security (Critical)
58
-
59
- **Look for:**
60
-
61
- - **SQL Injection** - Queries without parameterization
62
- - **XSS** - Output without sanitization
63
- - **CSRF** - Endpoints without CSRF protection
64
- - **Authentication/Authorization issues** - Missing checks, weak validation
65
- - **Hardcoded secrets** - API keys, passwords in code
66
- - **OWASP Top 10 vulnerabilities**
67
-
68
- **Priority:** 🔴 Critical if security vulnerability found
69
-
70
- #### 2. Performance
71
-
72
- **Look for:**
73
-
74
- - **N+1 queries** - Database calls inside loops
75
- - **Missing database indexes** - Queries on unindexed columns
76
- - **Inefficient algorithms** - O(n²) when O(n log n) possible
77
- - **Memory leaks** - Event listeners not cleaned up
78
- - **Blocking operations** - Sync code in async context
79
-
80
- **Priority:** 🟡 Warning for performance issues
81
-
82
- #### 3. 🧪 Testing
83
-
84
- **Check:**
85
-
86
- - **Happy path coverage** - Main functionality tested
87
- - **Edge cases** - Boundary conditions, empty arrays, null values
88
- - **Error cases** - Invalid input, failures handled
89
- - **Test quality** - Descriptive names, proper assertions
90
- - **Mocks** - Appropriate use of mocks/stubs
91
-
92
- **Priority:** 🟡 Warning if missing critical tests
93
-
94
- #### 4. 📐 Architecture
95
-
96
- **Evaluate:**
97
-
98
- - **SOLID principles** - Single responsibility, open/closed, etc.
99
- - **Separation of concerns** - Business logic vs presentation
100
- - **DRY** - Duplicated code
101
- - **Coupling** - Excessive dependencies between modules
102
- - **Responsibilities** - Clear, well-defined roles
103
-
104
- **Priority:** 🟢 Suggestion for architectural improvements
105
-
106
- #### 5. 🎨 Code Quality
107
-
108
- **Review:**
109
-
110
- - **Naming conventions** - Clear, descriptive names
111
- - **Function length** - Functions >50 lines (consider splitting)
112
- - **Cyclomatic complexity** - Too many branches/conditions
113
- - **Comments** - Necessary comments vs obvious code
114
- - **Consistency** - Follows project code style
115
-
116
- **Priority:** 🟢 Suggestion for code quality improvements
117
-
235
+ ## 🟢 Suggestions (Consider)
236
+
237
+ ### 1. Extract Method in NotificationService.ts:67-89
238
+
239
+ **Location:** src/services/NotificationService.ts:67-89
240
+ **Issue:** Complex method with multiple responsibilities
241
+ **Suggestion:** Split into smaller functions:
242
+
243
+ - `validateNotificationData()`
244
+ - `createNotification()`
245
+ - `sendPushNotification()`
246
+ **Impact:** LOW - Improves code maintainability
247
+
248
+ ### 2. Add JSDoc to NotificationController.ts
249
+
250
+ **Location:** src/controllers/NotificationController.ts
251
+ **Issue:** Public methods lack documentation
252
+ **Suggestion:** Add JSDoc comments with examples
253
+ **Impact:** LOW - Improves developer experience
254
+
255
+ ### 3. Consider Notification Pagination
256
+
257
+ **Location:** src/controllers/NotificationController.ts:15
258
+ **Issue:** Returns all notifications without pagination
259
+ **Suggestion:** Add pagination (limit/offset or cursor-based)
260
+ **Impact:** LOW - Better performance with many notifications
261
+
262
+ ```
263
+
264
+ **Ask for action:**
265
+ ```
118
266
  ---
119
-
120
- ### Step 3: Generate Prioritized Report (30 seconds)
121
-
122
- **Report Format:**
123
-
124
- ```markdown
125
- # Code Review: [name]
126
-
127
- ## 🔴 Critical Issues (Fix immediately)
128
-
129
- [List critical security/stability issues]
130
-
131
- ## 🟡 Warnings (Fix before merge)
132
-
133
- [List performance issues, missing tests]
134
-
135
- ## 🟢 Suggestions (Consider)
136
-
137
- [List architectural and quality improvements]
138
- ```
139
-
140
- **Example output:**
141
-
142
- ```
143
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
144
- 📊 REVIEW SUMMARY
145
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
146
-
147
- Analyzing code...
148
- ✅ Security check complete
149
- ⚡ Performance check complete
150
- 🧪 Testing check complete
151
- 📐 Architecture check complete
152
- 🎨 Code quality check complete
153
-
154
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
155
- 🔍 RESULTS
156
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
157
-
158
- 🔴 Critical Issues: 1
159
- 🟡 Warnings: 2
160
- 🟢 Suggestions: 3
161
-
162
- Top Priority:
163
- 1. 🔴 SQL Injection in NotificationService.ts:45
164
-
165
- Report saved: .ai-flow/reviews/2025-01-20-15-30/
166
- ```
167
-
267
+ What would you like to do?
268
+ A) Fix critical issues now
269
+ B) Fix all warnings + critical issues
270
+ C) Save report and continue
271
+ D) Show detailed explanations
272
+
273
+ ```
168
274
  ---
169
-
170
- ### Step 4: Present Detailed Report + Ask for Action
171
-
172
- **Show detailed findings:**
173
-
174
- ````markdown
175
- # Code Review: feature-notifications
176
-
177
- ## 🔴 Critical Issues (Fix immediately)
178
-
179
- ### 1. SQL Injection in NotificationService.ts:45
180
-
181
- **Location:** src/services/NotificationService.ts:45
182
- **Issue:** Query uses string interpolation instead of parameterized query
183
- **Code:**
184
-
185
- ```typescript
186
- const notifications = await db.query(
187
- `SELECT * FROM notifications WHERE userId = ${userId}`,
188
- );
189
- ```
190
- ````
191
-
192
- **Fix:** Use parameterized queries
193
-
194
- ```typescript
195
- const notifications = await db.query(
196
- 'SELECT * FROM notifications WHERE userId = $1',
197
- [userId],
198
- );
199
- ```
200
-
201
- **Impact:** HIGH - SQL injection vulnerability allows malicious users to execute arbitrary SQL
202
-
275
+ ## Files Generated
276
+
277
+ ```
278
+
279
+ .ai-flow/reviews/YYYY-MM-DD-HH-MM/
280
+ ├── report.md # Complete review report
281
+ ├── security.md # Security issues details
282
+ ├── performance.md # Performance issues details
283
+ └── suggestions.md # Improvement suggestions
284
+
285
+ ```
203
286
  ---
204
-
205
- ## 🟡 Warnings (Fix before merge)
206
-
207
- ### 1. N+1 Query in NotificationController.ts:32
208
-
209
- **Location:** src/controllers/NotificationController.ts:32-38
210
- **Issue:** Database calls inside loop
211
- **Code:**
212
-
213
- ```typescript
214
- for (const notification of notifications) {
215
- notification.user = await User.findById(notification.userId);
216
- }
217
- ```
218
-
219
- **Fix:** Use JOIN or batch query
220
-
221
- ```typescript
222
- const notifications = await Notification.find(...)
223
- .populate('user')
224
- .exec();
225
- ```
226
-
227
- **Impact:** MEDIUM - Performance degradation with many notifications
228
-
229
- ### 2. Missing Error Handling in WebSocketHandler.ts:67
230
-
231
- **Location:** src/websocket/notificationSocket.ts:67
232
- **Issue:** No try-catch around async operation
233
- **Code:**
234
-
235
- ```typescript
236
- socket.on('markRead', async (notificationId) => {
237
- await notificationService.markAsRead(notificationId);
238
- });
239
- ```
240
-
241
- **Fix:** Add error boundary
242
-
243
- ```typescript
244
- socket.on('markRead', async (notificationId) => {
245
- try {
246
- await notificationService.markAsRead(notificationId);
247
- socket.emit('success', { notificationId });
248
- } catch (error) {
249
- socket.emit('error', { message: 'Failed to mark as read' });
250
- }
251
- });
252
- ```
253
-
254
- **Impact:** MEDIUM - Potential server crashes on errors
255
-
287
+ ## Important Rules
288
+
289
+ ### 1. Context Awareness
290
+ **Before reviewing, read and extract specific rules:**
291
+
292
+ - **`AGENT.md`** - Project overview, tech stack, architecture pattern
293
+ - **`ai-instructions.md`** - Extract complete list of NEVER Rules and ALWAYS Rules
294
+ - **`docs/code-standards.md`** - Naming conventions, function length limits, complexity thresholds
295
+ - **`docs/testing.md`** - Required test coverage, testing patterns, test naming conventions
296
+ - **`specs/security.md`** - Auth patterns, encryption requirements, security headers
297
+ - **`docs/architecture.md`** - Design patterns, layering rules, separation of concerns
298
+
299
+ **Apply these rules during review:**
300
+ - Security check → Validate against `specs/security.md` patterns
301
+ - Architecture check → Validate against `docs/architecture.md` patterns
302
+ - Code quality Validate against `docs/code-standards.md` conventions
303
+ - Testing check → Validate against `docs/testing.md` requirements
304
+ - NEVER Rules → Flag any violation as 🔴 Critical
305
+
306
+ **Respect existing patterns unless problematic**
307
+ **Consider project's maturity (MVP vs Production)**
308
+
309
+ ### 2. Prioritization
310
+ **Always prioritize issues correctly:**
311
+ - 🔴 **Critical** - Security vulnerabilities, stability issues, data loss risks
312
+ - 🟡 **Warning** - Performance problems, missing tests, potential bugs
313
+ - 🟢 **Suggestion** - Code quality, refactoring, best practices
314
+
315
+ ### 3. Actionable Feedback
316
+ - Show exact file and line number
317
+ - Include problematic code snippet
318
+ - Provide concrete fix with code example
319
+ - Explain impact clearly
320
+
321
+ ### 4. Balance
322
+ - Don't be overly nitpicky
323
+ - Focus on real issues, not style preferences
324
+ - Consider project context (startup vs enterprise)
325
+ - Praise good patterns when found
256
326
  ---
257
-
258
- ## 🟢 Suggestions (Consider)
259
-
260
- ### 1. Extract Method in NotificationService.ts:67-89
261
-
262
- **Location:** src/services/NotificationService.ts:67-89
263
- **Issue:** Complex method with multiple responsibilities
264
- **Suggestion:** Split into smaller functions:
265
-
266
- - `validateNotificationData()`
267
- - `createNotification()`
268
- - `sendPushNotification()`
269
- **Impact:** LOW - Improves code maintainability
270
-
271
- ### 2. Add JSDoc to NotificationController.ts
272
-
273
- **Location:** src/controllers/NotificationController.ts
274
- **Issue:** Public methods lack documentation
275
- **Suggestion:** Add JSDoc comments with examples
276
- **Impact:** LOW - Improves developer experience
277
-
278
- ### 3. Consider Notification Pagination
279
-
280
- **Location:** src/controllers/NotificationController.ts:15
281
- **Issue:** Returns all notifications without pagination
282
- **Suggestion:** Add pagination (limit/offset or cursor-based)
283
- **Impact:** LOW - Better performance with many notifications
284
-
285
- ```
286
-
287
- **Ask for action:**
288
- ```
289
-
290
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
291
- What would you like to do?
292
- A) Fix critical issues now
293
- B) Fix all warnings + critical issues
294
- C) Save report and continue
295
- D) Show detailed explanations
296
-
297
- ```
298
-
327
+ ## Output Examples
328
+
329
+ ### All Clear:
330
+ ```
299
331
  ---
300
-
301
- ## Files Generated
302
-
303
- ```
304
-
305
- .ai-flow/reviews/YYYY-MM-DD-HH-MM/
306
- ├── report.md # Complete review report
307
- ├── security.md # Security issues details
308
- ├── performance.md # Performance issues details
309
- └── suggestions.md # Improvement suggestions
310
-
311
- ```
312
-
332
+ ✅ REVIEW COMPLETE: No Issues Found
313
333
  ---
314
-
315
- ## Important Rules
316
-
317
- ### 1. Context Awareness
318
- **Before reviewing, read and extract specific rules:**
319
-
320
- - **`AGENT.md`** - Project overview, tech stack, architecture pattern
321
- - **`ai-instructions.md`** - Extract complete list of NEVER Rules and ALWAYS Rules
322
- - **`docs/code-standards.md`** - Naming conventions, function length limits, complexity thresholds
323
- - **`docs/testing.md`** - Required test coverage, testing patterns, test naming conventions
324
- - **`specs/security.md`** - Auth patterns, encryption requirements, security headers
325
- - **`docs/architecture.md`** - Design patterns, layering rules, separation of concerns
326
-
327
- **Apply these rules during review:**
328
- - Security check → Validate against `specs/security.md` patterns
329
- - Architecture check → Validate against `docs/architecture.md` patterns
330
- - Code quality → Validate against `docs/code-standards.md` conventions
331
- - Testing check → Validate against `docs/testing.md` requirements
332
- - NEVER Rules → Flag any violation as 🔴 Critical
333
-
334
- **Respect existing patterns unless problematic**
335
- **Consider project's maturity (MVP vs Production)**
336
-
337
- ### 2. Prioritization
338
- **Always prioritize issues correctly:**
339
- - 🔴 **Critical** - Security vulnerabilities, stability issues, data loss risks
340
- - 🟡 **Warning** - Performance problems, missing tests, potential bugs
341
- - 🟢 **Suggestion** - Code quality, refactoring, best practices
342
-
343
- ### 3. Actionable Feedback
344
- - Show exact file and line number
345
- - Include problematic code snippet
346
- - Provide concrete fix with code example
347
- - Explain impact clearly
348
-
349
- ### 4. Balance
350
- - Don't be overly nitpicky
351
- - Focus on real issues, not style preferences
352
- - Consider project context (startup vs enterprise)
353
- - Praise good patterns when found
354
-
334
+ Code quality: Excellent
335
+ All aspects reviewed: ✅
336
+
337
+ Highlights:
338
+
339
+ - ✅ Strong security measures (bcrypt, JWT, input validation)
340
+ - Good test coverage (95%)
341
+ - Clean architecture (SOLID principles followed)
342
+ - Efficient queries with proper indexes
343
+
344
+ Report saved: .ai-flow/reviews/2025-01-20-15-30/
345
+
346
+ ```
347
+
348
+ ### Issues Found:
349
+ ```
355
350
  ---
356
-
357
- ## Output Examples
358
-
359
- ### All Clear:
360
- ```
361
-
362
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
363
- ✅ REVIEW COMPLETE: No Issues Found
364
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
365
-
366
- Code quality: Excellent
367
- All aspects reviewed: ✅
368
-
369
- Highlights:
370
-
371
- - ✅ Strong security measures (bcrypt, JWT, input validation)
372
- - ✅ Good test coverage (95%)
373
- - ✅ Clean architecture (SOLID principles followed)
374
- - ✅ Efficient queries with proper indexes
375
-
376
- Report saved: .ai-flow/reviews/2025-01-20-15-30/
377
-
378
- ```
379
-
380
- ### Issues Found:
381
- ```
382
-
383
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
384
- ⚠️ REVIEW COMPLETE: Issues Found
385
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
386
-
387
- 🔴 Critical: 1
388
- 🟡 Warnings: 2
389
- 🟢 Suggestions: 3
390
-
391
- Report saved: .ai-flow/reviews/2025-01-20-15-30/
392
-
393
- Fix critical issues now? (Y/n)
394
-
395
- ```
396
-
351
+ ⚠️ REVIEW COMPLETE: Issues Found
397
352
  ---
398
-
399
- **BEGIN EXECUTION when user runs `/review`, `/review feature-[name]`, or `/review --full`**
400
- ```
353
+ 🔴 Critical: 1
354
+ 🟡 Warnings: 2
355
+ 🟢 Suggestions: 3
356
+
357
+ Report saved: .ai-flow/reviews/2025-01-20-15-30/
358
+
359
+ Fix critical issues now? (Y/n)
360
+
361
+ ```
362
+ ---
363
+ **BEGIN EXECUTION when user runs `/review`, `/review feature-[name]`, or `/review --full`**
364
+ ```
365
+
366
+
367
+
401
368