mindsystem-cc 3.3.3 → 3.6.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 (31) hide show
  1. package/README.md +65 -1
  2. package/agents/ms-code-simplifier.md +1 -0
  3. package/agents/ms-flutter-code-quality.md +168 -0
  4. package/agents/ms-flutter-reviewer.md +210 -0
  5. package/agents/ms-flutter-simplifier.md +12 -118
  6. package/bin/install.js +444 -85
  7. package/commands/ms/audit-milestone.md +209 -0
  8. package/commands/ms/do-work.md +7 -7
  9. package/commands/ms/execute-phase.md +5 -5
  10. package/commands/ms/research-project.md +10 -4
  11. package/mindsystem/templates/config.json +5 -1
  12. package/mindsystem/workflows/do-work.md +23 -23
  13. package/mindsystem/workflows/execute-phase.md +20 -20
  14. package/mindsystem/workflows/map-codebase.md +12 -6
  15. package/package.json +3 -2
  16. package/skills/flutter-code-quality/SKILL.md +142 -0
  17. package/skills/flutter-code-simplification/SKILL.md +102 -0
  18. package/skills/flutter-senior-review/AGENTS.md +869 -0
  19. package/skills/flutter-senior-review/SKILL.md +205 -0
  20. package/skills/flutter-senior-review/principles/dependencies-data-not-callbacks.md +75 -0
  21. package/skills/flutter-senior-review/principles/dependencies-provider-tree.md +85 -0
  22. package/skills/flutter-senior-review/principles/dependencies-temporal-coupling.md +97 -0
  23. package/skills/flutter-senior-review/principles/pragmatism-consistent-error-handling.md +130 -0
  24. package/skills/flutter-senior-review/principles/pragmatism-speculative-generality.md +91 -0
  25. package/skills/flutter-senior-review/principles/state-data-clumps.md +64 -0
  26. package/skills/flutter-senior-review/principles/state-invalid-states.md +53 -0
  27. package/skills/flutter-senior-review/principles/state-single-source-of-truth.md +68 -0
  28. package/skills/flutter-senior-review/principles/state-type-hierarchies.md +75 -0
  29. package/skills/flutter-senior-review/principles/structure-composition-over-config.md +105 -0
  30. package/skills/flutter-senior-review/principles/structure-shared-visual-patterns.md +107 -0
  31. package/skills/flutter-senior-review/principles/structure-wrapper-pattern.md +90 -0
@@ -0,0 +1,142 @@
1
+ ---
2
+ name: flutter-code-quality
3
+ description: Flutter/Dart code quality, widget organization, and folder structure guidelines. Use when reviewing, refactoring, or cleaning up Flutter code after implementation.
4
+ license: MIT
5
+ metadata:
6
+ author: forgeblast
7
+ version: "1.0.0"
8
+ date: January 2026
9
+ argument-hint: <file-or-pattern>
10
+ ---
11
+
12
+ # Flutter Code Quality
13
+
14
+ Comprehensive guidelines for Flutter/Dart code quality, widget organization, and folder structure. Combines pattern-level rules (anti-patterns, idioms) with structural guidance (build method organization, folder conventions).
15
+
16
+ ## How It Works
17
+
18
+ 1. Fetch flutter-code-quality-guidelines.md from the gist URL below (always fresh)
19
+ 2. Apply embedded widget organization and folder structure rules
20
+ 3. Check files against all guidelines
21
+ 4. Output findings in terse `file:line` format
22
+
23
+ ## Code Quality Guidelines (Remote)
24
+
25
+ Fetch fresh guidelines before each review:
26
+
27
+ ```
28
+ https://gist.githubusercontent.com/rolandtolnay/edf9ea7d5adf218f45accb3411f0627c/raw/flutter-code-quality-guidelines.md
29
+ ```
30
+
31
+ Use WebFetch to retrieve. Contains: anti-patterns, widget patterns, state management, collections, hooks, theme/styling, etc.
32
+
33
+ ## Widget Organization Guidelines (Embedded)
34
+
35
+ ### Build Method Structure
36
+
37
+ Order inside `build()`:
38
+ 1. Providers (reads/watches)
39
+ 2. Hooks (if using flutter_hooks)
40
+ 3. Derived variables needed for rendering
41
+ 4. Widget variables (in render order)
42
+
43
+ ### When to Use What
44
+
45
+ | Scenario | Pattern |
46
+ |----------|---------|
47
+ | Widget always shown, no conditions | Local variable: `final header = Container(...);` |
48
+ | Widget depends on condition/null check | Builder function: `Widget? _buildContent() { if (data == null) return null; ... }` |
49
+ | Subtree is large, reusable, or has own state | Extract to standalone widget in own file |
50
+ | Function needs 3 or fewer params | Define outside `build()` as class method |
51
+ | Function needs 4+ params (esp. hooks) | Define inside `build()` to capture scope |
52
+
53
+ ### Rules
54
+
55
+ - **No file-private widgets** - If big enough to be a widget, it gets its own file
56
+ - **Define local variables in render order** - Top-to-bottom matches screen layout
57
+ - **Extract non-trivial conditions** - `final canSubmit = isValid && !isLoading && selectedId != null;`
58
+ - **Pass `WidgetRef` only** when function needs both ref and context - Use `ref.context` inside
59
+
60
+ ### Async UX Conventions
61
+
62
+ - **Button loading** - Watch provider state, not separate `useState<bool>`
63
+ - **Retriable errors** - Listen to provider, show toast on error, user retries by tapping again
64
+ - **First-load errors** - Render error view with retry button that invalidates provider
65
+
66
+ ### Sorting/Filtering
67
+
68
+ - Simple options: Use enum with computed properties
69
+ - Options with behavior: Use sealed class
70
+ - Complex multi-field filtering: Dedicated `Filter` class
71
+
72
+ ## Folder Structure Guidelines (Embedded)
73
+
74
+ ### Core Rules
75
+
76
+ 1. **Organize by feature** - Each feature gets its own folder
77
+ 2. **Screens at feature root** - `account_screen.dart`, `edit_account_screen.dart`
78
+ 3. **Create subfolders only when justified:**
79
+ - `widgets/` when 2+ reusable widgets exist
80
+ - `providers/` when 2+ provider files exist
81
+ - `domain/` usually always (models, repositories)
82
+ 4. **Split large features into subfeatures** - Each subfeature follows same rules
83
+
84
+ ### Example
85
+
86
+ ```
87
+ lib/features/
88
+ account/
89
+ account_screen.dart
90
+ edit_account_screen.dart
91
+ widgets/
92
+ account_avatar.dart
93
+ account_form.dart
94
+ providers/
95
+ account_provider.dart
96
+ domain/
97
+ account.dart
98
+ account_repository.dart
99
+ ```
100
+
101
+ ## Application Priority
102
+
103
+ When reviewing code, apply in this order:
104
+
105
+ 1. **Code Quality Patterns** (from fetched gist) - Anti-patterns, idioms, provider patterns
106
+ 2. **Widget Organization** (above) - Build structure, extraction rules, async UX
107
+ 3. **Folder Structure** (above) - File placement, feature boundaries
108
+
109
+ ## Anti-Patterns Quick Reference
110
+
111
+ Flag these patterns (details in fetched guidelines):
112
+
113
+ - `useState<bool>` for loading states
114
+ - Manual try-catch in provider actions
115
+ - `.toList()..sort()` instead of `.sorted()`
116
+ - `_handleAction(ref, controller, user, state)` with 4+ params
117
+ - Hardcoded hex colors
118
+ - Deep `lib/features/x/presentation/` directories
119
+ - Barrel files that only re-export
120
+ - Boolean flags instead of sealed classes
121
+ - Magic numbers scattered across widgets
122
+ - `where((e) => e.status == Status.active)` instead of computed property
123
+ - Generic provider names like `expansionVisibilityProvider`
124
+ - `.asData?.value` instead of `.value`
125
+
126
+ ## Output Format
127
+
128
+ Group by file. Use `file:line` format. Terse findings.
129
+
130
+ ```text
131
+ ## lib/home/home_screen.dart
132
+
133
+ lib/home/home_screen.dart:42 - useState for loading state -> use provider
134
+ lib/home/home_screen.dart:67 - .toList()..sort() -> .sorted()
135
+ lib/home/home_screen.dart:89 - hardcoded Color(0xFF...) -> context.color.*
136
+
137
+ ## lib/models/user.dart
138
+
139
+ pass
140
+ ```
141
+
142
+ State issue + location. Skip explanation unless fix non-obvious. No preamble.
@@ -0,0 +1,102 @@
1
+ ---
2
+ name: flutter-code-simplification
3
+ description: Flutter/Dart code simplification principles. Use when simplifying, refactoring, or cleaning up Flutter code for clarity and maintainability.
4
+ license: MIT
5
+ metadata:
6
+ author: forgeblast
7
+ version: "1.0.0"
8
+ date: January 2026
9
+ argument-hint: <file-or-pattern>
10
+ ---
11
+
12
+ # Flutter Code Simplification
13
+
14
+ Principles and patterns for simplifying Flutter/Dart code. Simplification means making code easier to reason about — not making it shorter at the cost of clarity.
15
+
16
+ ## Core Philosophy
17
+
18
+ **Clarity over brevity.** Explicit code is often better than compact code. The goal is code that's easy to read, understand, and maintain without changing what it does.
19
+
20
+ ## Principles
21
+
22
+ ### 1. Preserve Functionality
23
+
24
+ Never change what the code does — only how it does it. All original features, outputs, and behaviors must remain intact.
25
+
26
+ ### 2. Enhance Clarity
27
+
28
+ - Reduce unnecessary complexity and nesting
29
+ - Eliminate redundant code and abstractions
30
+ - Improve readability through clear naming
31
+ - Consolidate related logic and duplicates (DRY)
32
+ - Choose clarity over brevity — explicit code is often better than compact code
33
+
34
+ ### 3. Maintain Balance
35
+
36
+ Avoid over-simplification that could:
37
+ - Create overly clever solutions that are hard to understand
38
+ - Combine too many concerns into single functions/components
39
+ - Remove helpful abstractions that improve code organization
40
+ - Prioritize "fewer lines" over readability
41
+ - Make code harder to debug or extend
42
+
43
+ ### 4. Apply Judgment
44
+
45
+ Use expertise to determine what improves the code. These principles guide decisions — they are not a checklist. If a change doesn't clearly improve clarity while preserving behavior, don't make it.
46
+
47
+ ## Flutter Patterns
48
+
49
+ Common opportunities in Flutter/Dart code. Apply when they genuinely improve clarity.
50
+
51
+ ### State & Data
52
+
53
+ | Pattern | Simplification |
54
+ |---------|----------------|
55
+ | Scattered boolean flags | Sealed class variants with switch expressions (when it consolidates and clarifies) |
56
+ | Same parameters repeated across functions | Records or typed classes |
57
+ | Manual try-catch in providers | `AsyncValue.guard()` with centralized error handling |
58
+ | Async operations without mount check | Check `ref.mounted` after async operations |
59
+
60
+ ### Widget Structure
61
+
62
+ | Pattern | Simplification |
63
+ |---------|----------------|
64
+ | Large `build()` methods | Extract into local variables or builder methods |
65
+ | Widgets with many boolean parameters | Consider composition or typed mode objects |
66
+ | Unordered build() | Keep order: providers → hooks → derived values → widget tree |
67
+
68
+ ### Collections
69
+
70
+ | Pattern | Simplification |
71
+ |---------|----------------|
72
+ | Mutation patterns | Immutable methods (`.sorted()`, `.where()`, etc.) |
73
+ | Null-unsafe access | `firstWhereOrNull` with fallbacks |
74
+ | Repeated enum switches | Computed properties on the enum itself |
75
+
76
+ ### Code Organization
77
+
78
+ | Pattern | Simplification |
79
+ |---------|----------------|
80
+ | Duplicated logic across files | Extract to shared location |
81
+ | Related methods scattered in class | Group by concern |
82
+ | Unnecessary indirection (factories creating one type, wrappers adding no behavior) | Use concrete types directly |
83
+
84
+ **Exception:** API layer interfaces with implementation in same file are intentional — interface provides at-a-glance documentation.
85
+
86
+ ## Output Format
87
+
88
+ Group by file. Use `file:line` format. Terse findings.
89
+
90
+ ```text
91
+ ## lib/home/home_screen.dart
92
+
93
+ lib/home/home_screen.dart:42 - scattered booleans -> sealed class
94
+ lib/home/home_screen.dart:67 - .toList()..sort() -> .sorted()
95
+ lib/home/home_screen.dart:120 - large build() -> extract builder methods
96
+
97
+ ## lib/models/user.dart
98
+
99
+ pass
100
+ ```
101
+
102
+ State issue + location. Skip explanation unless fix non-obvious. No preamble.