mindsystem-cc 3.0.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 (139) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +501 -0
  3. package/agents/ms-codebase-mapper.md +739 -0
  4. package/agents/ms-debugger.md +1184 -0
  5. package/agents/ms-designer.md +414 -0
  6. package/agents/ms-executor.md +760 -0
  7. package/agents/ms-integration-checker.md +423 -0
  8. package/agents/ms-milestone-auditor.md +448 -0
  9. package/agents/ms-mock-generator.md +182 -0
  10. package/agents/ms-plan-checker.md +746 -0
  11. package/agents/ms-research-synthesizer.md +248 -0
  12. package/agents/ms-researcher.md +962 -0
  13. package/agents/ms-roadmapper.md +606 -0
  14. package/agents/ms-verifier.md +779 -0
  15. package/agents/ms-verify-fixer.md +124 -0
  16. package/bin/install.js +296 -0
  17. package/commands/ms/add-phase.md +207 -0
  18. package/commands/ms/add-todo.md +182 -0
  19. package/commands/ms/audit-milestone.md +318 -0
  20. package/commands/ms/check-phase.md +162 -0
  21. package/commands/ms/check-todos.md +217 -0
  22. package/commands/ms/complete-milestone.md +137 -0
  23. package/commands/ms/create-roadmap.md +273 -0
  24. package/commands/ms/debug.md +149 -0
  25. package/commands/ms/define-requirements.md +121 -0
  26. package/commands/ms/design-phase.md +341 -0
  27. package/commands/ms/discuss-milestone.md +48 -0
  28. package/commands/ms/discuss-phase.md +60 -0
  29. package/commands/ms/do-work.md +90 -0
  30. package/commands/ms/execute-phase.md +289 -0
  31. package/commands/ms/help.md +623 -0
  32. package/commands/ms/insert-phase.md +227 -0
  33. package/commands/ms/list-phase-assumptions.md +50 -0
  34. package/commands/ms/map-codebase.md +71 -0
  35. package/commands/ms/new-milestone.md +193 -0
  36. package/commands/ms/new-project.md +338 -0
  37. package/commands/ms/pause-work.md +123 -0
  38. package/commands/ms/plan-milestone-gaps.md +285 -0
  39. package/commands/ms/plan-phase.md +105 -0
  40. package/commands/ms/progress.md +370 -0
  41. package/commands/ms/remove-phase.md +338 -0
  42. package/commands/ms/research-phase.md +175 -0
  43. package/commands/ms/research-project.md +339 -0
  44. package/commands/ms/resume-work.md +40 -0
  45. package/commands/ms/review-design.md +484 -0
  46. package/commands/ms/simplify-flutter.md +193 -0
  47. package/commands/ms/update.md +159 -0
  48. package/commands/ms/verify-work.md +92 -0
  49. package/commands/ms/whats-new.md +124 -0
  50. package/mindsystem/references/checkpoints.md +788 -0
  51. package/mindsystem/references/continuation-format.md +255 -0
  52. package/mindsystem/references/debugging/debugging-mindset.md +11 -0
  53. package/mindsystem/references/debugging/hypothesis-testing.md +11 -0
  54. package/mindsystem/references/debugging/investigation-techniques.md +11 -0
  55. package/mindsystem/references/debugging/verification-patterns.md +11 -0
  56. package/mindsystem/references/debugging/when-to-research.md +11 -0
  57. package/mindsystem/references/git-integration.md +254 -0
  58. package/mindsystem/references/goal-backward.md +286 -0
  59. package/mindsystem/references/mock-patterns.md +294 -0
  60. package/mindsystem/references/plan-format.md +473 -0
  61. package/mindsystem/references/principles.md +73 -0
  62. package/mindsystem/references/questioning.md +140 -0
  63. package/mindsystem/references/research-pitfalls.md +233 -0
  64. package/mindsystem/references/scope-estimation.md +256 -0
  65. package/mindsystem/references/tdd.md +263 -0
  66. package/mindsystem/references/verification-patterns.md +595 -0
  67. package/mindsystem/templates/DEBUG.md +159 -0
  68. package/mindsystem/templates/UAT.md +403 -0
  69. package/mindsystem/templates/adhoc-summary.md +153 -0
  70. package/mindsystem/templates/codebase/architecture.md +255 -0
  71. package/mindsystem/templates/codebase/concerns.md +310 -0
  72. package/mindsystem/templates/codebase/conventions.md +307 -0
  73. package/mindsystem/templates/codebase/integrations.md +280 -0
  74. package/mindsystem/templates/codebase/stack.md +186 -0
  75. package/mindsystem/templates/codebase/structure.md +285 -0
  76. package/mindsystem/templates/codebase/testing.md +480 -0
  77. package/mindsystem/templates/config.json +26 -0
  78. package/mindsystem/templates/context.md +140 -0
  79. package/mindsystem/templates/continue-here.md +78 -0
  80. package/mindsystem/templates/debug-subagent-prompt.md +91 -0
  81. package/mindsystem/templates/design-iteration.md +208 -0
  82. package/mindsystem/templates/design.md +417 -0
  83. package/mindsystem/templates/discovery.md +146 -0
  84. package/mindsystem/templates/milestone-archive.md +123 -0
  85. package/mindsystem/templates/milestone-context.md +93 -0
  86. package/mindsystem/templates/milestone.md +115 -0
  87. package/mindsystem/templates/phase-prompt.md +574 -0
  88. package/mindsystem/templates/project.md +184 -0
  89. package/mindsystem/templates/requirements.md +231 -0
  90. package/mindsystem/templates/research-project/ARCHITECTURE.md +204 -0
  91. package/mindsystem/templates/research-project/FEATURES.md +147 -0
  92. package/mindsystem/templates/research-project/PITFALLS.md +200 -0
  93. package/mindsystem/templates/research-project/STACK.md +120 -0
  94. package/mindsystem/templates/research-project/SUMMARY.md +170 -0
  95. package/mindsystem/templates/research-subagent-prompt.md +92 -0
  96. package/mindsystem/templates/research.md +529 -0
  97. package/mindsystem/templates/roadmap.md +214 -0
  98. package/mindsystem/templates/state.md +224 -0
  99. package/mindsystem/templates/summary.md +269 -0
  100. package/mindsystem/templates/user-setup.md +323 -0
  101. package/mindsystem/templates/verification-report.md +322 -0
  102. package/mindsystem/workflows/complete-milestone.md +759 -0
  103. package/mindsystem/workflows/create-milestone.md +203 -0
  104. package/mindsystem/workflows/debug.md +14 -0
  105. package/mindsystem/workflows/define-requirements.md +330 -0
  106. package/mindsystem/workflows/diagnose-issues.md +241 -0
  107. package/mindsystem/workflows/discovery-phase.md +293 -0
  108. package/mindsystem/workflows/discuss-milestone.md +310 -0
  109. package/mindsystem/workflows/discuss-phase.md +237 -0
  110. package/mindsystem/workflows/do-work.md +359 -0
  111. package/mindsystem/workflows/execute-phase.md +644 -0
  112. package/mindsystem/workflows/execute-plan.md +1828 -0
  113. package/mindsystem/workflows/generate-mocks.md +187 -0
  114. package/mindsystem/workflows/list-phase-assumptions.md +178 -0
  115. package/mindsystem/workflows/map-codebase.md +289 -0
  116. package/mindsystem/workflows/plan-phase.md +876 -0
  117. package/mindsystem/workflows/research-phase.md +17 -0
  118. package/mindsystem/workflows/research-project.md +23 -0
  119. package/mindsystem/workflows/resume-project.md +311 -0
  120. package/mindsystem/workflows/transition.md +564 -0
  121. package/mindsystem/workflows/verify-phase.md +629 -0
  122. package/mindsystem/workflows/verify-work.md +823 -0
  123. package/package.json +32 -0
  124. package/scripts/generate-phase-patch.sh +169 -0
  125. package/scripts/ms-lookup/README.md +112 -0
  126. package/scripts/ms-lookup/ms_lookup/__init__.py +3 -0
  127. package/scripts/ms-lookup/ms_lookup/__main__.py +6 -0
  128. package/scripts/ms-lookup/ms_lookup/backends/__init__.py +6 -0
  129. package/scripts/ms-lookup/ms_lookup/backends/context7.py +219 -0
  130. package/scripts/ms-lookup/ms_lookup/backends/perplexity.py +145 -0
  131. package/scripts/ms-lookup/ms_lookup/cache.py +48 -0
  132. package/scripts/ms-lookup/ms_lookup/cli.py +219 -0
  133. package/scripts/ms-lookup/ms_lookup/config.py +23 -0
  134. package/scripts/ms-lookup/ms_lookup/errors.py +24 -0
  135. package/scripts/ms-lookup/ms_lookup/output.py +49 -0
  136. package/scripts/ms-lookup/ms_lookup/tokens.py +56 -0
  137. package/scripts/ms-lookup/pyproject.toml +17 -0
  138. package/scripts/ms-lookup/uv.lock +207 -0
  139. package/scripts/ms-lookup-wrapper.sh +21 -0
@@ -0,0 +1,484 @@
1
+ ---
2
+ name: ms:review-design
3
+ description: Audit and improve design of already-implemented features using quality-forcing principles
4
+ argument-hint: "[phase, file path, feature name, or description]"
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Bash
10
+ - Glob
11
+ - Grep
12
+ - AskUserQuestion
13
+ ---
14
+
15
+ <objective>
16
+ Review and improve the design of already-implemented features, applying the same quality-forcing principles used in `/ms:design-phase`.
17
+
18
+ **When to use:**
19
+ - Features implemented before Mindsystem was added (no DESIGN.md exists)
20
+ - Features where `/ms:design-phase` was skipped
21
+ - Periodic design quality audits on existing code
22
+ - After receiving user feedback that UI "feels off"
23
+
24
+ **What this does:**
25
+ 1. Identifies target code from arguments
26
+ 2. Analyzes against design quality criteria
27
+ 3. Presents improvements with benefits and trade-offs
28
+ 4. Applies user-approved changes
29
+ 5. Runs platform-specific verification
30
+ 6. Creates DESIGN-REVIEW.md report
31
+
32
+ **Not a replacement for:** `/ms:design-phase` — use that BEFORE implementing new features.
33
+ </objective>
34
+
35
+ <context>
36
+ **User's review request:**
37
+ $ARGUMENTS
38
+
39
+ **Current git status:**
40
+ !`git status --short`
41
+ </context>
42
+
43
+ <process>
44
+
45
+ ## Phase 1: Identify Target Code
46
+
47
+ ### Step 1.1: Parse Arguments
48
+
49
+ Analyze `$ARGUMENTS` to determine what code to review:
50
+
51
+ - **Phase number** (e.g., `4`, `04`) → Find phase directory, read SUMMARY.md files for implemented code
52
+ - **File path** (e.g., `lib/features/home/home_screen.dart`) → Read and analyze that file
53
+ - **Feature/area name** (e.g., `home feature`, `authentication`) → Search for relevant files in that area
54
+ - **Description** (e.g., `the code I just wrote`) → Check recent git changes or conversation context
55
+ - **Empty or unclear** → Use AskUserQuestion:
56
+
57
+ ```
58
+ Question: "What code should I review for design improvements?"
59
+ Options:
60
+ - "Uncommitted changes" - Review files with uncommitted modifications
61
+ - "Specific file" - I'll provide a file path
62
+ - "Recent feature work" - Review files from recent commits
63
+ - "GSD phase" - Review all code from a specific phase
64
+ ```
65
+
66
+ ### Step 1.2: Resolve Phase Directory (if phase-based)
67
+
68
+ ```bash
69
+ # Find phase directory
70
+ PHASE_DIR=$(ls -d .planning/phases/${PHASE_ARG}-* 2>/dev/null | head -1)
71
+
72
+ # Find SUMMARY files to identify implemented code
73
+ ls "$PHASE_DIR"/*-SUMMARY.md 2>/dev/null
74
+ ```
75
+
76
+ Parse SUMMARY.md files to extract:
77
+ - Files created/modified
78
+ - Features implemented
79
+ - Components added
80
+
81
+ ### Step 1.3: Gather Target Files
82
+
83
+ Based on scope:
84
+ - Read target file(s)
85
+ - For features, also read related files (widgets, providers, models)
86
+ - For phases, collect all files mentioned in SUMMARY.md
87
+
88
+ Store file list for analysis.
89
+
90
+ ## Phase 2: Load Context Chain
91
+
92
+ ### Step 2.1: Mandatory Context
93
+
94
+ ```bash
95
+ # Load PROJECT.md for product context
96
+ cat .planning/PROJECT.md 2>/dev/null
97
+
98
+ # Load ROADMAP.md for phase requirements (if phase-based)
99
+ grep -A30 "Phase ${PHASE_ARG}:" .planning/ROADMAP.md 2>/dev/null
100
+ ```
101
+
102
+ Extract from PROJECT.md:
103
+ - What This Is (product type → determines commercial benchmark)
104
+ - Core Value (design must serve this)
105
+ - Context (target audience)
106
+ - Constraints (platform, technical limits)
107
+
108
+ ### Step 2.2: Check for Existing DESIGN.md
109
+
110
+ ```bash
111
+ # Check for existing design
112
+ ls .planning/phases/${PHASE_ARG}-*/*-DESIGN.md 2>/dev/null
113
+ ```
114
+
115
+ **If exists:** Load as baseline for comparison
116
+ **If not exists:** Flag for retroactive creation
117
+
118
+ ### Step 2.3: Optional Context
119
+
120
+ **implement-ui skill (if exists):**
121
+ ```bash
122
+ ls .claude/skills/*implement-ui* 2>/dev/null
123
+ ```
124
+
125
+ If exists, load as authoritative source for existing patterns.
126
+
127
+ **Codebase analysis:**
128
+ - Detect platform (Flutter, React, etc.)
129
+ - Find existing component/theme files
130
+ - Document discovered patterns
131
+
132
+ ## Phase 3: Analyze for Design Improvements
133
+
134
+ Review target code against these quality dimensions:
135
+
136
+ ### 3.1: Visual Quality
137
+
138
+ Apply quality-forcing patterns from `ai-driven-ui-design-system.md`:
139
+
140
+ **Commercial benchmark check:**
141
+ > "Does this look like a commercial $50-200 [product type] — intentional decisions, not defaults?"
142
+
143
+ **Anti-pattern detection:**
144
+ - Generic dark gray with blue accents (unless specifically requested)
145
+ - Default spacing with no intentional rhythm
146
+ - Controls that look like styled HTML inputs
147
+ - Typography using only system fonts without spacing compensation
148
+ - Elements that appear positioned without thought
149
+
150
+ **Check for:**
151
+ - Color palette character (distinctive vs generic)
152
+ - Intentional spacing (consistent scale vs arbitrary)
153
+ - Visual hierarchy (size/weight/contrast differentiation)
154
+ - Refined controls (proper states, sizing, polish)
155
+
156
+ ### 3.2: UX Flows
157
+
158
+ **Check for:**
159
+ - Complete user journeys (entry → action → feedback → completion)
160
+ - Loading states (skeleton, spinner, or progressive)
161
+ - Error states (clear messages, recovery path)
162
+ - Empty states (helpful guidance when no data)
163
+ - Edge cases (offline, timeout, validation)
164
+
165
+ ### 3.3: Platform Compliance
166
+
167
+ **Flutter/Mobile:**
168
+ - Touch targets ≥ 48dp (Android) / 44pt (iOS)
169
+ - Safe area insets respected
170
+ - Text sizes ≥ 16sp for body text
171
+ - Contrast ratios meet WCAG AA (4.5:1 body, 3:1 large)
172
+
173
+ **Web:**
174
+ - Touch targets ≥ 44px for interactive elements
175
+ - Keyboard navigation functional
176
+ - Focus states visible
177
+ - Responsive breakpoints defined
178
+
179
+ ### 3.4: Code Organization
180
+
181
+ **Flutter-specific (from simplify-flutter patterns):**
182
+ - Large `build()` methods → extract to local variables or builder methods
183
+ - Complex subtrees → separate widget files
184
+ - Scattered boolean flags → sealed class variants
185
+ - Manual try-catch → `AsyncValue.guard()`
186
+ - Mutation patterns → immutable methods
187
+
188
+ **General:**
189
+ - Consistent naming conventions
190
+ - Related logic grouped together
191
+ - Clear separation of concerns
192
+
193
+ ### 3.5: Pattern Alignment
194
+
195
+ If implement-ui skill or codebase patterns exist:
196
+ - Check for consistent color usage
197
+ - Check for consistent component patterns
198
+ - Check for consistent spacing scale
199
+ - Identify deviations that should be aligned
200
+
201
+ ## Phase 4: Create Retroactive DESIGN.md (If Missing)
202
+
203
+ **If no existing DESIGN.md:**
204
+
205
+ Document current implementation patterns:
206
+
207
+ ```bash
208
+ mkdir -p "$PHASE_DIR"
209
+ ```
210
+
211
+ Create `{phase}-DESIGN.md` following the standard template:
212
+
213
+ 1. **Visual Identity** — Extract philosophy from implemented code
214
+ 2. **Screen Layouts** — Create ASCII wireframes from actual screens
215
+ 3. **Component Specifications** — Document existing component patterns
216
+ 4. **UX Flows** — Map current user journeys
217
+ 5. **Design System Decisions** — Extract colors, typography, spacing with rationale
218
+ 6. **Platform-Specific Notes** — Document current responsive/platform handling
219
+ 7. **Verification Criteria** — Define observable behaviors
220
+
221
+ Write to: `.planning/phases/{phase}-{slug}/{phase}-DESIGN.md`
222
+
223
+ ## Phase 5: Present Improvements
224
+
225
+ For each identified improvement, document:
226
+
227
+ ### Improvement Format
228
+
229
+ ```markdown
230
+ ### [Category]: [Brief Description]
231
+
232
+ **Current state:**
233
+ [What exists now]
234
+
235
+ **Proposed change:**
236
+ [What should change]
237
+
238
+ **Benefits:**
239
+ - [Benefit 1]
240
+ - [Benefit 2]
241
+
242
+ **Trade-offs:**
243
+ - [Any functionality lost or changed]
244
+ - [Migration effort if significant]
245
+ - [Risk factors]
246
+
247
+ **Affected files:**
248
+ - [file1.dart]
249
+ - [file2.dart]
250
+
251
+ **Effort:** [low | medium | high]
252
+ ```
253
+
254
+ ### Categories
255
+
256
+ Group improvements by:
257
+ 1. **Visual Quality** — Color, spacing, typography, hierarchy
258
+ 2. **UX Completeness** — States, flows, error handling
259
+ 3. **Platform Compliance** — Touch targets, accessibility
260
+ 4. **Code Organization** — Widget extraction, pattern consistency
261
+ 5. **Pattern Alignment** — Consistency with existing design system
262
+
263
+ ### Present to User
264
+
265
+ Display all improvements with summary:
266
+
267
+ ```markdown
268
+ ## Design Review: [Scope]
269
+
270
+ Found **N improvements** across M files.
271
+
272
+ ### Summary
273
+
274
+ | Category | Count | Effort |
275
+ |----------|-------|--------|
276
+ | Visual Quality | X | [avg effort] |
277
+ | UX Completeness | X | [avg effort] |
278
+ | Platform Compliance | X | [avg effort] |
279
+ | Code Organization | X | [avg effort] |
280
+ | Pattern Alignment | X | [avg effort] |
281
+
282
+ ### Improvements
283
+
284
+ [List all improvements with full details]
285
+ ```
286
+
287
+ ### User Selection
288
+
289
+ Use AskUserQuestion to confirm scope:
290
+
291
+ ```
292
+ Question: "Which improvements should I apply?"
293
+ Options:
294
+ - "All improvements" - Apply everything identified
295
+ - "Visual + UX only" - Focus on user-facing changes
296
+ - "Platform compliance only" - Fix accessibility/sizing issues
297
+ - "Let me select" - I'll specify which ones
298
+ ```
299
+
300
+ If "Let me select": Present numbered list, ask for comma-separated numbers.
301
+
302
+ ## Phase 6: Apply Approved Changes
303
+
304
+ For each approved improvement:
305
+
306
+ 1. **Read current file state**
307
+ 2. **Apply the change** using Edit tool
308
+ 3. **Log what was changed** for summary
309
+
310
+ **Apply principles:**
311
+ - One logical change at a time
312
+ - Preserve all public APIs
313
+ - Maintain existing test coverage expectations
314
+ - Don't introduce new dependencies without flagging
315
+
316
+ ## Phase 7: Run Verification
317
+
318
+ ### Step 7.1: Detect Platform
319
+
320
+ ```bash
321
+ # Flutter
322
+ if [ -f "pubspec.yaml" ]; then
323
+ echo "Platform: Flutter"
324
+ fi
325
+
326
+ # Web (Node/npm)
327
+ if [ -f "package.json" ]; then
328
+ echo "Platform: Web"
329
+ fi
330
+ ```
331
+
332
+ ### Step 7.2: Run Platform-Specific Checks
333
+
334
+ **Flutter:**
335
+ ```bash
336
+ flutter analyze
337
+ flutter test
338
+ ```
339
+
340
+ **Web (React/Next/etc.):**
341
+ ```bash
342
+ npm run lint 2>/dev/null || npx eslint . 2>/dev/null
343
+ npm test 2>/dev/null || echo "No test script"
344
+ ```
345
+
346
+ ### Step 7.3: Handle Failures
347
+
348
+ If verification fails:
349
+ 1. Identify which change caused the failure
350
+ 2. Offer to revert that specific change
351
+ 3. Re-run verification
352
+
353
+ ## Phase 8: Write Design Review Report
354
+
355
+ Write to: `.planning/phases/{phase}-{slug}/{phase}-DESIGN-REVIEW.md`
356
+
357
+ ```markdown
358
+ ---
359
+ status: complete
360
+ phase: XX-name
361
+ reviewed: [ISO timestamp]
362
+ scope: [files/features reviewed]
363
+ ---
364
+
365
+ # Design Review: Phase [X] - [Name]
366
+
367
+ **Reviewed:** [date]
368
+ **Scope:** [what was reviewed]
369
+ **Platform:** [detected platform]
370
+
371
+ ## Review Summary
372
+
373
+ | Category | Found | Applied | Skipped |
374
+ |----------|-------|---------|---------|
375
+ | Visual Quality | X | X | X |
376
+ | UX Completeness | X | X | X |
377
+ | Platform Compliance | X | X | X |
378
+ | Code Organization | X | X | X |
379
+ | Pattern Alignment | X | X | X |
380
+
381
+ **Total:** X improvements identified, Y applied, Z skipped
382
+
383
+ ## Changes Applied
384
+
385
+ ### 1. [Category]: [Description]
386
+
387
+ **File:** `path/to/file`
388
+ **Change:** [what was changed]
389
+ **Rationale:** [why this improves design]
390
+
391
+ ### 2. [Next change...]
392
+
393
+ ## Improvements Skipped
394
+
395
+ [If any were skipped by user choice]
396
+
397
+ ### 1. [Category]: [Description]
398
+
399
+ **Reason skipped:** [user's reason or "Not selected"]
400
+
401
+ ## Verification Results
402
+
403
+ - **flutter analyze:** [pass/fail]
404
+ - **flutter test:** [pass/fail]
405
+
406
+ [If failures, document what was reverted]
407
+
408
+ ## Remaining Recommendations
409
+
410
+ [Any improvements that couldn't be auto-applied or need manual attention]
411
+
412
+ ## Retroactive Documentation
413
+
414
+ [If DESIGN.md was created]
415
+ - Created: `.planning/phases/{phase}-{slug}/{phase}-DESIGN.md`
416
+ - Documents current implementation patterns for future reference
417
+
418
+ ---
419
+
420
+ *Review completed: [timestamp]*
421
+ ```
422
+
423
+ ## Phase 9: Present Results
424
+
425
+ ```markdown
426
+ ## Design Review Complete
427
+
428
+ **Scope:** [what was reviewed]
429
+ **Improvements:** X applied, Y skipped
430
+
431
+ ### Verification
432
+ - flutter analyze: [pass/fail]
433
+ - flutter test: [pass/fail]
434
+
435
+ ### Files Modified
436
+ - [list of files changed]
437
+
438
+ ### Report
439
+ `.planning/phases/{phase}-{slug}/{phase}-DESIGN-REVIEW.md`
440
+
441
+ ---
442
+
443
+ ## Next Steps
444
+
445
+ - Review changes in editor
446
+ - Run app to verify visual changes
447
+ - Commit when satisfied: `git add . && git commit -m "design: apply review improvements"`
448
+ ```
449
+
450
+ </process>
451
+
452
+ <quality_forcing>
453
+ Apply these patterns throughout the review:
454
+
455
+ **Commercial Benchmark:**
456
+ > "This must look like a commercial $50-200 [product type] — intentional decisions, not defaults."
457
+
458
+ **Pre-emptive Criticism:**
459
+ > "Assume someone will say 'This looks like generic AI output.' Does the current design prove them wrong?"
460
+
461
+ **Accountability Check:**
462
+ > "Could a professional designer look at this and say it's skilled work?"
463
+
464
+ **Explicit Anti-Patterns:**
465
+ - Generic dark gray + blue accents
466
+ - Default spacing with no rhythm
467
+ - Controls that look like styled HTML inputs
468
+ - Same-sized everything (no hierarchy)
469
+ - Centered everything (lazy layout)
470
+ </quality_forcing>
471
+
472
+ <success_criteria>
473
+ - [ ] Target code scope clarified (via arguments or AskUserQuestion)
474
+ - [ ] Context chain loaded (PROJECT.md, DESIGN.md if exists, implement-ui skill)
475
+ - [ ] Code analyzed across all quality dimensions
476
+ - [ ] Retroactive DESIGN.md created if missing
477
+ - [ ] Improvements presented with benefits AND trade-offs
478
+ - [ ] User selected which improvements to apply
479
+ - [ ] Approved changes applied to code
480
+ - [ ] Platform-specific verification run (analyze/test)
481
+ - [ ] Failures handled (revert problematic changes)
482
+ - [ ] DESIGN-REVIEW.md report written to phase directory
483
+ - [ ] Clear summary provided with next steps
484
+ </success_criteria>
@@ -0,0 +1,193 @@
1
+ ---
2
+ name: ms:simplify-flutter
3
+ description: Simplify and refine Flutter/Dart code for clarity, consistency, and maintainability while preserving all functionality
4
+ argument-hint: [file path, feature name, or description of what to simplify]
5
+ ---
6
+
7
+ <objective>
8
+ Simplify Flutter/Dart code to improve clarity, consistency, and maintainability while preserving exact functionality.
9
+
10
+ You are an expert code simplification specialist. Your expertise lies in making code easier to read, understand, and maintain without changing what it does. You prioritize readable, explicit code over overly compact solutions.
11
+
12
+ **Core principle:** Simplification means making code easier to reason about—not making it shorter at the cost of clarity.
13
+ </objective>
14
+
15
+ <context>
16
+ **User's simplification request:**
17
+ $ARGUMENTS
18
+
19
+ **Current git status:**
20
+ !`git status --short`
21
+ </context>
22
+
23
+ <process>
24
+
25
+ ## Phase 1: Identify Target Code
26
+
27
+ ### Step 1.1: Parse Arguments
28
+
29
+ Analyze `$ARGUMENTS` to determine what code to simplify:
30
+
31
+ - **File path provided** (e.g., `lib/features/home/home_screen.dart`) → Read and analyze that file
32
+ - **Feature/area named** (e.g., `home feature`, `authentication`) → Search for relevant files in that area
33
+ - **Description provided** (e.g., `the code I just wrote`) → Check recent git changes or conversation context
34
+ - **Empty or unclear** → Use AskUserQuestion:
35
+
36
+ ```
37
+ Question: "What Flutter code should I simplify?"
38
+ Options:
39
+ - "Uncommitted changes" - Simplify files with uncommitted modifications
40
+ - "Specific file" - I'll provide a file path
41
+ - "Recent feature work" - Simplify files related to recent feature development
42
+ ```
43
+
44
+ ### Step 1.2: Gather Code
45
+
46
+ Based on the identified scope:
47
+ - Read the target file(s)
48
+ - For features, also read related files (widgets, providers, domain models)
49
+ - Understand the existing patterns and structure before making changes
50
+
51
+ ## Phase 2: Analyze for Simplification Opportunities
52
+
53
+ Review the code looking for opportunities to improve clarity without changing behavior.
54
+
55
+ ### What to Simplify
56
+
57
+ **Complexity reduction:**
58
+ - Deeply nested widget trees that could be extracted
59
+ - Complex conditionals that could use switch expressions or early returns
60
+ - Redundant null checks or unnecessary defensive code
61
+ - Overly clever one-liners that sacrifice readability
62
+
63
+ **Consistency improvements:**
64
+ - Inconsistent naming conventions
65
+ - Mixed patterns for similar operations
66
+ - Scattered logic that belongs together
67
+
68
+ **Clarity enhancements:**
69
+ - Unclear variable or method names
70
+ - Missing or misleading structure
71
+ - Business logic hidden in UI code that should be in domain/providers
72
+
73
+ ### What NOT to Simplify
74
+
75
+ **Preserve these:**
76
+ - Helpful abstractions that improve organization
77
+ - Clear, intentional patterns even if verbose
78
+ - Code that would become harder to debug if condensed
79
+ - Working error handling and edge case coverage
80
+
81
+ **Avoid these anti-patterns:**
82
+ - Nested ternaries (prefer switch/if-else chains)
83
+ - Dense one-liners that require mental unpacking
84
+ - Combining unrelated concerns to reduce line count
85
+ - Removing comments that explain non-obvious "why"
86
+
87
+ ### Flutter-Specific Guidance
88
+
89
+ **Widget Structure:**
90
+ - Large `build()` methods → extract into local variables (unconditional) or builder methods (conditional)
91
+ - Complex subtrees → separate widget files (no private widgets in same file)
92
+ - Keep build() order: providers → hooks → derived values → widget variables
93
+
94
+ **State & Providers:**
95
+ - Scattered boolean flags → sealed class variants with switch expressions
96
+ - Manual try-catch in providers → `AsyncValue.guard()` with centralized error handling
97
+ - Multiple loading states → single-action providers with derived `isLoading`
98
+ - Check `ref.mounted` after async operations
99
+
100
+ **Collections & Data:**
101
+ - Mutation patterns → immutable methods (`.sorted()`, `.where()`, etc.)
102
+ - Null-unsafe access → `firstWhereOrNull` with fallbacks
103
+ - Repeated enum switches → computed properties on the enum itself
104
+ - Presentation logic in widgets → domain extensions
105
+
106
+ **Code Organization:**
107
+ - Deep folder nesting → flat feature directories
108
+ - Barrel files that only re-export → direct imports
109
+ - Business rules scattered in UI → entity computed properties
110
+
111
+ ## Phase 3: Apply Simplifications
112
+
113
+ For each identified opportunity:
114
+
115
+ 1. **Verify preservation** - Confirm the change won't alter behavior
116
+ 2. **Make the edit** - Apply the simplification
117
+ 3. **Keep scope tight** - Only change what genuinely improves the code
118
+
119
+ **Edit principles:**
120
+ - One logical change at a time
121
+ - Preserve all public APIs
122
+ - Maintain existing test coverage expectations
123
+ - Don't introduce new dependencies
124
+
125
+ ## Phase 4: Verify No Regressions
126
+
127
+ After completing simplifications, run verification:
128
+
129
+ ### Step 4.1: Static Analysis
130
+
131
+ ```bash
132
+ fvm flutter analyze
133
+ ```
134
+
135
+ Fix any new analysis issues introduced by changes.
136
+
137
+ ### Step 4.2: Run Tests
138
+
139
+ ```bash
140
+ fvm flutter test
141
+ ```
142
+
143
+ If tests fail:
144
+ 1. Identify which simplification caused the failure
145
+ 2. Revert or fix that specific change
146
+ 3. Re-run tests until passing
147
+
148
+ ### Step 4.3: Summary
149
+
150
+ Report what was simplified:
151
+
152
+ **If changes were made:**
153
+ ```
154
+ ## Simplification Summary
155
+
156
+ **Files modified:** [count]
157
+ **Changes applied:** [count]
158
+
159
+ ### Changes
160
+
161
+ 1. `path/to/file.dart`
162
+ - [What was simplified and why]
163
+
164
+ 2. `path/to/other.dart`
165
+ - [What was simplified and why]
166
+
167
+ ### Verification
168
+ - flutter analyze: [pass/fail]
169
+ - flutter test: [pass/fail]
170
+ ```
171
+
172
+ **If no changes needed:**
173
+ ```
174
+ ## No Simplification Needed
175
+
176
+ Reviewed [files] and found no opportunities for simplification that would improve clarity without risking behavior changes.
177
+
178
+ The code already follows good patterns for:
179
+ - [Specific positive observation]
180
+ - [Another positive observation]
181
+ ```
182
+
183
+ </process>
184
+
185
+ <success_criteria>
186
+ - Target code scope clarified (via arguments or AskUserQuestion)
187
+ - Code read and analyzed before any changes
188
+ - Only genuine simplifications applied (clarity improvement, not just shorter)
189
+ - All functionality preserved - no behavior changes
190
+ - `flutter analyze` passes after changes
191
+ - `flutter test` passes after changes
192
+ - Clear summary provided (changes made or "no changes needed")
193
+ </success_criteria>