mindsystem-cc 3.20.0 → 3.22.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 (113) hide show
  1. package/README.md +9 -18
  2. package/agents/ms-mockup-designer.md +1 -1
  3. package/agents/ms-plan-checker.md +30 -30
  4. package/agents/ms-plan-writer.md +1 -1
  5. package/agents/ms-product-researcher.md +71 -0
  6. package/agents/ms-research-synthesizer.md +1 -1
  7. package/agents/ms-researcher.md +8 -8
  8. package/agents/ms-roadmapper.md +9 -13
  9. package/agents/ms-verifier.md +25 -117
  10. package/bin/install.js +68 -5
  11. package/commands/ms/add-phase.md +7 -8
  12. package/commands/ms/add-todo.md +3 -4
  13. package/commands/ms/adhoc.md +4 -5
  14. package/commands/ms/audit-milestone.md +15 -14
  15. package/commands/ms/complete-milestone.md +27 -24
  16. package/commands/ms/config.md +229 -0
  17. package/commands/ms/create-roadmap.md +3 -4
  18. package/commands/ms/debug.md +3 -4
  19. package/commands/ms/design-phase.md +11 -13
  20. package/commands/ms/discuss-phase.md +26 -22
  21. package/commands/ms/doctor.md +28 -205
  22. package/commands/ms/execute-phase.md +20 -12
  23. package/commands/ms/help.md +46 -39
  24. package/commands/ms/insert-phase.md +6 -7
  25. package/commands/ms/map-codebase.md +1 -2
  26. package/commands/ms/new-milestone.md +41 -19
  27. package/commands/ms/new-project.md +56 -47
  28. package/commands/ms/plan-milestone-gaps.md +7 -9
  29. package/commands/ms/plan-phase.md +4 -5
  30. package/commands/ms/progress.md +3 -4
  31. package/commands/ms/remove-phase.md +3 -4
  32. package/commands/ms/research-phase.md +11 -16
  33. package/commands/ms/research-project.md +19 -26
  34. package/commands/ms/review-design.md +4 -2
  35. package/commands/ms/verify-work.md +6 -8
  36. package/mindsystem/references/continuation-format.md +3 -3
  37. package/mindsystem/references/principles.md +1 -1
  38. package/mindsystem/references/routing/audit-result-routing.md +12 -11
  39. package/mindsystem/references/routing/between-milestones-routing.md +2 -2
  40. package/mindsystem/references/routing/milestone-complete-routing.md +1 -1
  41. package/mindsystem/references/routing/next-phase-routing.md +4 -2
  42. package/mindsystem/references/verification-patterns.md +0 -37
  43. package/mindsystem/templates/config.json +2 -1
  44. package/mindsystem/templates/context.md +7 -6
  45. package/mindsystem/templates/milestone-archive.md +5 -5
  46. package/mindsystem/templates/milestone-context.md +1 -1
  47. package/mindsystem/templates/milestone.md +9 -9
  48. package/mindsystem/templates/project.md +2 -2
  49. package/mindsystem/templates/research-subagent-prompt.md +3 -3
  50. package/mindsystem/templates/roadmap-milestone.md +14 -14
  51. package/mindsystem/templates/roadmap.md +10 -8
  52. package/mindsystem/templates/state.md +2 -2
  53. package/mindsystem/templates/verification-report.md +3 -26
  54. package/mindsystem/workflows/adhoc.md +1 -1
  55. package/mindsystem/workflows/complete-milestone.md +40 -75
  56. package/mindsystem/workflows/discuss-phase.md +141 -65
  57. package/mindsystem/workflows/doctor-fixes.md +273 -0
  58. package/mindsystem/workflows/execute-phase.md +9 -21
  59. package/mindsystem/workflows/execute-plan.md +3 -0
  60. package/mindsystem/workflows/map-codebase.md +6 -12
  61. package/mindsystem/workflows/mockup-generation.md +47 -23
  62. package/mindsystem/workflows/plan-phase.md +13 -6
  63. package/mindsystem/workflows/transition.md +2 -2
  64. package/mindsystem/workflows/verify-work.md +97 -70
  65. package/package.json +1 -1
  66. package/scripts/__pycache__/ms-tools.cpython-314.pyc +0 -0
  67. package/scripts/__pycache__/test_ms_tools.cpython-314-pytest-9.0.2.pyc +0 -0
  68. package/scripts/fixtures/scan-context/.planning/ROADMAP.md +16 -0
  69. package/scripts/fixtures/scan-context/.planning/adhoc/20260220-fix-token-SUMMARY.md +12 -0
  70. package/scripts/fixtures/scan-context/.planning/config.json +3 -0
  71. package/scripts/fixtures/scan-context/.planning/debug/resolved/token-bug.md +11 -0
  72. package/scripts/fixtures/scan-context/.planning/knowledge/auth.md +11 -0
  73. package/scripts/fixtures/scan-context/.planning/phases/02-infra/02-1-SUMMARY.md +20 -0
  74. package/scripts/fixtures/scan-context/.planning/phases/04-setup/04-1-SUMMARY.md +21 -0
  75. package/scripts/fixtures/scan-context/.planning/phases/05-auth/05-1-SUMMARY.md +28 -0
  76. package/scripts/fixtures/scan-context/.planning/todos/done/setup-db.md +10 -0
  77. package/scripts/fixtures/scan-context/.planning/todos/pending/add-logout.md +10 -0
  78. package/scripts/fixtures/scan-context/expected-output.json +257 -0
  79. package/scripts/ms-tools.py +2884 -0
  80. package/scripts/test_ms_tools.py +1622 -0
  81. package/agents/ms-flutter-code-quality.md +0 -169
  82. package/agents/ms-flutter-reviewer.md +0 -211
  83. package/agents/ms-flutter-simplifier.md +0 -79
  84. package/commands/ms/list-phase-assumptions.md +0 -56
  85. package/mindsystem/workflows/list-phase-assumptions.md +0 -178
  86. package/mindsystem/workflows/verify-phase.md +0 -625
  87. package/scripts/__pycache__/compare_mockups.cpython-314.pyc +0 -0
  88. package/scripts/archive-milestone-files.sh +0 -68
  89. package/scripts/archive-milestone-phases.sh +0 -138
  90. package/scripts/doctor-scan.sh +0 -402
  91. package/scripts/gather-milestone-stats.sh +0 -179
  92. package/scripts/generate-adhoc-patch.sh +0 -79
  93. package/scripts/generate-phase-patch.sh +0 -169
  94. package/scripts/scan-artifact-subsystems.sh +0 -55
  95. package/scripts/scan-planning-context.py +0 -839
  96. package/scripts/update-state.sh +0 -59
  97. package/scripts/validate-execution-order.sh +0 -104
  98. package/skills/flutter-code-quality/SKILL.md +0 -143
  99. package/skills/flutter-code-simplification/SKILL.md +0 -102
  100. package/skills/flutter-senior-review/AGENTS.md +0 -869
  101. package/skills/flutter-senior-review/SKILL.md +0 -205
  102. package/skills/flutter-senior-review/principles/dependencies-data-not-callbacks.md +0 -75
  103. package/skills/flutter-senior-review/principles/dependencies-provider-tree.md +0 -85
  104. package/skills/flutter-senior-review/principles/dependencies-temporal-coupling.md +0 -97
  105. package/skills/flutter-senior-review/principles/pragmatism-consistent-error-handling.md +0 -130
  106. package/skills/flutter-senior-review/principles/pragmatism-speculative-generality.md +0 -91
  107. package/skills/flutter-senior-review/principles/state-data-clumps.md +0 -64
  108. package/skills/flutter-senior-review/principles/state-invalid-states.md +0 -53
  109. package/skills/flutter-senior-review/principles/state-single-source-of-truth.md +0 -68
  110. package/skills/flutter-senior-review/principles/state-type-hierarchies.md +0 -75
  111. package/skills/flutter-senior-review/principles/structure-composition-over-config.md +0 -105
  112. package/skills/flutter-senior-review/principles/structure-shared-visual-patterns.md +0 -107
  113. package/skills/flutter-senior-review/principles/structure-wrapper-pattern.md +0 -90
@@ -1,59 +0,0 @@
1
- #!/bin/bash
2
- #
3
- # update-state.sh
4
- # Updates .planning/STATE.md Plan and Status lines based on plan progress.
5
- # Idempotent — same arguments produce the same result.
6
- #
7
- # Usage: ./scripts/update-state.sh <completed_plan_count> <total_plans>
8
- # Example: ./scripts/update-state.sh 2 4
9
- # (2 of 4 plans complete)
10
- #
11
-
12
- set -e
13
-
14
- # --- Validation ---
15
- if [ -z "$1" ] || [ -z "$2" ]; then
16
- echo "Error: Two arguments required"
17
- echo "Usage: $0 <completed_plan_count> <total_plans>"
18
- exit 1
19
- fi
20
-
21
- COMPLETED="$1"
22
- TOTAL="$2"
23
-
24
- if ! [[ "$COMPLETED" =~ ^[0-9]+$ ]] || ! [[ "$TOTAL" =~ ^[0-9]+$ ]]; then
25
- echo "Error: Both arguments must be numeric"
26
- echo "Usage: $0 <completed_plan_count> <total_plans>"
27
- exit 1
28
- fi
29
-
30
- if [ "$COMPLETED" -gt "$TOTAL" ]; then
31
- echo "Error: Completed ($COMPLETED) cannot exceed total ($TOTAL)"
32
- exit 1
33
- fi
34
-
35
- # --- Find STATE.md from git root ---
36
- GIT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null)
37
- if [ -z "$GIT_ROOT" ]; then
38
- echo "Error: Not in a git repository"
39
- exit 1
40
- fi
41
-
42
- STATE_FILE="$GIT_ROOT/.planning/STATE.md"
43
- if [ ! -f "$STATE_FILE" ]; then
44
- echo "Error: STATE.md not found at $STATE_FILE"
45
- exit 1
46
- fi
47
-
48
- # --- Update Plan line ---
49
- sed -i '' "s/^Plan:.*/Plan: $COMPLETED of $TOTAL complete in current phase/" "$STATE_FILE"
50
-
51
- # --- Update Status line ---
52
- if [ "$COMPLETED" -eq "$TOTAL" ]; then
53
- sed -i '' "s/^Status:.*/Status: All plans executed, pending verification/" "$STATE_FILE"
54
- else
55
- sed -i '' "s/^Status:.*/Status: In progress — plan $COMPLETED of $TOTAL complete/" "$STATE_FILE"
56
- fi
57
-
58
- echo "STATE.md updated: $COMPLETED of $TOTAL plans complete"
59
- exit 0
@@ -1,104 +0,0 @@
1
- #!/bin/bash
2
- #
3
- # validate-execution-order.sh
4
- # Validates EXECUTION-ORDER.md against plan files in a phase directory.
5
- # Checks bidirectional consistency and warns about file conflicts within waves.
6
- #
7
- # Usage: ./scripts/validate-execution-order.sh <phase_directory>
8
- # Example: ./scripts/validate-execution-order.sh .planning/phases/03-auth
9
- #
10
-
11
- set -e
12
-
13
- # --- Validation ---
14
- if [ -z "$1" ]; then
15
- echo "Error: Phase directory required"
16
- echo "Usage: $0 <phase_directory>"
17
- exit 1
18
- fi
19
-
20
- PHASE_DIR="$1"
21
-
22
- if [ ! -d "$PHASE_DIR" ]; then
23
- echo "FAIL: Directory does not exist: $PHASE_DIR"
24
- exit 1
25
- fi
26
-
27
- EXEC_ORDER="$PHASE_DIR/EXECUTION-ORDER.md"
28
- if [ ! -f "$EXEC_ORDER" ]; then
29
- echo "FAIL: EXECUTION-ORDER.md not found in $PHASE_DIR"
30
- exit 1
31
- fi
32
-
33
- # --- Collect plan files on disk ---
34
- DISK_PLANS=$(ls -1 "$PHASE_DIR"/*-PLAN.md 2>/dev/null | xargs -I{} basename {} | sort)
35
- DISK_COUNT=$(echo "$DISK_PLANS" | grep -c . 2>/dev/null || echo 0)
36
-
37
- if [ "$DISK_COUNT" -eq 0 ]; then
38
- echo "FAIL: No *-PLAN.md files found in $PHASE_DIR"
39
- exit 1
40
- fi
41
-
42
- # --- Parse EXECUTION-ORDER.md for plan filenames ---
43
- # Pattern matches phase-prefixed names like 03-01-PLAN.md, 16-01-PLAN.md, 72.1-01-PLAN.md
44
- ORDER_PLANS=$(grep -oE '[0-9][0-9.]*-[0-9]+-PLAN\.md' "$EXEC_ORDER" | sort -u)
45
- ORDER_COUNT=$(echo "$ORDER_PLANS" | grep -c . 2>/dev/null || echo 0)
46
-
47
- # --- Check 1: Every disk plan is listed in EXECUTION-ORDER.md ---
48
- ERRORS=""
49
- while IFS= read -r plan; do
50
- [ -z "$plan" ] && continue
51
- if ! echo "$ORDER_PLANS" | grep -qx "$plan"; then
52
- ERRORS="${ERRORS} Missing from EXECUTION-ORDER.md: $plan\n"
53
- fi
54
- done <<< "$DISK_PLANS"
55
-
56
- # --- Check 2: Every plan in EXECUTION-ORDER.md exists on disk ---
57
- while IFS= read -r plan; do
58
- [ -z "$plan" ] && continue
59
- if ! echo "$DISK_PLANS" | grep -qx "$plan"; then
60
- ERRORS="${ERRORS} Listed in EXECUTION-ORDER.md but file missing: $plan\n"
61
- fi
62
- done <<< "$ORDER_PLANS"
63
-
64
- if [ -n "$ERRORS" ]; then
65
- echo "FAIL: Plan/execution-order mismatch"
66
- printf "%b" "$ERRORS"
67
- exit 1
68
- fi
69
-
70
- # --- Check 3 (warning): File conflicts within waves ---
71
- CURRENT_WAVE=""
72
- WAVE_COUNT=0
73
- CURRENT_WAVE_FILES=""
74
-
75
- while IFS= read -r line; do
76
- if echo "$line" | grep -qE '^## Wave [0-9]+'; then
77
- CURRENT_WAVE=$(echo "$line" | grep -oE '[0-9]+')
78
- WAVE_COUNT=$((WAVE_COUNT + 1))
79
- CURRENT_WAVE_FILES=""
80
- elif [ -n "$CURRENT_WAVE" ]; then
81
- PLAN_FILE=$(echo "$line" | grep -oE '[0-9][0-9.]*-[0-9]+-PLAN\.md' || true)
82
- if [ -n "$PLAN_FILE" ] && [ -f "$PHASE_DIR/$PLAN_FILE" ]; then
83
- # Extract **Files:** lines from plan
84
- FILE_PATHS=$(grep -E '^\*\*Files:\*\*' "$PHASE_DIR/$PLAN_FILE" | sed 's/\*\*Files:\*\*//g' | tr ',' '\n' | sed 's/`//g; s/^[[:space:]]*//; s/[[:space:]]*$//' | grep -v '^$' || true)
85
- while IFS= read -r fpath; do
86
- [ -z "$fpath" ] && continue
87
- if echo "$CURRENT_WAVE_FILES" | grep -qF "|$fpath|"; then
88
- echo "WARNING: File '$fpath' appears in multiple plans within Wave $CURRENT_WAVE"
89
- else
90
- CURRENT_WAVE_FILES="${CURRENT_WAVE_FILES}|$fpath|"
91
- fi
92
- done <<< "$FILE_PATHS"
93
- fi
94
- fi
95
- done < "$EXEC_ORDER"
96
-
97
- # --- Handle edge case: no waves parsed ---
98
- if [ "$WAVE_COUNT" -eq 0 ]; then
99
- echo "FAIL: No '## Wave N' headers found in EXECUTION-ORDER.md"
100
- exit 1
101
- fi
102
-
103
- echo "PASS: $DISK_COUNT plans across $WAVE_COUNT waves"
104
- exit 0
@@ -1,143 +0,0 @@
1
- ---
2
- name: flutter-code-quality
3
- description: Organize Flutter/Dart code to follow project conventions. Use after implementation to restructure folders, fix widget file organization, align naming patterns, or clean up code to match project standards.
4
- license: MIT
5
- metadata:
6
- author: Roland Tolnay
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
- ```bash
28
- gh api /gists/edf9ea7d5adf218f45accb3411f0627c \
29
- --jq '.files["flutter-code-quality-guidelines.md"].content'
30
- ```
31
-
32
- Never use WebFetch for gist content — it summarizes instead of returning raw text. Contains: anti-patterns, widget patterns, state management, collections, hooks, theme/styling, etc.
33
-
34
- ## Widget Organization Guidelines (Embedded)
35
-
36
- ### Build Method Structure
37
-
38
- Order inside `build()`:
39
- 1. Providers (reads/watches)
40
- 2. Hooks (if using flutter_hooks)
41
- 3. Derived variables needed for rendering
42
- 4. Widget variables (in render order)
43
-
44
- ### When to Use What
45
-
46
- | Scenario | Pattern |
47
- |----------|---------|
48
- | Widget always shown, no conditions | Local variable: `final header = Container(...);` |
49
- | Widget depends on condition/null check | Builder function: `Widget? _buildContent() { if (data == null) return null; ... }` |
50
- | Subtree is large, reusable, or has own state | Extract to standalone widget in own file |
51
- | Function needs 3 or fewer params | Define outside `build()` as class method |
52
- | Function needs 4+ params (esp. hooks) | Define inside `build()` to capture scope |
53
-
54
- ### Rules
55
-
56
- - **No file-private widgets** - If big enough to be a widget, it gets its own file
57
- - **Define local variables in render order** - Top-to-bottom matches screen layout
58
- - **Extract non-trivial conditions** - `final canSubmit = isValid && !isLoading && selectedId != null;`
59
- - **Pass `WidgetRef` only** when function needs both ref and context - Use `ref.context` inside
60
-
61
- ### Async UX Conventions
62
-
63
- - **Button loading** - Watch provider state, not separate `useState<bool>`
64
- - **Retriable errors** - Listen to provider, show toast on error, user retries by tapping again
65
- - **First-load errors** - Render error view with retry button that invalidates provider
66
-
67
- ### Sorting/Filtering
68
-
69
- - Simple options: Use enum with computed properties
70
- - Options with behavior: Use sealed class
71
- - Complex multi-field filtering: Dedicated `Filter` class
72
-
73
- ## Folder Structure Guidelines (Embedded)
74
-
75
- ### Core Rules
76
-
77
- 1. **Organize by feature** - Each feature gets its own folder
78
- 2. **Screens at feature root** - `account_screen.dart`, `edit_account_screen.dart`
79
- 3. **Create subfolders only when justified:**
80
- - `widgets/` when 2+ reusable widgets exist
81
- - `providers/` when 2+ provider files exist
82
- - `domain/` usually always (models, repositories)
83
- 4. **Split large features into subfeatures** - Each subfeature follows same rules
84
-
85
- ### Example
86
-
87
- ```
88
- lib/features/
89
- account/
90
- account_screen.dart
91
- edit_account_screen.dart
92
- widgets/
93
- account_avatar.dart
94
- account_form.dart
95
- providers/
96
- account_provider.dart
97
- domain/
98
- account.dart
99
- account_repository.dart
100
- ```
101
-
102
- ## Application Priority
103
-
104
- When reviewing code, apply in this order:
105
-
106
- 1. **Code Quality Patterns** (from fetched gist) - Anti-patterns, idioms, provider patterns
107
- 2. **Widget Organization** (above) - Build structure, extraction rules, async UX
108
- 3. **Folder Structure** (above) - File placement, feature boundaries
109
-
110
- ## Anti-Patterns Quick Reference
111
-
112
- Flag these patterns (details in fetched guidelines):
113
-
114
- - `useState<bool>` for loading states
115
- - Manual try-catch in provider actions
116
- - `.toList()..sort()` instead of `.sorted()`
117
- - `_handleAction(ref, controller, user, state)` with 4+ params
118
- - Hardcoded hex colors
119
- - Deep `lib/features/x/presentation/` directories
120
- - Barrel files that only re-export
121
- - Boolean flags instead of sealed classes
122
- - Magic numbers scattered across widgets
123
- - `where((e) => e.status == Status.active)` instead of computed property
124
- - Generic provider names like `expansionVisibilityProvider`
125
- - `.asData?.value` instead of `.value`
126
-
127
- ## Output Format
128
-
129
- Group by file. Use `file:line` format. Terse findings.
130
-
131
- ```text
132
- ## lib/home/home_screen.dart
133
-
134
- lib/home/home_screen.dart:42 - useState for loading state -> use provider
135
- lib/home/home_screen.dart:67 - .toList()..sort() -> .sorted()
136
- lib/home/home_screen.dart:89 - hardcoded Color(0xFF...) -> context.color.*
137
-
138
- ## lib/models/user.dart
139
-
140
- pass
141
- ```
142
-
143
- State issue + location. Skip explanation unless fix non-obvious. No preamble.
@@ -1,102 +0,0 @@
1
- ---
2
- name: flutter-code-simplification
3
- description: Reduce complexity in Flutter/Dart code. Use when code is too nested, hard to read, or has duplication. Extracts widgets, flattens logic, removes unnecessary abstraction.
4
- license: MIT
5
- metadata:
6
- author: Roland Tolnay
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.