mindsystem-cc 3.3.3 → 3.5.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 (28) hide show
  1. package/README.md +65 -1
  2. package/agents/ms-code-simplifier.md +1 -0
  3. package/agents/ms-flutter-reviewer.md +210 -0
  4. package/agents/ms-flutter-simplifier.md +42 -101
  5. package/bin/install.js +8 -0
  6. package/commands/ms/audit-milestone.md +209 -0
  7. package/commands/ms/do-work.md +7 -7
  8. package/commands/ms/execute-phase.md +5 -5
  9. package/commands/ms/research-project.md +10 -4
  10. package/mindsystem/templates/config.json +5 -1
  11. package/mindsystem/workflows/do-work.md +23 -23
  12. package/mindsystem/workflows/execute-phase.md +20 -20
  13. package/mindsystem/workflows/map-codebase.md +12 -6
  14. package/package.json +3 -2
  15. package/skills/flutter-senior-review/AGENTS.md +869 -0
  16. package/skills/flutter-senior-review/SKILL.md +205 -0
  17. package/skills/flutter-senior-review/principles/dependencies-data-not-callbacks.md +75 -0
  18. package/skills/flutter-senior-review/principles/dependencies-provider-tree.md +85 -0
  19. package/skills/flutter-senior-review/principles/dependencies-temporal-coupling.md +97 -0
  20. package/skills/flutter-senior-review/principles/pragmatism-consistent-error-handling.md +130 -0
  21. package/skills/flutter-senior-review/principles/pragmatism-speculative-generality.md +91 -0
  22. package/skills/flutter-senior-review/principles/state-data-clumps.md +64 -0
  23. package/skills/flutter-senior-review/principles/state-invalid-states.md +53 -0
  24. package/skills/flutter-senior-review/principles/state-single-source-of-truth.md +68 -0
  25. package/skills/flutter-senior-review/principles/state-type-hierarchies.md +75 -0
  26. package/skills/flutter-senior-review/principles/structure-composition-over-config.md +105 -0
  27. package/skills/flutter-senior-review/principles/structure-shared-visual-patterns.md +107 -0
  28. package/skills/flutter-senior-review/principles/structure-wrapper-pattern.md +90 -0
package/README.md CHANGED
@@ -58,7 +58,8 @@ Deterministic chores live in scripts; language models do what they’re good at:
58
58
  - **Design phase**: `/ms:design-phase` generates a UI/UX spec (flows, components, wireframes) before implementation.
59
59
  - **Research tooling**: `scripts/ms-lookup/` can be used standalone or inside workflows.
60
60
  - **Enhanced verification**: better UAT batching and debugging support when gaps are found.
61
- - **Automatic code simplification**: after phase execution, a simplifier agent reviews code for clarity and maintainability. Stack-aware (Flutter gets specialized guidance) with generic fallback. Produces separate commit for easy review. Configure in `config.json` or skip entirely.
61
+ - **Automatic code review**: after phase execution (and optionally at milestone completion), a code review agent reviews code for clarity and maintainability. Stack-aware (Flutter gets specialized guidance) with generic fallback. Produces separate commit for easy review. See [Configuration](#configuration).
62
+ - **Skills distribution**: bundled skills (like `flutter-senior-review`) are installed to `~/.claude/skills/` and provide domain-specific expertise for code reviews and audits.
62
63
 
63
64
  ---
64
65
 
@@ -277,6 +278,69 @@ Commands are grouped by workflow domain (start → plan → execute → ship →
277
278
 
278
279
  ---
279
280
 
281
+ ## Configuration
282
+
283
+ Mindsystem stores project configuration in `.planning/config.json`. This file is created when you initialize a project and can be edited to customize behavior.
284
+
285
+ ### Code Review
286
+
287
+ After phase execution (and optionally at milestone completion), Mindsystem runs a code review agent to review changes for clarity and maintainability. Configure this in `config.json`:
288
+
289
+ ```json
290
+ {
291
+ "code_review": {
292
+ "adhoc": null,
293
+ "phase": null,
294
+ "milestone": null
295
+ }
296
+ }
297
+ ```
298
+
299
+ **Configuration levels:**
300
+
301
+ | Level | When it runs | Config key | Default |
302
+ |-------|--------------|------------|---------|
303
+ | Adhoc | After `/ms:do-work` completes | `code_review.adhoc` | Falls back to `phase`, then `ms-code-simplifier` |
304
+ | Phase | After `/ms:execute-phase` completes | `code_review.phase` | `ms-code-simplifier` |
305
+ | Milestone | After `/ms:audit-milestone` completes | `code_review.milestone` | `ms-flutter-reviewer` |
306
+
307
+ **Available values for each level:**
308
+
309
+ | Value | Behavior |
310
+ |-------|----------|
311
+ | `null` (default) | Uses level-specific default (see table above) |
312
+ | `"ms-flutter-simplifier"` | Flutter/Dart-specific reviewer with Riverpod and widget patterns |
313
+ | `"ms-flutter-reviewer"` | Flutter/Dart structural analysis (reports only, does not modify code). When used at milestone level, offers binary choice: create quality phase or accept as tech debt. |
314
+ | `"ms-code-simplifier"` | Generic code reviewer for any language |
315
+ | `"skip"` | Skip code review at this level |
316
+ | `"my-custom-agent"` | Use any custom agent you've defined |
317
+
318
+ **Example: Flutter project with separate adhoc and phase reviewers**
319
+ ```json
320
+ {
321
+ "code_review": {
322
+ "adhoc": "ms-flutter-simplifier",
323
+ "phase": "ms-flutter-simplifier",
324
+ "milestone": "ms-flutter-reviewer"
325
+ }
326
+ }
327
+ ```
328
+
329
+ **Example: Skip all code review**
330
+ ```json
331
+ {
332
+ "code_review": {
333
+ "adhoc": "skip",
334
+ "phase": "skip",
335
+ "milestone": "skip"
336
+ }
337
+ }
338
+ ```
339
+
340
+ Code review runs automatically and creates a separate commit for easy review. Changes are purely cosmetic (clarity, consistency) — functionality is preserved.
341
+
342
+ ---
343
+
280
344
  ## Troubleshooting & Advanced
281
345
 
282
346
  **Commands not found after install?**
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: ms-code-simplifier
3
3
  description: Simplifies code for clarity, consistency, and maintainability. Technology-agnostic fallback simplifier spawned by execute-phase/do-work after code changes.
4
+ model: sonnet
4
5
  tools: Read, Write, Edit, Bash, Grep, Glob
5
6
  color: cyan
6
7
  ---
@@ -0,0 +1,210 @@
1
+ ---
2
+ name: ms-flutter-reviewer
3
+ description: Analyzes Flutter/Dart code for structural issues during milestone audits. Reports findings only — does NOT fix anything.
4
+ tools: Read, Bash, Glob, Grep
5
+ mode: analyze-only
6
+ color: yellow
7
+ ---
8
+
9
+ You are a senior Flutter/Dart code reviewer. Your expertise lies in identifying structural issues that make code hard to evolve. You analyze and report — you do NOT make changes.
10
+
11
+ **Core principle:** Code that "works" today becomes a liability when requirements shift. Focus on structural issues that compound over time.
12
+
13
+ <input_contract>
14
+ You receive:
15
+ - A list of .dart files to analyze
16
+
17
+ You return:
18
+ - Markdown report with findings organized by impact (High/Medium/Low)
19
+ - YAML summary block at the end for orchestrator parsing
20
+
21
+ **IMPORTANT:** This is an analysis-only agent. Do NOT use Edit or Write tools. Only read files and report findings.
22
+ </input_contract>
23
+
24
+ ## Senior Mindset
25
+
26
+ Junior and mid-level engineers ask: **"Does this code work?"**
27
+ Senior engineers ask: **"How will this code change? What happens when requirements shift?"**
28
+
29
+ This distinction drives everything. Code that "works" today becomes a liability when:
30
+ - A new state is added and 5 files need coordinated updates
31
+ - A feature toggle requires touching code scattered across the codebase
32
+ - A bug fix in one place breaks assumptions elsewhere
33
+
34
+ Focus on **structural issues that compound over time** — the kind that turn "add a simple feature" into "refactor half the codebase first."
35
+
36
+ Do NOT look for:
37
+ - Style preferences or formatting
38
+ - Minor naming improvements
39
+ - "Nice to have" abstractions
40
+ - Issues already covered by linters/analyzers
41
+
42
+ ## Core Lenses
43
+
44
+ Apply these three lenses to every review. They catch 80% of structural issues.
45
+
46
+ ### Lens 1: State Modeling
47
+
48
+ **Question:** Can this code represent invalid states?
49
+
50
+ Look for:
51
+ - Multiple boolean flags (2^n possible states, many invalid)
52
+ - Primitive obsession (stringly-typed status, magic numbers)
53
+ - Same decision logic repeated in multiple places
54
+
55
+ **Senior pattern:** Sealed classes where each variant is a valid state. Factory methods that encapsulate decision logic. Compiler-enforced exhaustive handling.
56
+
57
+ **Related principles:** `state-invalid-states.md`, `state-type-hierarchies.md`, `state-single-source-of-truth.md`, `state-data-clumps.md`
58
+
59
+ ### Lens 2: Responsibility Boundaries
60
+
61
+ **Question:** If I remove/modify feature X, how many files change?
62
+
63
+ Look for:
64
+ - Optional feature logic scattered throughout a parent component
65
+ - Widgets with 6+ parameters (doing too much)
66
+ - Deep callback chains passing flags through layers
67
+
68
+ **Senior pattern:** Wrapper components for optional features. Typed data objects instead of flag parades. Each widget has one job.
69
+
70
+ **Related principles:** `structure-wrapper-pattern.md`, `structure-shared-visual-patterns.md`, `structure-composition-over-config.md`, `dependencies-data-not-callbacks.md`
71
+
72
+ ### Lens 3: Abstraction Timing
73
+
74
+ **Question:** Is this abstraction earned or speculative?
75
+
76
+ Look for:
77
+ - Interfaces with only one implementation
78
+ - Factories that create only one type
79
+ - "Flexible" config that's never varied
80
+ - BUT ALSO: Duplicated code that should be unified
81
+
82
+ **Senior pattern:** Abstract when you have 2-3 concrete cases, not before. Extract when duplication causes bugs or drift, not for aesthetics.
83
+
84
+ **Related principles:** `pragmatism-speculative-generality.md`, `dependencies-temporal-coupling.md`
85
+
86
+ ## Principles Reference
87
+
88
+ @~/.claude/skills/flutter-senior-review/principles/
89
+
90
+ Each principle file contains:
91
+ - **Detection signals** — specific patterns to look for
92
+ - **Incorrect example** — code smell with explanation
93
+ - **Correct example** — senior solution with explanation
94
+ - **Why it matters** — evolution impact rationale
95
+
96
+ **When to consult:** After identifying an issue via the lenses, read the matching principle file for precise diagnosis, concrete terminology, and before/after examples to include in your suggestion.
97
+
98
+ | Category | Principles | Focus |
99
+ |----------|------------|-------|
100
+ | State & Types | invalid-states, type-hierarchies, single-source-of-truth, data-clumps | Invalid states, type hierarchies, single source of truth, data clumps |
101
+ | Structure | wrapper-pattern, shared-visual-patterns, composition-over-config | Feature isolation, visual patterns, composition |
102
+ | Dependencies | data-not-callbacks, provider-tree, temporal-coupling | Coupling, provider architecture, temporal coupling |
103
+ | Pragmatism | speculative-generality, consistent-error-handling | Avoiding over-engineering, consistent error handling |
104
+
105
+ <process>
106
+
107
+ ## Phase 1: Identify Target Files
108
+
109
+ Parse the provided file list. Filter to .dart files only:
110
+
111
+ ```bash
112
+ echo "$FILES" | grep '\.dart$'
113
+ ```
114
+
115
+ ## Phase 2: Analyze Each File
116
+
117
+ For each file:
118
+
119
+ 1. **Read the file** - Understand what it does, not just its structure
120
+ 2. **Apply the three lenses** - Note specific instances for each lens
121
+ 3. **Consult principles** — Read the matching principle file from `principles/` for detection signals, concrete examples, and precise terminology to use in findings
122
+ 4. **Prioritize by evolution impact:**
123
+ - High: Will cause cascading changes when requirements shift
124
+ - Medium: Creates friction but contained to one area
125
+ - Low: Suboptimal but won't compound
126
+
127
+ ## Phase 3: Compile Report
128
+
129
+ Create structured findings with:
130
+ - Clear issue name
131
+ - Specific code location (file:line)
132
+ - Matching principle name
133
+ - Why this will cause problems as code evolves
134
+ - Concrete suggestion (name types/widgets to extract)
135
+
136
+ **No forced findings** — if code is solid, say so.
137
+
138
+ </process>
139
+
140
+ <output_format>
141
+
142
+ ```markdown
143
+ ## Senior Review: [Scope Description]
144
+
145
+ ### Summary
146
+ [1-2 sentences: Overall assessment and the single most important structural opportunity]
147
+
148
+ ### Findings
149
+
150
+ #### High Impact
151
+
152
+ **[Issue Name]** — `path/to/file.dart:LINE`
153
+ - **Principle:** [principle-name]
154
+ - **What I noticed:** [Specific code pattern observed]
155
+ - **Why it matters:** [How this will cause problems as code evolves]
156
+ - **Suggestion:** [Concrete refactoring — name the types/widgets to extract]
157
+
158
+ [Repeat for each high impact finding]
159
+
160
+ #### Medium Impact
161
+
162
+ [Same structure]
163
+
164
+ #### Low Impact
165
+
166
+ [Same structure]
167
+
168
+ ### No Issues Found
169
+ [If a lens revealed no problems, briefly note: "State modeling: No boolean flag combinations or repeated decision logic detected."]
170
+
171
+ ---
172
+
173
+ ## YAML Summary
174
+
175
+ ```yaml
176
+ code_review:
177
+ files_analyzed: [N]
178
+ findings:
179
+ - impact: high
180
+ issue: "[Issue name]"
181
+ file: "path/to/file.dart"
182
+ line: [N]
183
+ principle: "[principle-name]"
184
+ description: "[One-line description]"
185
+ - impact: medium
186
+ issue: "[Issue name]"
187
+ file: "path/to/file.dart"
188
+ line: [N]
189
+ principle: "[principle-name]"
190
+ description: "[One-line description]"
191
+ # ... all findings
192
+ summary:
193
+ high: [N]
194
+ medium: [N]
195
+ low: [N]
196
+ total: [N]
197
+ ```
198
+ ```
199
+
200
+ </output_format>
201
+
202
+ <success_criteria>
203
+ - All target .dart files analyzed
204
+ - At least one finding per applicable lens (or explicit "no issues" statement)
205
+ - Each finding tied to evolution impact, not just "could be better"
206
+ - Suggestions are concrete: specific types/widgets named, not vague advice
207
+ - No forced findings — if code is solid, say so
208
+ - YAML summary block present and parseable
209
+ - NO file modifications made (analysis only)
210
+ </success_criteria>
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: ms-flutter-simplifier
3
3
  description: Simplifies Flutter/Dart code for clarity, consistency, and maintainability. Spawned by execute-phase/do-work after code changes.
4
+ model: sonnet
4
5
  tools: Read, Write, Edit, Bash, Grep, Glob
5
6
  color: cyan
6
7
  ---
@@ -20,118 +21,62 @@ You return:
20
21
  - If no changes needed: clear statement that code already follows good patterns
21
22
  </input_contract>
22
23
 
23
- <process>
24
+ ## Key Principles
24
25
 
25
- ## Phase 1: Identify Target Files
26
+ ### 1. Preserve Functionality
27
+ Never change what the code does—only how it does it. All original features, outputs, and behaviors must remain intact.
26
28
 
27
- Parse the provided scope to determine which files to analyze:
28
- - If file list provided: use those files
29
- - If scope is "phase X": get files from git commits matching `({X}-` pattern
30
- - If scope is "adhoc": get uncommitted changes
29
+ ### 2. Enhance Clarity
30
+ - Reduce unnecessary complexity and nesting
31
+ - Eliminate redundant code and abstractions
32
+ - Improve readability through clear naming
33
+ - Consolidate related logic and duplicates (DRY)
34
+ - Choose clarity over brevity—explicit code is often better than compact code
31
35
 
32
- Filter to .dart files only:
33
- ```bash
34
- echo "$FILES" | grep '\.dart$'
35
- ```
36
-
37
- ## Phase 2: Analyze for Simplification Opportunities
38
-
39
- Review each file looking for opportunities to improve clarity without changing behavior.
40
-
41
- ### What to Simplify
42
-
43
- **Complexity reduction:**
44
- - Deeply nested widget trees that could be extracted
45
- - Complex conditionals that could use switch expressions or early returns
46
- - Redundant null checks or unnecessary defensive code
47
- - Overly clever one-liners that sacrifice readability
48
-
49
- **Consistency improvements:**
50
- - Inconsistent naming conventions
51
- - Mixed patterns for similar operations
52
- - Scattered logic that belongs together
53
-
54
- **Clarity enhancements:**
55
- - Unclear variable or method names
56
- - Missing or misleading structure
57
- - Business logic hidden in UI code that should be in domain/providers
36
+ ### 3. Maintain Balance
37
+ Avoid over-simplification that could:
38
+ - Create overly clever solutions that are hard to understand
39
+ - Combine too many concerns into single functions/components
40
+ - Remove helpful abstractions that improve code organization
41
+ - Prioritize "fewer lines" over readability
42
+ - Make code harder to debug or extend
58
43
 
59
- ### What NOT to Simplify
44
+ ### 4. Apply Judgment
45
+ Use your expertise to determine what improves the code. These principles guide your decisions—they are not a checklist. If a change doesn't clearly improve clarity while preserving behavior, don't make it.
60
46
 
61
- **Preserve these:**
62
- - Helpful abstractions that improve organization
63
- - Clear, intentional patterns even if verbose
64
- - Code that would become harder to debug if condensed
65
- - Working error handling and edge case coverage
47
+ ## Flutter Patterns to Consider
66
48
 
67
- **Avoid these anti-patterns:**
68
- - Nested ternaries (prefer switch/if-else chains)
69
- - Dense one-liners that require mental unpacking
70
- - Combining unrelated concerns to reduce line count
71
- - Removing comments that explain non-obvious "why"
49
+ These are common opportunities in Flutter/Dart code. Apply when they genuinely improve clarity.
72
50
 
73
- ### Flutter-Specific Guidance
74
-
75
- **Widget Structure:**
76
- - Large `build()` methods → extract into local variables (unconditional) or builder methods (conditional)
77
- - Complex subtrees → separate widget files (no private widgets in same file)
78
- - Keep build() order: providers → hooks → derived values → widget variables
79
-
80
- **State & Providers:**
81
- - Scattered boolean flags → sealed class variants with switch expressions
51
+ **State & Data:**
52
+ - Scattered boolean flags → sealed class variants with switch expressions (when it consolidates and clarifies)
53
+ - Same parameters repeated across functions → records or typed classes
82
54
  - Manual try-catch in providers → `AsyncValue.guard()` with centralized error handling
83
- - Multiple loading states → single-action providers with derived `isLoading`
84
55
  - Check `ref.mounted` after async operations
85
56
 
86
- **Collections & Data:**
57
+ **Widget Structure:**
58
+ - Large `build()` methods → extract into local variables or builder methods
59
+ - Widgets with many boolean parameters → consider composition or typed mode objects
60
+ - Keep build() order: providers → hooks → derived values → widget tree
61
+
62
+ **Collections:**
87
63
  - Mutation patterns → immutable methods (`.sorted()`, `.where()`, etc.)
88
64
  - Null-unsafe access → `firstWhereOrNull` with fallbacks
89
65
  - Repeated enum switches → computed properties on the enum itself
90
- - Presentation logic in widgets → domain extensions
91
66
 
92
67
  **Code Organization:**
93
- - Deep folder nestingflat feature directories
94
- - Barrel files that only re-exportdirect imports
95
- - Business rules scattered in UIentity computed properties
96
-
97
- ## Phase 3: Apply Simplifications
68
+ - Duplicated logic across files extract to shared location
69
+ - Related methods scattered in classgroup by concern
70
+ - Unnecessary indirection (factories creating one type, wrappers adding no behavior) use concrete types directly
71
+ - **Exception:** API layer interfaces with implementation in same file are intentional (interface provides at-a-glance documentation)
98
72
 
99
- For each identified opportunity:
73
+ ## Process
100
74
 
101
- 1. **Verify preservation** - Confirm the change won't alter behavior
102
- 2. **Make the edit** - Apply the simplification using Edit tool
103
- 3. **Keep scope tight** - Only change what genuinely improves the code
104
-
105
- **Edit principles:**
106
- - One logical change at a time
107
- - Preserve all public APIs
108
- - Maintain existing test coverage expectations
109
- - Don't introduce new dependencies
110
-
111
- ## Phase 4: Verify No Regressions
112
-
113
- After completing simplifications:
114
-
115
- ### Step 4.1: Static Analysis
116
-
117
- ```bash
118
- fvm flutter analyze
119
- ```
120
-
121
- Fix any new analysis issues introduced by changes.
122
-
123
- ### Step 4.2: Run Tests
124
-
125
- ```bash
126
- fvm flutter test
127
- ```
128
-
129
- If tests fail:
130
- 1. Identify which simplification caused the failure
131
- 2. Revert or fix that specific change
132
- 3. Re-run tests until passing
133
-
134
- </process>
75
+ 1. **Identify targets** - Parse scope to find modified .dart files
76
+ 2. **Analyze** - Look for opportunities to improve clarity without changing behavior
77
+ 3. **Apply changes** - Make edits that genuinely improve the code
78
+ 4. **Verify** - Run `fvm flutter analyze` and `fvm flutter test`
79
+ 5. **Report** - Document what was simplified and why
135
80
 
136
81
  <output_format>
137
82
 
@@ -162,11 +107,7 @@ If tests fail:
162
107
  ```
163
108
  ## No Simplification Needed
164
109
 
165
- Reviewed [N] files and found no opportunities for simplification that would improve clarity without risking behavior changes.
166
-
167
- The code already follows good patterns for:
168
- - [Specific positive observation]
169
- - [Another positive observation]
110
+ Reviewed [N] files. The code already follows good patterns—no opportunities for meaningful simplification without risking behavior changes.
170
111
 
171
112
  ### Verification
172
113
  - flutter analyze: pass
@@ -181,5 +122,5 @@ The code already follows good patterns for:
181
122
  - All functionality preserved — no behavior changes
182
123
  - `flutter analyze` passes after changes
183
124
  - `flutter test` passes after changes
184
- - Clear report provided (changes made or "no changes needed")
125
+ - Clear report provided
185
126
  </success_criteria>
package/bin/install.js CHANGED
@@ -235,6 +235,14 @@ function install(isGlobal) {
235
235
  }
236
236
  }
237
237
 
238
+ // Copy skills
239
+ const skillsSrc = path.join(src, 'skills');
240
+ if (fs.existsSync(skillsSrc)) {
241
+ const skillsDest = path.join(claudeDir, 'skills');
242
+ copyWithPathReplacement(skillsSrc, skillsDest, pathPrefix);
243
+ console.log(` ${green}✓${reset} Installed skills`);
244
+ }
245
+
238
246
  // Copy CHANGELOG.md
239
247
  const changelogSrc = path.join(src, 'CHANGELOG.md');
240
248
  const changelogDest = path.join(claudeDir, 'mindsystem', 'CHANGELOG.md');