ai-flow-dev 2.6.0 → 2.7.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.
Files changed (161) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +570 -570
  3. package/package.json +73 -73
  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 +20 -20
  17. package/prompts/backend/flow-check-test.md +14 -14
  18. package/prompts/backend/flow-check.md +67 -67
  19. package/prompts/backend/flow-commit.md +119 -119
  20. package/prompts/backend/flow-docs-sync.md +354 -354
  21. package/prompts/backend/flow-work-feature.md +61 -61
  22. package/prompts/backend/flow-work-fix.md +46 -46
  23. package/prompts/backend/flow-work-refactor.md +48 -48
  24. package/prompts/backend/flow-work-resume.md +34 -34
  25. package/prompts/backend/flow-work.md +1286 -1023
  26. package/prompts/desktop/flow-build-phase-0.md +359 -359
  27. package/prompts/desktop/flow-build-phase-1.md +295 -295
  28. package/prompts/desktop/flow-build-phase-10.md +357 -357
  29. package/prompts/desktop/flow-build-phase-2.md +282 -282
  30. package/prompts/desktop/flow-build-phase-3.md +291 -291
  31. package/prompts/desktop/flow-build-phase-4.md +308 -308
  32. package/prompts/desktop/flow-build-phase-5.md +269 -269
  33. package/prompts/desktop/flow-build-phase-6.md +350 -350
  34. package/prompts/desktop/flow-build-phase-7.md +297 -297
  35. package/prompts/desktop/flow-build-phase-8.md +541 -541
  36. package/prompts/desktop/flow-build-phase-9.md +439 -439
  37. package/prompts/desktop/flow-build.md +156 -156
  38. package/prompts/desktop/flow-check-review.md +20 -20
  39. package/prompts/desktop/flow-check-test.md +14 -14
  40. package/prompts/desktop/flow-check.md +67 -67
  41. package/prompts/desktop/flow-commit.md +119 -119
  42. package/prompts/desktop/flow-docs-sync.md +354 -354
  43. package/prompts/desktop/flow-work-feature.md +61 -61
  44. package/prompts/desktop/flow-work-fix.md +46 -46
  45. package/prompts/desktop/flow-work-refactor.md +48 -48
  46. package/prompts/desktop/flow-work-resume.md +34 -34
  47. package/prompts/desktop/flow-work.md +1390 -1023
  48. package/prompts/frontend/flow-build-phase-0.md +425 -425
  49. package/prompts/frontend/flow-build-phase-1.md +626 -626
  50. package/prompts/frontend/flow-build-phase-10.md +33 -33
  51. package/prompts/frontend/flow-build-phase-2.md +573 -573
  52. package/prompts/frontend/flow-build-phase-3.md +782 -782
  53. package/prompts/frontend/flow-build-phase-4.md +554 -554
  54. package/prompts/frontend/flow-build-phase-5.md +703 -703
  55. package/prompts/frontend/flow-build-phase-6.md +524 -524
  56. package/prompts/frontend/flow-build-phase-7.md +1001 -1001
  57. package/prompts/frontend/flow-build-phase-8.md +872 -872
  58. package/prompts/frontend/flow-build-phase-9.md +94 -94
  59. package/prompts/frontend/flow-build.md +137 -137
  60. package/prompts/frontend/flow-check-review.md +20 -20
  61. package/prompts/frontend/flow-check-test.md +14 -14
  62. package/prompts/frontend/flow-check.md +67 -67
  63. package/prompts/frontend/flow-commit.md +119 -119
  64. package/prompts/frontend/flow-docs-sync.md +550 -550
  65. package/prompts/frontend/flow-work-feature.md +61 -61
  66. package/prompts/frontend/flow-work-fix.md +38 -38
  67. package/prompts/frontend/flow-work-refactor.md +48 -48
  68. package/prompts/frontend/flow-work-resume.md +34 -34
  69. package/prompts/frontend/flow-work.md +1320 -1027
  70. package/prompts/mobile/flow-build-phase-0.md +425 -425
  71. package/prompts/mobile/flow-build-phase-1.md +626 -626
  72. package/prompts/mobile/flow-build-phase-10.md +32 -32
  73. package/prompts/mobile/flow-build-phase-2.md +573 -573
  74. package/prompts/mobile/flow-build-phase-3.md +782 -782
  75. package/prompts/mobile/flow-build-phase-4.md +554 -554
  76. package/prompts/mobile/flow-build-phase-5.md +703 -703
  77. package/prompts/mobile/flow-build-phase-6.md +524 -524
  78. package/prompts/mobile/flow-build-phase-7.md +1001 -1001
  79. package/prompts/mobile/flow-build-phase-8.md +888 -888
  80. package/prompts/mobile/flow-build-phase-9.md +90 -90
  81. package/prompts/mobile/flow-build.md +135 -135
  82. package/prompts/mobile/flow-check-review.md +20 -20
  83. package/prompts/mobile/flow-check-test.md +14 -14
  84. package/prompts/mobile/flow-check.md +67 -67
  85. package/prompts/mobile/flow-commit.md +119 -119
  86. package/prompts/mobile/flow-docs-sync.md +620 -620
  87. package/prompts/mobile/flow-work-feature.md +61 -61
  88. package/prompts/mobile/flow-work-fix.md +46 -46
  89. package/prompts/mobile/flow-work-refactor.md +48 -48
  90. package/prompts/mobile/flow-work-resume.md +34 -34
  91. package/prompts/mobile/flow-work.md +1329 -1023
  92. package/prompts/shared/mermaid-guidelines.md +102 -102
  93. package/prompts/shared/scope-levels.md +114 -114
  94. package/prompts/shared/smart-skip-preflight.md +214 -214
  95. package/prompts/shared/story-points.md +55 -55
  96. package/prompts/shared/task-format.md +74 -74
  97. package/prompts/shared/task-summary-template.md +277 -277
  98. package/templates/AGENT.template.md +443 -443
  99. package/templates/backend/.clauderules.template +112 -112
  100. package/templates/backend/.cursorrules.template +102 -102
  101. package/templates/backend/README.template.md +2 -2
  102. package/templates/backend/ai-instructions.template.md +2 -2
  103. package/templates/backend/copilot-instructions.template.md +2 -2
  104. package/templates/backend/docs/api.template.md +320 -320
  105. package/templates/backend/docs/business-flows.template.md +97 -97
  106. package/templates/backend/docs/code-standards.template.md +2 -2
  107. package/templates/backend/docs/contributing.template.md +3 -3
  108. package/templates/backend/docs/data-model.template.md +520 -520
  109. package/templates/backend/docs/testing.template.md +2 -2
  110. package/templates/backend/project-brief.template.md +2 -2
  111. package/templates/backend/specs/configuration.template.md +2 -2
  112. package/templates/backend/specs/security.template.md +2 -2
  113. package/templates/desktop/.clauderules.template +112 -112
  114. package/templates/desktop/.cursorrules.template +102 -102
  115. package/templates/desktop/README.template.md +170 -170
  116. package/templates/desktop/ai-instructions.template.md +366 -366
  117. package/templates/desktop/copilot-instructions.template.md +140 -140
  118. package/templates/desktop/docs/docs/api.template.md +320 -320
  119. package/templates/desktop/docs/docs/architecture.template.md +724 -724
  120. package/templates/desktop/docs/docs/business-flows.template.md +102 -102
  121. package/templates/desktop/docs/docs/code-standards.template.md +792 -792
  122. package/templates/desktop/docs/docs/contributing.template.md +149 -149
  123. package/templates/desktop/docs/docs/data-model.template.md +520 -520
  124. package/templates/desktop/docs/docs/operations.template.md +720 -720
  125. package/templates/desktop/docs/docs/testing.template.md +722 -722
  126. package/templates/desktop/project-brief.template.md +150 -150
  127. package/templates/desktop/specs/specs/configuration.template.md +121 -121
  128. package/templates/desktop/specs/specs/security.template.md +392 -392
  129. package/templates/frontend/README.template.md +2 -2
  130. package/templates/frontend/ai-instructions.template.md +2 -2
  131. package/templates/frontend/docs/api-integration.template.md +362 -362
  132. package/templates/frontend/docs/components.template.md +2 -2
  133. package/templates/frontend/docs/error-handling.template.md +360 -360
  134. package/templates/frontend/docs/operations.template.md +107 -107
  135. package/templates/frontend/docs/performance.template.md +124 -124
  136. package/templates/frontend/docs/pwa.template.md +119 -119
  137. package/templates/frontend/docs/state-management.template.md +2 -2
  138. package/templates/frontend/docs/styling.template.md +2 -2
  139. package/templates/frontend/docs/testing.template.md +2 -2
  140. package/templates/frontend/project-brief.template.md +2 -2
  141. package/templates/frontend/specs/accessibility.template.md +95 -95
  142. package/templates/frontend/specs/configuration.template.md +2 -2
  143. package/templates/frontend/specs/security.template.md +175 -175
  144. package/templates/fullstack/README.template.md +252 -252
  145. package/templates/fullstack/ai-instructions.template.md +444 -444
  146. package/templates/fullstack/project-brief.template.md +157 -157
  147. package/templates/fullstack/specs/configuration.template.md +340 -340
  148. package/templates/mobile/README.template.md +167 -167
  149. package/templates/mobile/ai-instructions.template.md +196 -196
  150. package/templates/mobile/docs/app-store.template.md +135 -135
  151. package/templates/mobile/docs/architecture.template.md +63 -63
  152. package/templates/mobile/docs/native-features.template.md +94 -94
  153. package/templates/mobile/docs/navigation.template.md +59 -59
  154. package/templates/mobile/docs/offline-strategy.template.md +65 -65
  155. package/templates/mobile/docs/permissions.template.md +56 -56
  156. package/templates/mobile/docs/state-management.template.md +85 -85
  157. package/templates/mobile/docs/testing.template.md +109 -109
  158. package/templates/mobile/project-brief.template.md +69 -69
  159. package/templates/mobile/specs/build-configuration.template.md +91 -91
  160. package/templates/mobile/specs/deployment.template.md +92 -92
  161. package/templates/work.template.md +47 -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}}_