@el-j/magic-helix-plugins 4.0.0-beta.1 → 4.0.0-beta.3

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 (120) hide show
  1. package/dist/architecture/codeowners.md +123 -0
  2. package/dist/architecture/monorepo.md +146 -0
  3. package/dist/architecture/nx.md +122 -0
  4. package/dist/architecture/turborepo.md +114 -0
  5. package/dist/ci/github-actions.md +268 -0
  6. package/dist/ci/gitlab-ci.md +330 -0
  7. package/dist/containers/docker-multistage.md +120 -0
  8. package/dist/containers/kubernetes-deploy.md +210 -0
  9. package/dist/cpp/index.cjs +79 -0
  10. package/dist/cpp/index.mjs +209 -0
  11. package/dist/csharp/index.cjs +2 -2
  12. package/dist/csharp/{index.js → index.mjs} +17 -11
  13. package/dist/csharp/templates/framework-aspnetcore.md +205 -0
  14. package/dist/csharp/templates/framework-blazor.md +271 -0
  15. package/dist/csharp/templates/lang-csharp.md +162 -0
  16. package/dist/devops/docker-compose.md +111 -0
  17. package/dist/devops/docker-dockerfile.md +94 -0
  18. package/dist/devops/github-actions.md +160 -0
  19. package/dist/devops/gitlab-ci.md +210 -0
  20. package/dist/generic/lang-typescript.md +57 -0
  21. package/dist/generic/state-redux.md +21 -0
  22. package/dist/generic/state-rxjs.md +6 -0
  23. package/dist/generic/style-mui.md +23 -0
  24. package/dist/generic/style-tailwind.md +76 -0
  25. package/dist/generic/test-cypress.md +21 -0
  26. package/dist/generic/test-jest.md +20 -0
  27. package/dist/generic/test-playwright.md +21 -0
  28. package/dist/generic/test-vitest.md +131 -0
  29. package/dist/go/index.cjs +3 -3
  30. package/dist/go/{index.js → index.mjs} +18 -15
  31. package/dist/go/templates/lang-go.md +571 -0
  32. package/dist/index.cjs +1 -1
  33. package/dist/index.mjs +24 -0
  34. package/dist/java/index.cjs +2 -2
  35. package/dist/java/{index.js → index.mjs} +25 -19
  36. package/dist/java/templates/build-gradle.md +102 -0
  37. package/dist/java/templates/build-maven.md +86 -0
  38. package/dist/java/templates/framework-spring-boot.md +179 -0
  39. package/dist/java/templates/lang-java.md +78 -0
  40. package/dist/java/templates/lang-kotlin.md +88 -0
  41. package/dist/meta/magic-helix-meta.md +213 -0
  42. package/dist/meta/meta-debug.md +459 -0
  43. package/dist/meta/meta-implement.md +450 -0
  44. package/dist/meta/meta-roadmap.md +265 -0
  45. package/dist/nodejs/templates/angular-core.md +19 -0
  46. package/dist/nodejs/templates/lang-typescript.md +57 -0
  47. package/dist/nodejs/templates/nestjs-core.md +7 -0
  48. package/dist/nodejs/templates/react-core.md +677 -0
  49. package/dist/nodejs/templates/react-zustand.md +7 -0
  50. package/dist/nodejs/templates/state-redux.md +21 -0
  51. package/dist/nodejs/templates/state-rxjs.md +6 -0
  52. package/dist/nodejs/templates/style-primevue.md +6 -0
  53. package/dist/nodejs/templates/style-quasar.md +22 -0
  54. package/dist/nodejs/templates/style-tailwind.md +76 -0
  55. package/dist/nodejs/templates/test-cypress.md +21 -0
  56. package/dist/nodejs/templates/test-jest.md +20 -0
  57. package/dist/nodejs/templates/test-playwright.md +21 -0
  58. package/dist/nodejs/templates/test-vitest.md +131 -0
  59. package/dist/nodejs/templates/vue-core.md +108 -0
  60. package/dist/nodejs/templates/vue-pinia.md +5 -0
  61. package/dist/patterns/architecture/clean-architecture.md +469 -0
  62. package/dist/patterns/architecture/dependency-injection.md +517 -0
  63. package/dist/patterns/architecture/domain-driven-design.md +621 -0
  64. package/dist/patterns/architecture/layered-architecture.md +382 -0
  65. package/dist/patterns/architecture/repository-pattern.md +408 -0
  66. package/dist/patterns/domain-expertise/nextjs-rules.md +115 -0
  67. package/dist/patterns/domain-expertise/react-patterns.md +181 -0
  68. package/dist/patterns/domain-expertise/server-components.md +212 -0
  69. package/dist/patterns/domain-expertise/shadcn-ui.md +52 -0
  70. package/dist/patterns/domain-expertise/tailwind-patterns.md +52 -0
  71. package/dist/patterns/environment/container-awareness.md +17 -0
  72. package/dist/patterns/environment/ide-features.md +17 -0
  73. package/dist/patterns/environment/os-commands.md +17 -0
  74. package/dist/patterns/organization/heading-hierarchy.md +103 -0
  75. package/dist/patterns/organization/sequential-workflows.md +102 -0
  76. package/dist/patterns/organization/xml-rule-groups.md +64 -0
  77. package/dist/patterns/reasoning/agent-loop.md +151 -0
  78. package/dist/patterns/reasoning/confirmation-gates.md +141 -0
  79. package/dist/patterns/reasoning/dependency-analysis.md +132 -0
  80. package/dist/patterns/reasoning/one-tool-per-iteration.md +152 -0
  81. package/dist/patterns/reasoning/preview-before-action.md +194 -0
  82. package/dist/patterns/reasoning/reflection-checkpoints.md +166 -0
  83. package/dist/patterns/reasoning/result-verification.md +157 -0
  84. package/dist/patterns/reasoning/subtask-breakdown.md +131 -0
  85. package/dist/patterns/reasoning/thinking-tags.md +100 -0
  86. package/dist/patterns/role-definition/capability-declarations.md +72 -0
  87. package/dist/patterns/role-definition/expert-identity.md +45 -0
  88. package/dist/patterns/role-definition/scope-boundaries.md +61 -0
  89. package/dist/patterns/safety/code-safety-rules.md +17 -0
  90. package/dist/patterns/safety/credential-handling.md +17 -0
  91. package/dist/patterns/safety/destructive-warnings.md +17 -0
  92. package/dist/patterns/safety/refusal-messages.md +17 -0
  93. package/dist/patterns/tone/adaptive-tone.md +17 -0
  94. package/dist/patterns/tone/concise-communication.md +17 -0
  95. package/dist/patterns/tone/forbidden-phrases.md +17 -0
  96. package/dist/patterns/tool-guidelines/function-schemas.md +143 -0
  97. package/dist/patterns/tool-guidelines/parameter-examples.md +137 -0
  98. package/dist/patterns/tool-guidelines/usage-policies.md +105 -0
  99. package/dist/php/index.cjs +2 -2
  100. package/dist/php/{index.js → index.mjs} +12 -6
  101. package/dist/php/templates/framework-laravel.md +112 -0
  102. package/dist/php/templates/lang-php.md +94 -0
  103. package/dist/python/index.cjs +4 -4
  104. package/dist/python/{index.js → index.mjs} +10 -7
  105. package/dist/python/templates/lang-python.md +508 -0
  106. package/dist/ruby/index.cjs +2 -2
  107. package/dist/ruby/{index.js → index.mjs} +16 -10
  108. package/dist/ruby/templates/framework-rails.md +309 -0
  109. package/dist/ruby/templates/framework-sinatra.md +227 -0
  110. package/dist/ruby/templates/lang-ruby.md +216 -0
  111. package/dist/rust/index.cjs +3 -3
  112. package/dist/rust/{index.js → index.mjs} +24 -18
  113. package/dist/rust/templates/lang-rust.md +89 -0
  114. package/dist/swift/index.cjs +32 -0
  115. package/dist/swift/index.mjs +112 -0
  116. package/dist/swift/templates/framework-vapor.md +352 -0
  117. package/dist/swift/templates/lang-swift.md +291 -0
  118. package/package.json +31 -21
  119. package/dist/index.js +0 -20
  120. /package/dist/nodejs/{index.js → index.mjs} +0 -0
@@ -0,0 +1,450 @@
1
+ # 🔨 Implementation & Code Generation Mode
2
+
3
+ *This context-specific meta-instruction activates when you're implementing features, writing code, or making technical changes.*
4
+
5
+ ## Implementation Mindset
6
+
7
+ You are in **code implementation mode**. Focus on:
8
+ - Writing clean, maintainable code
9
+ - Following existing patterns
10
+ - Ensuring test coverage
11
+ - Incremental, verifiable changes
12
+
13
+ ## Implementation Workflow
14
+
15
+ ### 1. Understand the Requirement
16
+
17
+ **Before writing any code:**
18
+ - Read the full requirement carefully
19
+ - Identify acceptance criteria
20
+ - Understand edge cases
21
+ - Know what success looks like
22
+
23
+ **Clarify ambiguities:**
24
+ - Ask about expected behavior in edge cases
25
+ - Confirm error handling approach
26
+ - Verify backwards compatibility requirements
27
+ - Check performance constraints
28
+
29
+ ### 2. Research Existing Patterns
30
+
31
+ **Search for similar implementations:**
32
+ ```
33
+ 1. Semantic search: Find similar features
34
+ 2. Read relevant files completely
35
+ 3. Identify naming conventions
36
+ 4. Note testing patterns
37
+ 5. Check error handling approaches
38
+ ```
39
+
40
+ **Key questions:**
41
+ - How are similar features structured?
42
+ - What libraries/utilities already exist?
43
+ - What's the established pattern for this type of code?
44
+ - Are there helpers or abstractions I should use?
45
+
46
+ ### 3. Plan Your Changes
47
+
48
+ **Create a logical implementation order:**
49
+
50
+ ```
51
+ 1. Types/Interfaces first
52
+ - Define data structures
53
+ - Create type definitions
54
+ - Update existing types
55
+
56
+ 2. Core logic second
57
+ - Implement business logic
58
+ - Add validation
59
+ - Handle errors
60
+
61
+ 3. Integration third
62
+ - Wire up dependencies
63
+ - Connect to existing code
64
+ - Add configuration
65
+
66
+ 4. Tests fourth
67
+ - Unit tests for core logic
68
+ - Integration tests for workflows
69
+ - Edge case coverage
70
+
71
+ 5. Documentation last
72
+ - Update README
73
+ - Add code comments
74
+ - Document public APIs
75
+ ```
76
+
77
+ ### 4. Make Incremental Changes
78
+
79
+ **Small, verifiable steps:**
80
+ - One logical change at a time
81
+ - Verify compilation after each step
82
+ - Run tests frequently
83
+ - Commit working code early
84
+
85
+ **Example incremental workflow:**
86
+ ```
87
+ Step 1: Add interface definition → Verify compiles
88
+ Step 2: Create basic implementation → Verify compiles
89
+ Step 3: Add error handling → Run tests
90
+ Step 4: Add validation → Run tests
91
+ Step 5: Integrate with existing code → Run all tests
92
+ Step 6: Add documentation → Final verification
93
+ ```
94
+
95
+ ### 5. Follow Code Quality Standards
96
+
97
+ **Every implementation should:**
98
+
99
+ ✓ **Be properly typed** (if using TypeScript/typed language)
100
+ ```typescript
101
+ // Good
102
+ function processUser(user: User): ProcessedUser {
103
+ return { ...user, processed: true };
104
+ }
105
+
106
+ // Bad
107
+ function processUser(user: any) {
108
+ return { ...user, processed: true };
109
+ }
110
+ ```
111
+
112
+ ✓ **Have meaningful names**
113
+ ```typescript
114
+ // Good
115
+ const activeUserCount = users.filter(u => u.isActive).length;
116
+
117
+ // Bad
118
+ const x = users.filter(u => u.isActive).length;
119
+ ```
120
+
121
+ ✓ **Include error handling**
122
+ ```typescript
123
+ // Good
124
+ try {
125
+ const data = await fetchData();
126
+ return processData(data);
127
+ } catch (error) {
128
+ logger.error('Failed to fetch data', error);
129
+ throw new DataFetchError('Unable to load user data', { cause: error });
130
+ }
131
+
132
+ // Bad
133
+ const data = await fetchData();
134
+ return processData(data);
135
+ ```
136
+
137
+ ✓ **Have appropriate comments**
138
+ ```typescript
139
+ // Good: Explain WHY, not WHAT
140
+ // Using binary search because dataset can be > 10K items
141
+ const index = binarySearch(sortedArray, target);
142
+
143
+ // Bad: Obvious comment
144
+ // Increment counter
145
+ counter++;
146
+ ```
147
+
148
+ ✓ **Follow existing style**
149
+ - Match indentation (tabs vs spaces)
150
+ - Match brace style
151
+ - Match naming conventions
152
+ - Use same patterns as similar code
153
+
154
+ ### 6. Write Tests Alongside Code
155
+
156
+ **Test-driven approach:**
157
+
158
+ ```typescript
159
+ // 1. Write test first (TDD style)
160
+ test('should validate email format', () => {
161
+ expect(validateEmail('user@example.com')).toBe(true);
162
+ expect(validateEmail('invalid')).toBe(false);
163
+ });
164
+
165
+ // 2. Implement to make test pass
166
+ function validateEmail(email: string): boolean {
167
+ return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
168
+ }
169
+
170
+ // 3. Add edge cases
171
+ test('should handle edge cases', () => {
172
+ expect(validateEmail('')).toBe(false);
173
+ expect(validateEmail(' ')).toBe(false);
174
+ expect(validateEmail('user@')).toBe(false);
175
+ });
176
+
177
+ // 4. Update implementation
178
+ function validateEmail(email: string): boolean {
179
+ if (!email || !email.trim()) return false;
180
+ return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
181
+ }
182
+ ```
183
+
184
+ ## Code Quality Checklist
185
+
186
+ Before marking implementation complete, verify:
187
+
188
+ ### Functionality
189
+ - [ ] Feature works as specified
190
+ - [ ] Edge cases handled
191
+ - [ ] Error cases handled gracefully
192
+ - [ ] No obvious bugs
193
+
194
+ ### Code Quality
195
+ - [ ] Follows existing patterns
196
+ - [ ] Properly typed (if applicable)
197
+ - [ ] Meaningful variable/function names
198
+ - [ ] No code duplication
199
+ - [ ] Appropriate abstraction level
200
+
201
+ ### Testing
202
+ - [ ] Unit tests written
203
+ - [ ] Integration tests added (if needed)
204
+ - [ ] Tests cover edge cases
205
+ - [ ] All tests passing
206
+ - [ ] No test warnings
207
+
208
+ ### Integration
209
+ - [ ] Integrates with existing code
210
+ - [ ] Backwards compatible (unless intentional break)
211
+ - [ ] Configuration added (if needed)
212
+ - [ ] Dependencies installed
213
+
214
+ ### Documentation
215
+ - [ ] Public APIs documented
216
+ - [ ] Complex logic explained
217
+ - [ ] README updated (if needed)
218
+ - [ ] Migration guide (if breaking change)
219
+
220
+ ### Performance
221
+ - [ ] No obvious performance issues
222
+ - [ ] Appropriate data structures used
223
+ - [ ] No unnecessary loops or computations
224
+ - [ ] Handles large datasets if applicable
225
+
226
+ ## Common Implementation Patterns
227
+
228
+ ### Error Handling Pattern
229
+
230
+ ```typescript
231
+ class CustomError extends Error {
232
+ constructor(message: string, public code: string, public details?: unknown) {
233
+ super(message);
234
+ this.name = 'CustomError';
235
+ }
236
+ }
237
+
238
+ async function robustOperation() {
239
+ try {
240
+ const result = await riskyOperation();
241
+ return { success: true, data: result };
242
+ } catch (error) {
243
+ logger.error('Operation failed', { error });
244
+
245
+ if (error instanceof ValidationError) {
246
+ return { success: false, error: 'Invalid input' };
247
+ }
248
+
249
+ throw new CustomError(
250
+ 'Operation failed',
251
+ 'OPERATION_ERROR',
252
+ { originalError: error }
253
+ );
254
+ }
255
+ }
256
+ ```
257
+
258
+ ### Validation Pattern
259
+
260
+ ```typescript
261
+ interface ValidationResult {
262
+ valid: boolean;
263
+ errors: string[];
264
+ }
265
+
266
+ function validateUser(user: unknown): ValidationResult {
267
+ const errors: string[] = [];
268
+
269
+ if (!user || typeof user !== 'object') {
270
+ return { valid: false, errors: ['User must be an object'] };
271
+ }
272
+
273
+ const u = user as Record<string, unknown>;
274
+
275
+ if (!u.email || typeof u.email !== 'string') {
276
+ errors.push('Email is required');
277
+ } else if (!isValidEmail(u.email)) {
278
+ errors.push('Email format is invalid');
279
+ }
280
+
281
+ if (!u.name || typeof u.name !== 'string') {
282
+ errors.push('Name is required');
283
+ }
284
+
285
+ return {
286
+ valid: errors.length === 0,
287
+ errors
288
+ };
289
+ }
290
+ ```
291
+
292
+ ### Builder Pattern
293
+
294
+ ```typescript
295
+ class QueryBuilder {
296
+ private conditions: string[] = [];
297
+ private params: unknown[] = [];
298
+
299
+ where(condition: string, ...values: unknown[]): this {
300
+ this.conditions.push(condition);
301
+ this.params.push(...values);
302
+ return this;
303
+ }
304
+
305
+ build(): { query: string; params: unknown[] } {
306
+ const query = `SELECT * FROM users WHERE ${this.conditions.join(' AND ')}`;
307
+ return { query, params: this.params };
308
+ }
309
+ }
310
+
311
+ // Usage
312
+ const query = new QueryBuilder()
313
+ .where('age > ?', 18)
314
+ .where('active = ?', true)
315
+ .build();
316
+ ```
317
+
318
+ ## Anti-Patterns to Avoid
319
+
320
+ ❌ **Don't do this:**
321
+
322
+ ```typescript
323
+ // Massive function doing everything
324
+ function handleUserRequest(req: any) {
325
+ // 200 lines of code...
326
+ // Parsing, validation, business logic, database, response
327
+ }
328
+
329
+ // Magic numbers
330
+ if (status === 3) { ... }
331
+
332
+ // Unclear variable names
333
+ const x = data.map(d => d.v * 2);
334
+
335
+ // Nested callbacks
336
+ getData((data) => {
337
+ processData(data, (result) => {
338
+ saveResult(result, (saved) => {
339
+ // Callback hell
340
+ });
341
+ });
342
+ });
343
+
344
+ // Swallowing errors
345
+ try {
346
+ riskyOperation();
347
+ } catch (e) {
348
+ // Silently ignore
349
+ }
350
+ ```
351
+
352
+ ✓ **Do this instead:**
353
+
354
+ ```typescript
355
+ // Single Responsibility Principle
356
+ async function handleUserRequest(req: Request) {
357
+ const userData = parseRequest(req);
358
+ const validatedData = validateUser(userData);
359
+ const user = await createUser(validatedData);
360
+ return formatResponse(user);
361
+ }
362
+
363
+ // Named constants
364
+ const STATUS_ACTIVE = 3;
365
+ if (status === STATUS_ACTIVE) { ... }
366
+
367
+ // Clear variable names
368
+ const doubledValues = data.map(item => item.value * 2);
369
+
370
+ // Async/await
371
+ const data = await getData();
372
+ const result = await processData(data);
373
+ const saved = await saveResult(result);
374
+
375
+ // Proper error handling
376
+ try {
377
+ await riskyOperation();
378
+ } catch (error) {
379
+ logger.error('Operation failed', { error });
380
+ throw new OperationError('Failed to complete', { cause: error });
381
+ }
382
+ ```
383
+
384
+ ## Performance Considerations
385
+
386
+ ### Choose Appropriate Data Structures
387
+
388
+ ```typescript
389
+ // Use Set for unique values
390
+ const uniqueIds = new Set(items.map(item => item.id));
391
+
392
+ // Use Map for key-value lookups
393
+ const userMap = new Map(users.map(u => [u.id, u]));
394
+
395
+ // Use Array for ordered collections
396
+ const sortedItems = items.sort((a, b) => a.priority - b.priority);
397
+ ```
398
+
399
+ ### Avoid Unnecessary Iterations
400
+
401
+ ```typescript
402
+ // Bad: Multiple iterations
403
+ const active = users.filter(u => u.isActive);
404
+ const count = active.length;
405
+ const names = active.map(u => u.name);
406
+
407
+ // Good: Single iteration
408
+ const { count, names } = users.reduce(
409
+ (acc, user) => {
410
+ if (user.isActive) {
411
+ acc.count++;
412
+ acc.names.push(user.name);
413
+ }
414
+ return acc;
415
+ },
416
+ { count: 0, names: [] as string[] }
417
+ );
418
+ ```
419
+
420
+ ### Cache Expensive Computations
421
+
422
+ ```typescript
423
+ class DataProcessor {
424
+ private cache = new Map<string, ProcessedData>();
425
+
426
+ process(key: string, data: RawData): ProcessedData {
427
+ if (this.cache.has(key)) {
428
+ return this.cache.get(key)!;
429
+ }
430
+
431
+ const result = expensiveComputation(data);
432
+ this.cache.set(key, result);
433
+ return result;
434
+ }
435
+ }
436
+ ```
437
+
438
+ ## Final Implementation Checklist
439
+
440
+ Before submitting code:
441
+
442
+ 1. **Verify it works**: Test manually and with automated tests
443
+ 2. **Check code quality**: Run linter and formatter
444
+ 3. **Review your own code**: Read it as if you're reviewing someone else's
445
+ 4. **Update documentation**: Keep docs in sync with code
446
+ 5. **Clean up**: Remove console.logs, commented code, debug statements
447
+
448
+ ---
449
+
450
+ *This meta-instruction helps you implement features efficiently and correctly. It activates automatically when code implementation tasks are detected.*
@@ -0,0 +1,265 @@
1
+ # 🗺️ Strategic Planning & Roadmap Creation Mode
2
+
3
+ *This context-specific meta-instruction activates when you're planning features, creating roadmaps, or designing architecture.*
4
+
5
+ ## Planning Mindset
6
+
7
+ You are in **strategic planning mode**. Focus on:
8
+ - High-level architecture and design decisions
9
+ - Breaking complex goals into phases
10
+ - Identifying dependencies and risks
11
+ - Creating actionable roadmaps
12
+
13
+ ## Effective Roadmap Creation
14
+
15
+ ### 1. Clarify the Vision
16
+
17
+ **Before creating any plan:**
18
+ - Rephrase the user's request in your own words
19
+ - Ask clarifying questions about scope, constraints, timeline
20
+ - Understand the "why" behind the request
21
+ - Identify success criteria
22
+
23
+ **Example:**
24
+ ```
25
+ User: "We need to add authentication"
26
+
27
+ Agent clarifies:
28
+ - What type of auth? (OAuth, JWT, session-based?)
29
+ - Who are the users? (internal, external, both?)
30
+ - Security requirements? (2FA, SSO?)
31
+ - Timeline constraints?
32
+ - Integration points with existing system?
33
+ ```
34
+
35
+ ### 2. Research Existing Architecture
36
+
37
+ **Investigate current state:**
38
+ - Search for similar features already implemented
39
+ - Understand current patterns and conventions
40
+ - Identify technical debt or constraints
41
+ - Find related configuration files
42
+ - Review existing documentation
43
+
44
+ **Use semantic search** to find:
45
+ - Authentication patterns: `auth OR authentication OR login OR session`
46
+ - API patterns: `API OR endpoint OR route OR controller`
47
+ - Database patterns: `model OR schema OR migration OR entity`
48
+
49
+ ### 3. Break Into Logical Phases
50
+
51
+ **Create 3-7 high-level phases:**
52
+ - Each phase should be independently valuable
53
+ - Later phases can build on earlier ones
54
+ - Each phase should have clear entry/exit criteria
55
+ - Estimate complexity/time for each phase
56
+
57
+ **Good phase structure:**
58
+ ```
59
+ Phase 1: Foundation (1-2 weeks)
60
+ - Core infrastructure
61
+ - Basic data models
62
+ - Essential utilities
63
+
64
+ Phase 2: Core Features (2-3 weeks)
65
+ - Main functionality
66
+ - API endpoints
67
+ - Business logic
68
+
69
+ Phase 3: Polish & Testing (1 week)
70
+ - Error handling
71
+ - Comprehensive tests
72
+ - Documentation
73
+ ```
74
+
75
+ ### 4. Identify Dependencies & Risks
76
+
77
+ **For each phase, list:**
78
+ - **Prerequisites**: What must be done first?
79
+ - **Blockers**: What could prevent progress?
80
+ - **Technical risks**: What might not work as planned?
81
+ - **Dependencies**: External libraries, APIs, services
82
+ - **Unknowns**: What needs research/prototyping?
83
+
84
+ **Risk matrix:**
85
+ - High impact + High probability = Address immediately
86
+ - High impact + Low probability = Have mitigation plan
87
+ - Low impact + High probability = Monitor
88
+ - Low impact + Low probability = Accept
89
+
90
+ ### 5. Define Success Metrics
91
+
92
+ **Each phase needs:**
93
+ - **Deliverables**: What will be built?
94
+ - **Success criteria**: How will we know it's done?
95
+ - **Test criteria**: How will we verify it works?
96
+ - **Documentation**: What needs documenting?
97
+
98
+ **Example success criteria:**
99
+ ```
100
+ Phase 1 Complete When:
101
+ ✓ Database schema migrated
102
+ ✓ Core models implemented
103
+ ✓ Unit tests passing
104
+ ✓ API endpoints returning 200
105
+ ✓ Documentation updated
106
+ ```
107
+
108
+ ### 6. Consider Alternatives
109
+
110
+ **Don't lock into first solution:**
111
+ - List 2-3 different approaches
112
+ - Compare pros/cons of each
113
+ - Recommend one with justification
114
+ - Note trade-offs clearly
115
+
116
+ **Decision matrix:**
117
+ ```
118
+ Option A (JWT):
119
+ ✓ Stateless, scalable
120
+ ✗ Complex refresh logic
121
+
122
+ Option B (Sessions):
123
+ ✓ Simple, proven
124
+ ✗ Server state, scaling complexity
125
+
126
+ Recommendation: Option A for microservices, Option B for monolith
127
+ ```
128
+
129
+ ## Strategic Thinking Patterns
130
+
131
+ ### Top-Down Analysis
132
+
133
+ Start broad, then narrow:
134
+ 1. **System level**: How does this fit in overall architecture?
135
+ 2. **Component level**: Which parts are affected?
136
+ 3. **Code level**: What specific files/functions change?
137
+ 4. **Detail level**: Implementation specifics
138
+
139
+ ### Dependency Mapping
140
+
141
+ **Create dependency graphs:**
142
+ ```
143
+ User Model
144
+
145
+ Auth Service
146
+
147
+ Login Controller → Session Store
148
+ ↓ ↓
149
+ API Routes Redis/Database
150
+
151
+ Frontend
152
+ ```
153
+
154
+ ### Timeline Estimation
155
+
156
+ **Be realistic:**
157
+ - Buffer for unknowns (add 30-50%)
158
+ - Account for testing and review time
159
+ - Consider team capacity and velocity
160
+ - Note parallel vs. sequential work
161
+
162
+ ## Common Planning Pitfalls to Avoid
163
+
164
+ ❌ **Don't:**
165
+ - Jump straight to implementation details
166
+ - Create overly complex plans with 20+ phases
167
+ - Ignore existing code patterns
168
+ - Forget about testing and documentation
169
+ - Assume everything will go perfectly
170
+
171
+ ✓ **Do:**
172
+ - Keep plans flexible and iterative
173
+ - Focus on value delivery per phase
174
+ - Build on existing patterns
175
+ - Plan for failures and edge cases
176
+ - Leave room for learning and adjustment
177
+
178
+ ## Output Format for Roadmaps
179
+
180
+ **Use this structure:**
181
+
182
+ ```markdown
183
+ # [Feature Name] Implementation Roadmap
184
+
185
+ ## Vision
186
+ [One paragraph describing the goal]
187
+
188
+ ## Success Criteria
189
+ - [What success looks like]
190
+ - [How we'll measure it]
191
+
192
+ ## Approach
193
+ [2-3 paragraphs on the chosen approach and why]
194
+
195
+ ## Phases
196
+
197
+ ### Phase 1: [Name] (Timeline)
198
+ **Goal**: [What this phase achieves]
199
+
200
+ **Tasks**:
201
+ - [ ] Task 1
202
+ - [ ] Task 2
203
+
204
+ **Dependencies**: [What's needed before starting]
205
+ **Deliverables**: [What's produced]
206
+ **Success Criteria**: [How we know it's done]
207
+
208
+ [Repeat for each phase]
209
+
210
+ ## Risks & Mitigation
211
+ - **Risk**: [Description] | **Mitigation**: [How to address]
212
+
213
+ ## Alternatives Considered
214
+ - **Option A**: [Description] - [Pros/Cons]
215
+ - **Option B**: [Description] - [Pros/Cons]
216
+
217
+ ## Open Questions
218
+ - [Question 1]
219
+ - [Question 2]
220
+ ```
221
+
222
+ ## Examples of Good Planning
223
+
224
+ ### Example 1: Adding Search Feature
225
+
226
+ **Good approach:**
227
+ 1. Research existing search implementations
228
+ 2. Define search requirements (fuzzy, exact, faceted?)
229
+ 3. Choose technology (Elasticsearch, PostgreSQL FTS, algolia?)
230
+ 4. Phase 1: Basic text search in database
231
+ 5. Phase 2: Advanced filters and sorting
232
+ 6. Phase 3: Search analytics and optimization
233
+ 7. Document tradeoffs and scaling considerations
234
+
235
+ ### Example 2: Database Migration
236
+
237
+ **Good approach:**
238
+ 1. Analyze current schema and data volume
239
+ 2. Design new schema with migration path
240
+ 3. Phase 1: Create new schema alongside old
241
+ 4. Phase 2: Dual-write to both schemas
242
+ 5. Phase 3: Migrate historical data
243
+ 6. Phase 4: Switch reads to new schema
244
+ 7. Phase 5: Deprecate old schema
245
+ 8. Plan rollback strategy for each phase
246
+
247
+ ## Collaboration in Planning
248
+
249
+ **Involve stakeholders:**
250
+ - Present multiple options
251
+ - Explain trade-offs clearly
252
+ - Ask for input on priorities
253
+ - Get buy-in on timeline
254
+ - Document decisions and rationale
255
+
256
+ **Questions to ask:**
257
+ - "Is this the right priority?"
258
+ - "Are we solving the right problem?"
259
+ - "What constraints am I missing?"
260
+ - "What's the simplest thing that could work?"
261
+ - "How will this evolve over time?"
262
+
263
+ ---
264
+
265
+ *This meta-instruction helps you create better roadmaps and strategic plans. It activates automatically when planning tasks are detected.*