ai-flow-dev 2.7.0 → 2.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (171) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +573 -570
  3. package/package.json +74 -74
  4. package/prompts/backend/flow-build-phase-0.md +535 -535
  5. package/prompts/backend/flow-build-phase-1.md +626 -626
  6. package/prompts/backend/flow-build-phase-10.md +340 -340
  7. package/prompts/backend/flow-build-phase-2.md +573 -573
  8. package/prompts/backend/flow-build-phase-3.md +834 -834
  9. package/prompts/backend/flow-build-phase-4.md +554 -554
  10. package/prompts/backend/flow-build-phase-5.md +703 -703
  11. package/prompts/backend/flow-build-phase-6.md +524 -524
  12. package/prompts/backend/flow-build-phase-7.md +1001 -1001
  13. package/prompts/backend/flow-build-phase-8.md +1407 -1407
  14. package/prompts/backend/flow-build-phase-9.md +477 -477
  15. package/prompts/backend/flow-build.md +137 -137
  16. package/prompts/backend/flow-check-review.md +656 -20
  17. package/prompts/backend/flow-check-test.md +526 -14
  18. package/prompts/backend/flow-check.md +717 -67
  19. package/prompts/backend/flow-commit.md +88 -119
  20. package/prompts/backend/flow-docs-sync.md +354 -354
  21. package/prompts/backend/flow-finish.md +919 -0
  22. package/prompts/backend/flow-release.md +949 -0
  23. package/prompts/backend/flow-work-feature.md +61 -61
  24. package/prompts/backend/flow-work-fix.md +46 -46
  25. package/prompts/backend/flow-work-refactor.md +48 -48
  26. package/prompts/backend/flow-work-resume.md +34 -34
  27. package/prompts/backend/flow-work.md +1098 -1286
  28. package/prompts/desktop/flow-build-phase-0.md +359 -359
  29. package/prompts/desktop/flow-build-phase-1.md +295 -295
  30. package/prompts/desktop/flow-build-phase-10.md +357 -357
  31. package/prompts/desktop/flow-build-phase-2.md +282 -282
  32. package/prompts/desktop/flow-build-phase-3.md +291 -291
  33. package/prompts/desktop/flow-build-phase-4.md +308 -308
  34. package/prompts/desktop/flow-build-phase-5.md +269 -269
  35. package/prompts/desktop/flow-build-phase-6.md +350 -350
  36. package/prompts/desktop/flow-build-phase-7.md +297 -297
  37. package/prompts/desktop/flow-build-phase-8.md +541 -541
  38. package/prompts/desktop/flow-build-phase-9.md +439 -439
  39. package/prompts/desktop/flow-build.md +156 -156
  40. package/prompts/desktop/flow-check-review.md +656 -20
  41. package/prompts/desktop/flow-check-test.md +526 -14
  42. package/prompts/desktop/flow-check.md +717 -67
  43. package/prompts/desktop/flow-commit.md +88 -119
  44. package/prompts/desktop/flow-docs-sync.md +354 -354
  45. package/prompts/desktop/flow-finish.md +919 -0
  46. package/prompts/desktop/flow-release.md +662 -0
  47. package/prompts/desktop/flow-work-feature.md +61 -61
  48. package/prompts/desktop/flow-work-fix.md +46 -46
  49. package/prompts/desktop/flow-work-refactor.md +48 -48
  50. package/prompts/desktop/flow-work-resume.md +34 -34
  51. package/prompts/desktop/flow-work.md +1202 -1390
  52. package/prompts/frontend/flow-build-phase-0.md +425 -425
  53. package/prompts/frontend/flow-build-phase-1.md +626 -626
  54. package/prompts/frontend/flow-build-phase-10.md +33 -33
  55. package/prompts/frontend/flow-build-phase-2.md +573 -573
  56. package/prompts/frontend/flow-build-phase-3.md +782 -782
  57. package/prompts/frontend/flow-build-phase-4.md +554 -554
  58. package/prompts/frontend/flow-build-phase-5.md +703 -703
  59. package/prompts/frontend/flow-build-phase-6.md +524 -524
  60. package/prompts/frontend/flow-build-phase-7.md +1001 -1001
  61. package/prompts/frontend/flow-build-phase-8.md +872 -872
  62. package/prompts/frontend/flow-build-phase-9.md +94 -94
  63. package/prompts/frontend/flow-build.md +137 -137
  64. package/prompts/frontend/flow-check-review.md +656 -20
  65. package/prompts/frontend/flow-check-test.md +526 -14
  66. package/prompts/frontend/flow-check.md +717 -67
  67. package/prompts/frontend/flow-commit.md +88 -119
  68. package/prompts/frontend/flow-docs-sync.md +550 -550
  69. package/prompts/frontend/flow-finish.md +919 -0
  70. package/prompts/frontend/flow-release.md +519 -0
  71. package/prompts/frontend/flow-work-api.md +1547 -0
  72. package/prompts/frontend/flow-work-feature.md +61 -61
  73. package/prompts/frontend/flow-work-fix.md +38 -38
  74. package/prompts/frontend/flow-work-refactor.md +48 -48
  75. package/prompts/frontend/flow-work-resume.md +34 -34
  76. package/prompts/frontend/flow-work.md +1595 -1320
  77. package/prompts/mobile/flow-build-phase-0.md +425 -425
  78. package/prompts/mobile/flow-build-phase-1.md +626 -626
  79. package/prompts/mobile/flow-build-phase-10.md +32 -32
  80. package/prompts/mobile/flow-build-phase-2.md +573 -573
  81. package/prompts/mobile/flow-build-phase-3.md +782 -782
  82. package/prompts/mobile/flow-build-phase-4.md +554 -554
  83. package/prompts/mobile/flow-build-phase-5.md +703 -703
  84. package/prompts/mobile/flow-build-phase-6.md +524 -524
  85. package/prompts/mobile/flow-build-phase-7.md +1001 -1001
  86. package/prompts/mobile/flow-build-phase-8.md +888 -888
  87. package/prompts/mobile/flow-build-phase-9.md +90 -90
  88. package/prompts/mobile/flow-build.md +135 -135
  89. package/prompts/mobile/flow-check-review.md +656 -20
  90. package/prompts/mobile/flow-check-test.md +526 -14
  91. package/prompts/mobile/flow-check.md +717 -67
  92. package/prompts/mobile/flow-commit.md +88 -119
  93. package/prompts/mobile/flow-docs-sync.md +620 -620
  94. package/prompts/mobile/flow-finish.md +919 -0
  95. package/prompts/mobile/flow-release.md +751 -0
  96. package/prompts/mobile/flow-work-api.md +1500 -0
  97. package/prompts/mobile/flow-work-feature.md +61 -61
  98. package/prompts/mobile/flow-work-fix.md +46 -46
  99. package/prompts/mobile/flow-work-refactor.md +48 -48
  100. package/prompts/mobile/flow-work-resume.md +34 -34
  101. package/prompts/mobile/flow-work.md +1605 -1329
  102. package/prompts/shared/mermaid-guidelines.md +102 -102
  103. package/prompts/shared/scope-levels.md +114 -114
  104. package/prompts/shared/smart-skip-preflight.md +214 -214
  105. package/prompts/shared/story-points.md +55 -55
  106. package/prompts/shared/task-format.md +74 -74
  107. package/prompts/shared/task-summary-template.md +277 -277
  108. package/templates/AGENT.template.md +443 -443
  109. package/templates/backend/.clauderules.template +112 -112
  110. package/templates/backend/.cursorrules.template +102 -102
  111. package/templates/backend/README.template.md +2 -2
  112. package/templates/backend/ai-instructions.template.md +2 -2
  113. package/templates/backend/copilot-instructions.template.md +2 -2
  114. package/templates/backend/docs/api.template.md +320 -320
  115. package/templates/backend/docs/business-flows.template.md +97 -97
  116. package/templates/backend/docs/code-standards.template.md +2 -2
  117. package/templates/backend/docs/contributing.template.md +3 -3
  118. package/templates/backend/docs/data-model.template.md +520 -520
  119. package/templates/backend/docs/testing.template.md +2 -2
  120. package/templates/backend/project-brief.template.md +2 -2
  121. package/templates/backend/specs/configuration.template.md +2 -2
  122. package/templates/backend/specs/security.template.md +2 -2
  123. package/templates/desktop/.clauderules.template +112 -112
  124. package/templates/desktop/.cursorrules.template +102 -102
  125. package/templates/desktop/README.template.md +170 -170
  126. package/templates/desktop/ai-instructions.template.md +366 -366
  127. package/templates/desktop/copilot-instructions.template.md +140 -140
  128. package/templates/desktop/docs/docs/api.template.md +320 -320
  129. package/templates/desktop/docs/docs/architecture.template.md +724 -724
  130. package/templates/desktop/docs/docs/business-flows.template.md +102 -102
  131. package/templates/desktop/docs/docs/code-standards.template.md +792 -792
  132. package/templates/desktop/docs/docs/contributing.template.md +149 -149
  133. package/templates/desktop/docs/docs/data-model.template.md +520 -520
  134. package/templates/desktop/docs/docs/operations.template.md +720 -720
  135. package/templates/desktop/docs/docs/testing.template.md +722 -722
  136. package/templates/desktop/project-brief.template.md +150 -150
  137. package/templates/desktop/specs/specs/configuration.template.md +121 -121
  138. package/templates/desktop/specs/specs/security.template.md +392 -392
  139. package/templates/frontend/README.template.md +2 -2
  140. package/templates/frontend/ai-instructions.template.md +2 -2
  141. package/templates/frontend/docs/api-integration.template.md +362 -362
  142. package/templates/frontend/docs/components.template.md +2 -2
  143. package/templates/frontend/docs/error-handling.template.md +360 -360
  144. package/templates/frontend/docs/operations.template.md +107 -107
  145. package/templates/frontend/docs/performance.template.md +124 -124
  146. package/templates/frontend/docs/pwa.template.md +119 -119
  147. package/templates/frontend/docs/state-management.template.md +2 -2
  148. package/templates/frontend/docs/styling.template.md +2 -2
  149. package/templates/frontend/docs/testing.template.md +2 -2
  150. package/templates/frontend/project-brief.template.md +2 -2
  151. package/templates/frontend/specs/accessibility.template.md +95 -95
  152. package/templates/frontend/specs/configuration.template.md +2 -2
  153. package/templates/frontend/specs/security.template.md +175 -175
  154. package/templates/fullstack/README.template.md +252 -252
  155. package/templates/fullstack/ai-instructions.template.md +444 -444
  156. package/templates/fullstack/project-brief.template.md +157 -157
  157. package/templates/fullstack/specs/configuration.template.md +340 -340
  158. package/templates/mobile/README.template.md +167 -167
  159. package/templates/mobile/ai-instructions.template.md +196 -196
  160. package/templates/mobile/docs/app-store.template.md +135 -135
  161. package/templates/mobile/docs/architecture.template.md +63 -63
  162. package/templates/mobile/docs/native-features.template.md +94 -94
  163. package/templates/mobile/docs/navigation.template.md +59 -59
  164. package/templates/mobile/docs/offline-strategy.template.md +65 -65
  165. package/templates/mobile/docs/permissions.template.md +56 -56
  166. package/templates/mobile/docs/state-management.template.md +85 -85
  167. package/templates/mobile/docs/testing.template.md +109 -109
  168. package/templates/mobile/project-brief.template.md +69 -69
  169. package/templates/mobile/specs/build-configuration.template.md +91 -91
  170. package/templates/mobile/specs/deployment.template.md +92 -92
  171. package/templates/work.template.md +61 -47
@@ -1,366 +1,366 @@
1
- # AI Instructions
2
-
3
- > **CRITICAL:** Every AI assistant MUST read and follow this document before any work on this desktop application.
4
-
5
- ---
6
-
7
- ## 🎯 Project Overview
8
-
9
- **Name:** {{PROJECT_NAME}}
10
-
11
- **Description:** {{PROJECT_DESCRIPTION}}
12
-
13
- **Purpose:** {{PROBLEM_STATEMENT}}
14
-
15
- **Application Type:** {{APPLICATION_TYPE}}
16
-
17
- ---
18
-
19
- ## 🏗️ Tech Stack
20
-
21
- ### Desktop Platform
22
-
23
- - **IDE:** {{IDE}} (NetBeans / Eclipse / IntelliJ)
24
- - **Language:** Java {{JAVA_VERSION}}
25
- - **Build Tool:** {{BUILD_TOOL}} (Maven / Gradle / Ant)
26
- - **JDK Distribution:** {{JDK_DISTRIBUTION}} (Oracle / OpenJDK / AdoptOpenJDK)
27
-
28
- ### UI Framework
29
-
30
- - **Framework:** {{UI_FRAMEWORK}} (Swing / JavaFX / SWT)
31
- - **Layout Managers:** {{LAYOUT_MANAGERS}}
32
- - **Look and Feel:** {{LOOK_AND_FEEL}}
33
- - **UI Libraries:** {{UI_LIBRARIES}}
34
-
35
- ### Data Layer
36
-
37
- - **Storage Type:** {{STORAGE_TYPE}} (Embedded DB / File-based / External DB)
38
- {{#IF_DATABASE}}- **Database:** {{DATABASE}} {{DATABASE_VERSION}}
39
- - **ORM/Data Access:** {{ORM_TYPE}}{{/IF_DATABASE}}
40
- {{#IF_FILE_STORAGE}}- **File Formats:** {{FILE_FORMATS}}{{/IF_FILE_STORAGE}}
41
-
42
- ### Architecture
43
-
44
- - **Pattern:** {{ARCHITECTURE_PATTERN}} (MVC / MVP / MVVM / Layered)
45
- - **Package Structure:** {{PACKAGE_BASE}}
46
-
47
- ### Key Libraries
48
-
49
- {{KEY_LIBRARIES}}
50
-
51
- ---
52
-
53
- ## 🏛️ Architecture
54
-
55
- **Pattern:** {{ARCHITECTURE_PATTERN}}
56
-
57
- {{ARCHITECTURE_DESCRIPTION}}
58
-
59
- **Package Organization:**
60
-
61
- ```
62
- {{PACKAGE_BASE}}/
63
- ├── model/ # Data entities
64
- ├── view/ # UI components ({{UI_FRAMEWORK}})
65
- ├── controller/ # Event handlers, presenters
66
- ├── service/ # Business logic
67
- ├── dao/ # Data access layer
68
- └── util/ # Utilities
69
- ```
70
-
71
- ---
72
-
73
- ## ❌ NEVER Rules
74
-
75
- **YOU MUST NEVER:**
76
-
77
- ### UI Thread Safety
78
-
79
- - ❌ **Block UI thread** - Always use background tasks for long operations
80
- - ❌ **Update UI from background thread** - Use SwingUtilities.invokeLater / Platform.runLater / Display.asyncExec
81
- - ❌ **Ignore progress indicators** - Show feedback for operations > 1 second
82
- - ❌ **Use Thread.sleep() on UI thread** - Blocks the entire UI
83
-
84
- ### Code Quality
85
-
86
- - ❌ **Hardcode file paths** - Use user.home, System.getProperty("user.dir")
87
- - ❌ **Hardcode UI strings** - Use ResourceBundle for i18n
88
- - ❌ **Use null layouts** - Always use proper layout managers
89
- - ❌ **Leave System.out.println in production** - Use proper logging (SLF4J/Log4j)
90
- - ❌ **Ignore exceptions** - Always handle or log exceptions
91
-
92
- ### Security
93
-
94
- - ❌ **Store passwords in plaintext** - Use BCrypt/PBKDF2
95
- - ❌ **Store sensitive data unencrypted** - Use Keychain/Credential Manager/Encrypted files
96
- - ❌ **Skip input validation** - Validate all user input
97
- - ❌ **Trust file paths from users** - Validate and sanitize paths
98
-
99
- ### Architecture
100
-
101
- - ❌ **Put business logic in UI components** - Keep views thin
102
- - ❌ **Access database from UI classes** - Use DAO/Repository pattern
103
- - ❌ **Create circular dependencies** - Design proper dependency flow
104
- - ❌ **Mix concerns** - Respect layer boundaries (Model-View-Controller/Presenter)
105
-
106
- ### Data
107
-
108
- - ❌ **Query database in loops (N+1)** - Use batch queries
109
- - ❌ **Forget database transactions** - Use transactions for multi-step operations
110
- - ❌ **Ignore resource cleanup** - Always close Connections, Streams, ResultSets
111
- - ❌ **Use string concatenation for SQL** - Use PreparedStatement (prevent SQL injection)
112
-
113
- ### Testing
114
-
115
- - ❌ **Skip tests for UI logic** - Use TestFX/AssertJ-Swing/SWTBot
116
- - ❌ **Mock UI components** - Only mock business logic and data access
117
- - ❌ **Commit failing tests** - All tests must pass before commit
118
-
119
- {{CUSTOM_NEVER_RULES}}
120
-
121
- ---
122
-
123
- ## ✅ ALWAYS Rules
124
-
125
- **YOU MUST ALWAYS:**
126
-
127
- ### UI Thread Safety
128
-
129
- - ✅ **Use SwingWorker** (Swing) for background tasks
130
- - ✅ **Use Task/Service** (JavaFX) for background operations
131
- - ✅ **Use Display.asyncExec** (SWT) for UI updates from background
132
- - ✅ **Show progress indicators** for operations > 1 second
133
- - ✅ **Handle UI thread exceptions** globally with UncaughtExceptionHandler
134
-
135
- ### Code Quality
136
-
137
- - ✅ **Follow Java naming conventions** - camelCase methods, PascalCase classes
138
- - ✅ **Keep methods under {{MAX_METHOD_LENGTH}} lines** (default: 30)
139
- - ✅ **Use final for immutable variables**
140
- - ✅ **Prefer composition over inheritance**
141
- - ✅ **Write Javadoc for public API**
142
-
143
- ### Security
144
-
145
- - ✅ **Hash passwords with BCrypt** (work factor: 12)
146
- - ✅ **Validate all inputs** with Bean Validation or custom validators
147
- - ✅ **Use Preferences API** for non-sensitive settings
148
- - ✅ **Use Keychain/Credential Manager** for sensitive data
149
- - ✅ **Log security events** (failed logins, permission denials)
150
-
151
- ### Architecture
152
-
153
- - ✅ **Follow {{ARCHITECTURE_PATTERN}} pattern strictly**
154
- - ✅ **Use Dependency Injection** (Constructor injection preferred)
155
- - ✅ **Keep UI classes thin** (delegate to controllers/presenters)
156
- - ✅ **Separate concerns** (Model-View-Controller/Presenter)
157
- - ✅ **Use EventBus** for loosely coupled communication
158
-
159
- ### Data
160
-
161
- - ✅ **Use PreparedStatement** (prevent SQL injection)
162
- - ✅ **Implement transactions** for multi-table operations
163
- - ✅ **Add created_at/updated_at timestamps** to entities
164
- - ✅ **Use connection pooling** (HikariCP recommended)
165
- - ✅ **Close resources** with try-with-resources
166
-
167
- ### Testing
168
-
169
- - ✅ **Write unit tests for services** (target: {{UNIT_TEST_COVERAGE}}%+ coverage)
170
- - ✅ **Write UI tests for critical flows** (TestFX/AssertJ-Swing)
171
- - ✅ **Use H2 in-memory** for database tests
172
- - ✅ **Mock external dependencies** (APIs, email, file system)
173
- - ✅ **Run tests before every commit**
174
-
175
- ### Packaging & Deployment
176
-
177
- - ✅ **Use Maven/Gradle** for dependency management
178
- - ✅ **Create executable JAR** with manifest Main-Class
179
- - ✅ **Include JRE** for native packaging (jpackage)
180
- - ✅ **Sign executables** (Windows .exe, macOS .app)
181
- - ✅ **Provide installers** for production releases
182
-
183
- {{CUSTOM_ALWAYS_RULES}}
184
-
185
- ---
186
-
187
- ## 📁 Project Structure
188
-
189
- ### Maven (Recommended)
190
-
191
- ```
192
- project-root/
193
- ├── pom.xml
194
- ├── src/
195
- │ ├── main/
196
- │ │ ├── java/
197
- │ │ │ └── {{PACKAGE_BASE}}/
198
- │ │ │ ├── Main.java
199
- │ │ │ ├── model/
200
- │ │ │ ├── view/
201
- │ │ │ ├── controller/
202
- │ │ │ ├── service/
203
- │ │ │ └── dao/
204
- │ │ └── resources/
205
- │ │ ├── application.properties
206
- │ │ ├── fxml/ (JavaFX)
207
- │ │ ├── forms/ (Swing .form)
208
- │ │ └── icons/
209
- │ └── test/
210
- │ └── java/
211
- └── target/ (build output)
212
- ```
213
-
214
- ### Gradle
215
-
216
- ```
217
- project-root/
218
- ├── build.gradle
219
- ├── src/
220
- │ └── (same as Maven)
221
- └── build/ (build output)
222
- ```
223
-
224
- ### Ant (NetBeans)
225
-
226
- ```
227
- project-root/
228
- ├── nbproject/
229
- │ ├── project.xml
230
- │ └── project.properties
231
- ├── build.xml
232
- ├── src/
233
- │ └── {{PACKAGE_BASE}}/
234
- ├── lib/ (dependencies)
235
- ├── build/ (compiled classes)
236
- └── dist/ (JAR output)
237
- ```
238
-
239
- ---
240
-
241
- ## 🎨 UI Component Naming
242
-
243
- **Follow these conventions:**
244
-
245
- - **Windows:** `MainWindow`, `SettingsDialog`, `AboutWindow`
246
- - **Panels:** `LoginPanel`, `DashboardPanel`
247
- - **Controllers:** `MainController`, `LoginController`
248
- - **Services:** `UserService`, `ProjectService`
249
- - **DAOs:** `UserDAO`, `ProjectDAO`
250
- - **Models:** `User`, `Project`, `Task`
251
-
252
- ---
253
-
254
- ## 🔄 Common Patterns
255
-
256
- ### Background Task (Swing)
257
-
258
- ```java
259
- SwingWorker<Result, Void> worker = new SwingWorker<>() {
260
- @Override
261
- protected Result doInBackground() throws Exception {
262
- return performLongOperation();
263
- }
264
-
265
- @Override
266
- protected void done() {
267
- try {
268
- Result result = get();
269
- updateUI(result);
270
- } catch (Exception e) {
271
- showError(e);
272
- }
273
- }
274
- };
275
- worker.execute();
276
- ```
277
-
278
- ### Background Task (JavaFX)
279
-
280
- ```java
281
- Task<Result> task = new Task<>() {
282
- @Override
283
- protected Result call() throws Exception {
284
- return performLongOperation();
285
- }
286
- };
287
- task.setOnSucceeded(e -> updateUI(task.getValue()));
288
- task.setOnFailed(e -> showError(task.getException()));
289
- new Thread(task).start();
290
- ```
291
-
292
- ### Database Connection (JDBC)
293
-
294
- ```java
295
- try (Connection conn = dataSource.getConnection();
296
- PreparedStatement stmt = conn.prepareStatement(sql)) {
297
- stmt.setString(1, value);
298
- try (ResultSet rs = stmt.executeQuery()) {
299
- while (rs.next()) {
300
- // Process results
301
- }
302
- }
303
- } catch (SQLException e) {
304
- logger.error("Database error", e);
305
- throw new DataAccessException("Failed to query database", e);
306
- }
307
- ```
308
-
309
- ---
310
-
311
- ## 📚 Documentation
312
-
313
- **Read these files for detailed guidelines:**
314
-
315
- - `docs/ARCHITECTURE.md` - Architecture and design patterns
316
- - `docs/DATABASE.md` - Database schema and migrations
317
- - `docs/DEVELOPMENT.md` - Setup and development guide
318
- - `docs/DEPLOYMENT.md` - Packaging and deployment
319
- - `specs/UI.md` - UI components and flows
320
- - `specs/DATA.md` - Data models and validation
321
-
322
- ---
323
-
324
- ## 🔧 Development Commands
325
-
326
- ### Maven
327
-
328
- ```bash
329
- mvn clean compile # Compile source code
330
- mvn test # Run unit tests
331
- mvn package # Create JAR
332
- mvn javafx:run # Run JavaFX app (if applicable)
333
- java -jar target/myapp.jar # Run JAR
334
- ```
335
-
336
- ### Gradle
337
-
338
- ```bash
339
- gradle clean build # Build project
340
- gradle test # Run tests
341
- gradle run # Run application
342
- ```
343
-
344
- ### Ant (NetBeans)
345
-
346
- ```bash
347
- ant clean # Clean build
348
- ant compile # Compile source
349
- ant jar # Create JAR
350
- ant run # Run application
351
- ```
352
-
353
- ---
354
-
355
- ## 🚀 Next Steps
356
-
357
- 1. **Read all docs/ files** before making changes
358
- 2. **Follow naming conventions** strictly
359
- 3. **Write tests** before or alongside code
360
- 4. **Run tests** before every commit
361
- 5. **Update documentation** when adding features
362
-
363
- ---
364
-
365
- _Generated by AI Flow - Desktop Edition_
366
- _Last Updated: {{GENERATION_DATE}}_
1
+ # AI Instructions
2
+
3
+ > **CRITICAL:** Every AI assistant MUST read and follow this document before any work on this desktop application.
4
+
5
+ ---
6
+
7
+ ## 🎯 Project Overview
8
+
9
+ **Name:** {{PROJECT_NAME}}
10
+
11
+ **Description:** {{PROJECT_DESCRIPTION}}
12
+
13
+ **Purpose:** {{PROBLEM_STATEMENT}}
14
+
15
+ **Application Type:** {{APPLICATION_TYPE}}
16
+
17
+ ---
18
+
19
+ ## 🏗️ Tech Stack
20
+
21
+ ### Desktop Platform
22
+
23
+ - **IDE:** {{IDE}} (NetBeans / Eclipse / IntelliJ)
24
+ - **Language:** Java {{JAVA_VERSION}}
25
+ - **Build Tool:** {{BUILD_TOOL}} (Maven / Gradle / Ant)
26
+ - **JDK Distribution:** {{JDK_DISTRIBUTION}} (Oracle / OpenJDK / AdoptOpenJDK)
27
+
28
+ ### UI Framework
29
+
30
+ - **Framework:** {{UI_FRAMEWORK}} (Swing / JavaFX / SWT)
31
+ - **Layout Managers:** {{LAYOUT_MANAGERS}}
32
+ - **Look and Feel:** {{LOOK_AND_FEEL}}
33
+ - **UI Libraries:** {{UI_LIBRARIES}}
34
+
35
+ ### Data Layer
36
+
37
+ - **Storage Type:** {{STORAGE_TYPE}} (Embedded DB / File-based / External DB)
38
+ {{#IF_DATABASE}}- **Database:** {{DATABASE}} {{DATABASE_VERSION}}
39
+ - **ORM/Data Access:** {{ORM_TYPE}}{{/IF_DATABASE}}
40
+ {{#IF_FILE_STORAGE}}- **File Formats:** {{FILE_FORMATS}}{{/IF_FILE_STORAGE}}
41
+
42
+ ### Architecture
43
+
44
+ - **Pattern:** {{ARCHITECTURE_PATTERN}} (MVC / MVP / MVVM / Layered)
45
+ - **Package Structure:** {{PACKAGE_BASE}}
46
+
47
+ ### Key Libraries
48
+
49
+ {{KEY_LIBRARIES}}
50
+
51
+ ---
52
+
53
+ ## 🏛️ Architecture
54
+
55
+ **Pattern:** {{ARCHITECTURE_PATTERN}}
56
+
57
+ {{ARCHITECTURE_DESCRIPTION}}
58
+
59
+ **Package Organization:**
60
+
61
+ ```
62
+ {{PACKAGE_BASE}}/
63
+ ├── model/ # Data entities
64
+ ├── view/ # UI components ({{UI_FRAMEWORK}})
65
+ ├── controller/ # Event handlers, presenters
66
+ ├── service/ # Business logic
67
+ ├── dao/ # Data access layer
68
+ └── util/ # Utilities
69
+ ```
70
+
71
+ ---
72
+
73
+ ## ❌ NEVER Rules
74
+
75
+ **YOU MUST NEVER:**
76
+
77
+ ### UI Thread Safety
78
+
79
+ - ❌ **Block UI thread** - Always use background tasks for long operations
80
+ - ❌ **Update UI from background thread** - Use SwingUtilities.invokeLater / Platform.runLater / Display.asyncExec
81
+ - ❌ **Ignore progress indicators** - Show feedback for operations > 1 second
82
+ - ❌ **Use Thread.sleep() on UI thread** - Blocks the entire UI
83
+
84
+ ### Code Quality
85
+
86
+ - ❌ **Hardcode file paths** - Use user.home, System.getProperty("user.dir")
87
+ - ❌ **Hardcode UI strings** - Use ResourceBundle for i18n
88
+ - ❌ **Use null layouts** - Always use proper layout managers
89
+ - ❌ **Leave System.out.println in production** - Use proper logging (SLF4J/Log4j)
90
+ - ❌ **Ignore exceptions** - Always handle or log exceptions
91
+
92
+ ### Security
93
+
94
+ - ❌ **Store passwords in plaintext** - Use BCrypt/PBKDF2
95
+ - ❌ **Store sensitive data unencrypted** - Use Keychain/Credential Manager/Encrypted files
96
+ - ❌ **Skip input validation** - Validate all user input
97
+ - ❌ **Trust file paths from users** - Validate and sanitize paths
98
+
99
+ ### Architecture
100
+
101
+ - ❌ **Put business logic in UI components** - Keep views thin
102
+ - ❌ **Access database from UI classes** - Use DAO/Repository pattern
103
+ - ❌ **Create circular dependencies** - Design proper dependency flow
104
+ - ❌ **Mix concerns** - Respect layer boundaries (Model-View-Controller/Presenter)
105
+
106
+ ### Data
107
+
108
+ - ❌ **Query database in loops (N+1)** - Use batch queries
109
+ - ❌ **Forget database transactions** - Use transactions for multi-step operations
110
+ - ❌ **Ignore resource cleanup** - Always close Connections, Streams, ResultSets
111
+ - ❌ **Use string concatenation for SQL** - Use PreparedStatement (prevent SQL injection)
112
+
113
+ ### Testing
114
+
115
+ - ❌ **Skip tests for UI logic** - Use TestFX/AssertJ-Swing/SWTBot
116
+ - ❌ **Mock UI components** - Only mock business logic and data access
117
+ - ❌ **Commit failing tests** - All tests must pass before commit
118
+
119
+ {{CUSTOM_NEVER_RULES}}
120
+
121
+ ---
122
+
123
+ ## ✅ ALWAYS Rules
124
+
125
+ **YOU MUST ALWAYS:**
126
+
127
+ ### UI Thread Safety
128
+
129
+ - ✅ **Use SwingWorker** (Swing) for background tasks
130
+ - ✅ **Use Task/Service** (JavaFX) for background operations
131
+ - ✅ **Use Display.asyncExec** (SWT) for UI updates from background
132
+ - ✅ **Show progress indicators** for operations > 1 second
133
+ - ✅ **Handle UI thread exceptions** globally with UncaughtExceptionHandler
134
+
135
+ ### Code Quality
136
+
137
+ - ✅ **Follow Java naming conventions** - camelCase methods, PascalCase classes
138
+ - ✅ **Keep methods under {{MAX_METHOD_LENGTH}} lines** (default: 30)
139
+ - ✅ **Use final for immutable variables**
140
+ - ✅ **Prefer composition over inheritance**
141
+ - ✅ **Write Javadoc for public API**
142
+
143
+ ### Security
144
+
145
+ - ✅ **Hash passwords with BCrypt** (work factor: 12)
146
+ - ✅ **Validate all inputs** with Bean Validation or custom validators
147
+ - ✅ **Use Preferences API** for non-sensitive settings
148
+ - ✅ **Use Keychain/Credential Manager** for sensitive data
149
+ - ✅ **Log security events** (failed logins, permission denials)
150
+
151
+ ### Architecture
152
+
153
+ - ✅ **Follow {{ARCHITECTURE_PATTERN}} pattern strictly**
154
+ - ✅ **Use Dependency Injection** (Constructor injection preferred)
155
+ - ✅ **Keep UI classes thin** (delegate to controllers/presenters)
156
+ - ✅ **Separate concerns** (Model-View-Controller/Presenter)
157
+ - ✅ **Use EventBus** for loosely coupled communication
158
+
159
+ ### Data
160
+
161
+ - ✅ **Use PreparedStatement** (prevent SQL injection)
162
+ - ✅ **Implement transactions** for multi-table operations
163
+ - ✅ **Add created_at/updated_at timestamps** to entities
164
+ - ✅ **Use connection pooling** (HikariCP recommended)
165
+ - ✅ **Close resources** with try-with-resources
166
+
167
+ ### Testing
168
+
169
+ - ✅ **Write unit tests for services** (target: {{UNIT_TEST_COVERAGE}}%+ coverage)
170
+ - ✅ **Write UI tests for critical flows** (TestFX/AssertJ-Swing)
171
+ - ✅ **Use H2 in-memory** for database tests
172
+ - ✅ **Mock external dependencies** (APIs, email, file system)
173
+ - ✅ **Run tests before every commit**
174
+
175
+ ### Packaging & Deployment
176
+
177
+ - ✅ **Use Maven/Gradle** for dependency management
178
+ - ✅ **Create executable JAR** with manifest Main-Class
179
+ - ✅ **Include JRE** for native packaging (jpackage)
180
+ - ✅ **Sign executables** (Windows .exe, macOS .app)
181
+ - ✅ **Provide installers** for production releases
182
+
183
+ {{CUSTOM_ALWAYS_RULES}}
184
+
185
+ ---
186
+
187
+ ## 📁 Project Structure
188
+
189
+ ### Maven (Recommended)
190
+
191
+ ```
192
+ project-root/
193
+ ├── pom.xml
194
+ ├── src/
195
+ │ ├── main/
196
+ │ │ ├── java/
197
+ │ │ │ └── {{PACKAGE_BASE}}/
198
+ │ │ │ ├── Main.java
199
+ │ │ │ ├── model/
200
+ │ │ │ ├── view/
201
+ │ │ │ ├── controller/
202
+ │ │ │ ├── service/
203
+ │ │ │ └── dao/
204
+ │ │ └── resources/
205
+ │ │ ├── application.properties
206
+ │ │ ├── fxml/ (JavaFX)
207
+ │ │ ├── forms/ (Swing .form)
208
+ │ │ └── icons/
209
+ │ └── test/
210
+ │ └── java/
211
+ └── target/ (build output)
212
+ ```
213
+
214
+ ### Gradle
215
+
216
+ ```
217
+ project-root/
218
+ ├── build.gradle
219
+ ├── src/
220
+ │ └── (same as Maven)
221
+ └── build/ (build output)
222
+ ```
223
+
224
+ ### Ant (NetBeans)
225
+
226
+ ```
227
+ project-root/
228
+ ├── nbproject/
229
+ │ ├── project.xml
230
+ │ └── project.properties
231
+ ├── build.xml
232
+ ├── src/
233
+ │ └── {{PACKAGE_BASE}}/
234
+ ├── lib/ (dependencies)
235
+ ├── build/ (compiled classes)
236
+ └── dist/ (JAR output)
237
+ ```
238
+
239
+ ---
240
+
241
+ ## 🎨 UI Component Naming
242
+
243
+ **Follow these conventions:**
244
+
245
+ - **Windows:** `MainWindow`, `SettingsDialog`, `AboutWindow`
246
+ - **Panels:** `LoginPanel`, `DashboardPanel`
247
+ - **Controllers:** `MainController`, `LoginController`
248
+ - **Services:** `UserService`, `ProjectService`
249
+ - **DAOs:** `UserDAO`, `ProjectDAO`
250
+ - **Models:** `User`, `Project`, `Task`
251
+
252
+ ---
253
+
254
+ ## 🔄 Common Patterns
255
+
256
+ ### Background Task (Swing)
257
+
258
+ ```java
259
+ SwingWorker<Result, Void> worker = new SwingWorker<>() {
260
+ @Override
261
+ protected Result doInBackground() throws Exception {
262
+ return performLongOperation();
263
+ }
264
+
265
+ @Override
266
+ protected void done() {
267
+ try {
268
+ Result result = get();
269
+ updateUI(result);
270
+ } catch (Exception e) {
271
+ showError(e);
272
+ }
273
+ }
274
+ };
275
+ worker.execute();
276
+ ```
277
+
278
+ ### Background Task (JavaFX)
279
+
280
+ ```java
281
+ Task<Result> task = new Task<>() {
282
+ @Override
283
+ protected Result call() throws Exception {
284
+ return performLongOperation();
285
+ }
286
+ };
287
+ task.setOnSucceeded(e -> updateUI(task.getValue()));
288
+ task.setOnFailed(e -> showError(task.getException()));
289
+ new Thread(task).start();
290
+ ```
291
+
292
+ ### Database Connection (JDBC)
293
+
294
+ ```java
295
+ try (Connection conn = dataSource.getConnection();
296
+ PreparedStatement stmt = conn.prepareStatement(sql)) {
297
+ stmt.setString(1, value);
298
+ try (ResultSet rs = stmt.executeQuery()) {
299
+ while (rs.next()) {
300
+ // Process results
301
+ }
302
+ }
303
+ } catch (SQLException e) {
304
+ logger.error("Database error", e);
305
+ throw new DataAccessException("Failed to query database", e);
306
+ }
307
+ ```
308
+
309
+ ---
310
+
311
+ ## 📚 Documentation
312
+
313
+ **Read these files for detailed guidelines:**
314
+
315
+ - `docs/ARCHITECTURE.md` - Architecture and design patterns
316
+ - `docs/DATABASE.md` - Database schema and migrations
317
+ - `docs/DEVELOPMENT.md` - Setup and development guide
318
+ - `docs/DEPLOYMENT.md` - Packaging and deployment
319
+ - `specs/UI.md` - UI components and flows
320
+ - `specs/DATA.md` - Data models and validation
321
+
322
+ ---
323
+
324
+ ## 🔧 Development Commands
325
+
326
+ ### Maven
327
+
328
+ ```bash
329
+ mvn clean compile # Compile source code
330
+ mvn test # Run unit tests
331
+ mvn package # Create JAR
332
+ mvn javafx:run # Run JavaFX app (if applicable)
333
+ java -jar target/myapp.jar # Run JAR
334
+ ```
335
+
336
+ ### Gradle
337
+
338
+ ```bash
339
+ gradle clean build # Build project
340
+ gradle test # Run tests
341
+ gradle run # Run application
342
+ ```
343
+
344
+ ### Ant (NetBeans)
345
+
346
+ ```bash
347
+ ant clean # Clean build
348
+ ant compile # Compile source
349
+ ant jar # Create JAR
350
+ ant run # Run application
351
+ ```
352
+
353
+ ---
354
+
355
+ ## 🚀 Next Steps
356
+
357
+ 1. **Read all docs/ files** before making changes
358
+ 2. **Follow naming conventions** strictly
359
+ 3. **Write tests** before or alongside code
360
+ 4. **Run tests** before every commit
361
+ 5. **Update documentation** when adding features
362
+
363
+ ---
364
+
365
+ _Generated by AI Flow - Desktop Edition_
366
+ _Last Updated: {{GENERATION_DATE}}_