mustflow 2.22.17 → 2.22.47

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 (70) hide show
  1. package/README.md +6 -0
  2. package/dist/cli/commands/api.js +874 -0
  3. package/dist/cli/commands/dashboard.js +51 -4
  4. package/dist/cli/commands/explain.js +3 -2
  5. package/dist/cli/commands/help.js +0 -1
  6. package/dist/cli/commands/run.js +41 -4
  7. package/dist/cli/commands/verify.js +4 -43
  8. package/dist/cli/i18n/en.js +15 -0
  9. package/dist/cli/i18n/es.js +15 -0
  10. package/dist/cli/i18n/fr.js +15 -0
  11. package/dist/cli/i18n/hi.js +15 -0
  12. package/dist/cli/i18n/ko.js +15 -0
  13. package/dist/cli/i18n/zh.js +15 -0
  14. package/dist/cli/index.js +1 -0
  15. package/dist/cli/lib/cli-output.js +1 -1
  16. package/dist/cli/lib/command-registry.js +6 -0
  17. package/dist/cli/lib/dashboard-html/client-script.js +9 -0
  18. package/dist/cli/lib/dashboard-html/styles.js +48 -1
  19. package/dist/cli/lib/doc-review-ledger.js +1 -1
  20. package/dist/cli/lib/local-index/index.js +324 -298
  21. package/dist/cli/lib/repo-map.js +19 -5
  22. package/dist/cli/lib/validation/index.js +6 -2
  23. package/dist/core/active-run-locks.js +36 -8
  24. package/dist/core/atomic-state-write.js +5 -20
  25. package/dist/core/change-verification.js +18 -2
  26. package/dist/core/contract-lint.js +3 -3
  27. package/dist/core/public-json-contracts.js +48 -0
  28. package/dist/core/repeated-failure.js +1 -1
  29. package/dist/core/run-write-drift.js +30 -17
  30. package/dist/core/safe-filesystem.js +54 -5
  31. package/dist/core/skill-route-explanation.js +2 -1
  32. package/dist/core/source-anchors.js +7 -3
  33. package/dist/core/validation-ratchet.js +61 -18
  34. package/dist/core/verification-decision-graph.js +8 -1
  35. package/dist/core/verification-plan-id.js +44 -0
  36. package/package.json +1 -1
  37. package/schemas/README.md +6 -0
  38. package/schemas/command-catalog.schema.json +158 -0
  39. package/schemas/diff-risk.schema.json +74 -0
  40. package/schemas/health.schema.json +45 -0
  41. package/schemas/latest-evidence.schema.json +95 -0
  42. package/schemas/verification-plan.schema.json +245 -0
  43. package/schemas/workspace-summary.schema.json +282 -0
  44. package/templates/default/i18n.toml +139 -1
  45. package/templates/default/locales/en/.mustflow/skills/INDEX.md +24 -1
  46. package/templates/default/locales/en/.mustflow/skills/api-contract-change/SKILL.md +212 -0
  47. package/templates/default/locales/en/.mustflow/skills/astro-code-change/SKILL.md +184 -0
  48. package/templates/default/locales/en/.mustflow/skills/auth-permission-change/SKILL.md +194 -0
  49. package/templates/default/locales/en/.mustflow/skills/config-env-change/SKILL.md +189 -0
  50. package/templates/default/locales/en/.mustflow/skills/css-code-change/SKILL.md +199 -0
  51. package/templates/default/locales/en/.mustflow/skills/dart-code-change/SKILL.md +179 -0
  52. package/templates/default/locales/en/.mustflow/skills/database-migration-change/SKILL.md +178 -0
  53. package/templates/default/locales/en/.mustflow/skills/dependency-upgrade-review/SKILL.md +151 -0
  54. package/templates/default/locales/en/.mustflow/skills/elysia-code-change/SKILL.md +115 -0
  55. package/templates/default/locales/en/.mustflow/skills/file-path-cross-platform-change/SKILL.md +147 -0
  56. package/templates/default/locales/en/.mustflow/skills/flutter-code-change/SKILL.md +116 -0
  57. package/templates/default/locales/en/.mustflow/skills/go-code-change/SKILL.md +156 -0
  58. package/templates/default/locales/en/.mustflow/skills/hono-code-change/SKILL.md +117 -0
  59. package/templates/default/locales/en/.mustflow/skills/html-code-change/SKILL.md +173 -0
  60. package/templates/default/locales/en/.mustflow/skills/javascript-code-change/SKILL.md +149 -0
  61. package/templates/default/locales/en/.mustflow/skills/python-code-change/SKILL.md +154 -0
  62. package/templates/default/locales/en/.mustflow/skills/release-publish-change/SKILL.md +172 -0
  63. package/templates/default/locales/en/.mustflow/skills/routes.toml +138 -0
  64. package/templates/default/locales/en/.mustflow/skills/rust-code-change/SKILL.md +154 -0
  65. package/templates/default/locales/en/.mustflow/skills/svelte-code-change/SKILL.md +186 -0
  66. package/templates/default/locales/en/.mustflow/skills/tailwind-code-change/SKILL.md +164 -0
  67. package/templates/default/locales/en/.mustflow/skills/tauri-code-change/SKILL.md +185 -0
  68. package/templates/default/locales/en/.mustflow/skills/typescript-code-change/SKILL.md +184 -0
  69. package/templates/default/locales/en/.mustflow/skills/unocss-code-change/SKILL.md +186 -0
  70. package/templates/default/manifest.toml +158 -1
@@ -0,0 +1,199 @@
1
+ ---
2
+ mustflow_doc: skill.css-code-change
3
+ locale: en
4
+ canonical: true
5
+ revision: 2
6
+ lifecycle: mustflow-owned
7
+ authority: procedure
8
+ name: css-code-change
9
+ description: Apply this skill when CSS, Sass, Less, CSS Modules, CSS-in-JS, global styles, cascade layers, selector specificity, design tokens, layout, responsive behavior, focus styles, animation, color, or component styling are created or changed.
10
+ metadata:
11
+ mustflow_schema: "1"
12
+ mustflow_kind: procedure
13
+ pack_id: mustflow.core
14
+ skill_id: mustflow.core.css-code-change
15
+ command_intents:
16
+ - changes_status
17
+ - changes_diff_summary
18
+ - lint
19
+ - build
20
+ - test_related
21
+ - test
22
+ - docs_validate_fast
23
+ - mustflow_check
24
+ ---
25
+
26
+ # CSS Code Change
27
+
28
+ <!-- mustflow-section: purpose -->
29
+ ## Purpose
30
+
31
+ Preserve cascade order, specificity discipline, resilient responsive layout, design tokens, focus visibility, contrast, reduced motion, browser compatibility, and layout stability. Treat CSS as a long-lived system, not a screenshot patch.
32
+
33
+ <!-- mustflow-section: use-when -->
34
+ ## Use When
35
+
36
+ - `.css`, Sass, Less, CSS Modules, CSS-in-JS, global styles, reset, theme variables, cascade layers, selectors, design tokens, component styles, animations, or responsive rules change.
37
+ - The task touches specificity, `!important`, inline styles, negative margins, layout shift, browser compatibility, dark mode, focus style, contrast, typography, zoom, text scaling, or motion preference.
38
+
39
+ <!-- mustflow-section: do-not-use-when -->
40
+ ## Do Not Use When
41
+
42
+ - Styling is entirely Tailwind utility usage; use `tailwind-code-change`.
43
+ - Styling is entirely UnoCSS utility usage; use `unocss-code-change`.
44
+
45
+ <!-- mustflow-section: required-inputs -->
46
+ ## Required Inputs
47
+
48
+ - Global CSS entrypoints, reset/base styles, cascade layer strategy, token files, theme config, component CSS, parent layout styles, browserslist, build config, and style lint config.
49
+ - Existing responsive, dark mode, accessibility, focus, reduced-motion, breakpoint, and design-token conventions.
50
+ - Target surfaces for narrow viewports, 200% zoom, text scaling, delayed media, third-party markup, and browser compatibility.
51
+ - Configured verification intents.
52
+
53
+ <!-- mustflow-section: preconditions -->
54
+ ## Preconditions
55
+
56
+ - Identify the cascade layer, selector scope, token source, layout constraints, and browser target before editing.
57
+ - Prefer low-specificity selectors, parent layout fixes, and existing semantic tokens.
58
+ - Identify whether the style belongs in global CSS, token/theme CSS, component-scoped CSS, CSS Modules, or a third-party wrapper.
59
+
60
+ <!-- mustflow-section: allowed-edits -->
61
+ ## Allowed Edits
62
+
63
+ - Add styles in the correct layer or module.
64
+ - Use class-level selectors, custom properties, design tokens, intrinsic sizing, flex, grid, container queries, or media queries according to local patterns.
65
+ - Preserve visible focus, contrast, text scaling, reduced motion, and reserved space for late-loaded media.
66
+ - Use narrow exceptions for legacy/third-party markup, runtime geometry, rich text/prose wrappers, and urgent accessibility overrides when lower-specificity or token-based fixes cannot solve the issue.
67
+
68
+ <!-- mustflow-section: procedure -->
69
+ ## Procedure
70
+
71
+ 1. Read global style entrypoints, tokens, component styles, parent layout styles, and build/lint config.
72
+ 2. Map the cascade: reset, base, tokens, layout, components, utilities, overrides.
73
+ 3. Do not patch visible symptoms with stronger specificity. Resolve conflicts by checking layer order, import order, token choice, component boundary, parent layout, and selector scope first.
74
+ 4. Do not add ID selectors for styling, selectors with more than two combinators, or new `!important` unless an allowed exception is documented.
75
+ 5. Do not use negative margin to repair normal content flow. Fix parent layout, spacing, alignment, or intrinsic sizing instead.
76
+ 6. Do not add inline styles for color, spacing, typography, focus, dark mode, or responsive layout. Inline styles are for runtime geometry such as drag positions, virtualized offsets, and measured canvas/SVG values.
77
+ 7. Use existing color, spacing, font, radius, shadow, z-index, and breakpoint tokens before adding literals.
78
+ 8. Keep raw color values out of component CSS. Add or reuse semantic tokens for surfaces, text, borders, actions, danger states, focus, disabled states, and dark mode.
79
+ 9. Avoid raw pixel values for typography, spacing, layout dimensions, and radius. Allow narrow values such as one-pixel borders, intrinsic icon/media dimensions, and established breakpoint tokens.
80
+ 10. Make layout responsive through constraints, `min-width: 0`, min/max sizing, flex/grid, wrapping, gap, intrinsic media dimensions, container/media queries, and content-based rules rather than fixed viewport assumptions.
81
+ 11. Do not set fixed width on page, section, container, card, modal, or form layouts. Do not set fixed height on components that contain text.
82
+ 12. Do not use viewport-only typography. Use bounded responsive type patterns that survive small screens and large displays.
83
+ 13. Do not use `overflow: hidden` to hide layout bugs. Allow it only for intentional clipping such as avatars, media crops, masks, or animation containers.
84
+ 14. Reserve dimensions or aspect ratio for images, videos, iframes, ads, embeds, skeletons, fonts, and lazy content that could cause layout shift.
85
+ 15. Preserve visible focus, sufficient contrast, 200% text resize behavior, text-spacing stress, keyboard navigation, and reduced-motion behavior.
86
+ 16. If hover styling changes an interactive affordance, provide a matching focus-visible affordance.
87
+ 17. Prefer outline and outline-offset for focus indicators. Do not rely only on shadows when ancestors may clip overflow.
88
+ 18. Respect reduced motion for parallax, large transforms, auto-scroll, route transitions, autoplay carousels, skeleton shimmer, and looping decorative animation.
89
+ 19. Check browser compatibility before adding new CSS features. Use progressive enhancement for newly available features and avoid limited-availability features unless the project browser target allows them.
90
+ 20. Choose configured verification intents that cover style lint, build, visual states, accessibility, and browser target risk when available.
91
+
92
+ <!-- mustflow-section: cascade-specificity-policy -->
93
+ ## Cascade And Specificity Policy
94
+
95
+ - Keep component styling overrideable with low-specificity class selectors.
96
+ - Do not use IDs as styling weight. IDs are for anchors, form/ARIA relationships, or JavaScript hooks.
97
+ - Do not write DOM-path selectors that break when markup gains or loses a wrapper.
98
+ - Use low-specificity contextual selectors for rich text or CMS areas. Prefer patterns that keep specificity easy to override.
99
+ - Do not add global overrides for local component problems when component-scoped styling or tokens can solve the issue.
100
+ - New `!important` requires an explicit exception for immutable third-party/legacy markup, third-party inline style override, urgent accessibility protection, or equivalent narrow reason.
101
+
102
+ <!-- mustflow-section: responsive-layout-policy -->
103
+ ## Responsive Layout Policy
104
+
105
+ - Layout must survive narrow screens, 200% zoom, increased text size, longer localized text, delayed media loading, and reduced motion.
106
+ - Prefer fluid width plus max constraints over fixed width.
107
+ - Prefer min-height, padding, and line-height over fixed height for text-containing controls.
108
+ - Prefer content-based layout, flex/grid, `minmax`, wrapping, and `clamp` over breakpoint patching.
109
+ - Avoid `100vw` except for deliberate full-bleed designs; otherwise prefer normal containing-block width.
110
+ - Avoid absolute positioning for normal document flow. Use it only for overlays, decorative placement, controls anchored to known boxes, or measured geometry.
111
+
112
+ <!-- mustflow-section: token-accessibility-policy -->
113
+ ## Token And Accessibility Policy
114
+
115
+ - Name visual values by role, not by raw color or numeric value.
116
+ - Search existing tokens before adding a value. If a new value has product meaning, theme impact, repeated use, or dark-mode behavior, add it at the token source.
117
+ - Body text and normal UI text should meet the project contrast target; large text and meaningful non-text UI indicators must remain distinguishable against adjacent colors.
118
+ - Do not communicate state by color alone. Pair color with text, icon shape, border, position, or another non-color signal when meaning matters.
119
+ - Never remove focus indication without replacing it in the same change.
120
+ - Verify focus, error, selected, disabled, hover, active, and dark-mode states when token or component color changes.
121
+
122
+ <!-- mustflow-section: browser-compatibility-policy -->
123
+ ## Browser Compatibility Policy
124
+
125
+ - New CSS features require browser-target awareness before use.
126
+ - Widely supported features may be used normally.
127
+ - Newly available features need a fallback or progressive enhancement path.
128
+ - Limited-availability features are blocked unless the repository browser target explicitly allows them.
129
+ - Feature queries are enhancements only. Keep an accessible fallback outside the query and layer the new behavior inside it.
130
+
131
+ <!-- mustflow-section: exception-policy -->
132
+ ## Exception Policy
133
+
134
+ Allowed exceptions include:
135
+
136
+ - Legacy or third-party markup that cannot be changed.
137
+ - Runtime geometry such as drag positions, virtualized list offsets, canvas/SVG measurements, or measured transforms.
138
+ - Accessibility emergency overrides such as focus visibility or reduced-motion protection.
139
+ - Rich text, CMS, or prose styling scoped to a wrapper with low specificity.
140
+ - Essential two-dimensional layouts such as data tables, maps, diagrams, code blocks, canvas, games, and design tools.
141
+
142
+ Every exception must explain why a lower-specificity, token-based, or layout-level fix is not enough and must include a removal condition when practical.
143
+
144
+ <!-- mustflow-section: review-rejection-criteria -->
145
+ ## Review Rejection Criteria
146
+
147
+ Reject the change when:
148
+
149
+ - It adds styling ID selectors, long descendant chains, or unexplained `!important`.
150
+ - It repairs normal document flow with negative margins or absolute positioning.
151
+ - It uses fixed width for containers or fixed height for text-containing UI.
152
+ - It hides layout bugs with `overflow: hidden`.
153
+ - It adds unsized media, embeds, ads, or lazy content that can shift layout.
154
+ - It hardcodes raw component colors, spacing, font sizes, radius, or shadows without an exception.
155
+ - It removes focus styling, creates hover-only affordances, or clips the focus indicator.
156
+ - It adds motion without reduced-motion behavior.
157
+ - It uses a new CSS feature without compatibility/fallback review.
158
+
159
+ <!-- mustflow-section: postconditions -->
160
+ ## Postconditions
161
+
162
+ - Selectors remain maintainable and low-specificity.
163
+ - Tokens are used or new literals are justified.
164
+ - Responsive, zoom, text-scaling, focus, contrast, motion, compatibility, and layout-shift risks are checked or reported.
165
+ - Exceptions are narrow, explained, and not used as a normal styling path.
166
+
167
+ <!-- mustflow-section: verification -->
168
+ ## Verification
169
+
170
+ Use configured oneshot command intents when available:
171
+
172
+ - `lint`
173
+ - `build`
174
+ - `test_related`
175
+ - `test`
176
+ - `docs_validate_fast`
177
+ - `mustflow_check`
178
+
179
+ Report missing visual, accessibility, or browser compatibility verification intents when relevant.
180
+
181
+ <!-- mustflow-section: failure-handling -->
182
+ ## Failure Handling
183
+
184
+ - If a style requires `!important` or high specificity, inspect the cascade conflict before adding it.
185
+ - If a raw token is missing, report whether a token should be added or the existing system should be reused.
186
+ - If visual verification is unavailable, report the unverified viewport, zoom, contrast, or motion states.
187
+ - If layout only works for the current screenshot, stop and rework it around content, constraints, and parent layout.
188
+ - If a new CSS feature fails in the target browser or WebView, add a fallback or remove the feature.
189
+
190
+ <!-- mustflow-section: output-format -->
191
+ ## Output Format
192
+
193
+ - Boundary checked
194
+ - Cascade, token, and responsive notes
195
+ - Accessibility and layout-stability notes
196
+ - Files changed
197
+ - Command intents run
198
+ - Skipped checks and reasons
199
+ - Remaining CSS risk
@@ -0,0 +1,179 @@
1
+ ---
2
+ mustflow_doc: skill.dart-code-change
3
+ locale: en
4
+ canonical: true
5
+ revision: 2
6
+ lifecycle: mustflow-owned
7
+ authority: procedure
8
+ name: dart-code-change
9
+ description: Apply this skill when Dart source, pub package metadata, null safety, async Futures or Streams, isolates, analyzer lints, tests, CLI entry points, or public package APIs are created or changed.
10
+ metadata:
11
+ mustflow_schema: "1"
12
+ mustflow_kind: procedure
13
+ pack_id: mustflow.core
14
+ skill_id: mustflow.core.dart-code-change
15
+ command_intents:
16
+ - changes_status
17
+ - changes_diff_summary
18
+ - lint
19
+ - build
20
+ - test_related
21
+ - test
22
+ - docs_validate_fast
23
+ - mustflow_check
24
+ ---
25
+
26
+ # Dart Code Change
27
+
28
+ <!-- mustflow-section: purpose -->
29
+ ## Purpose
30
+
31
+ Preserve Dart null-safety, async, stream, isolate, package API, analyzer, and test boundaries. Treat `!`, `late`, `dynamic`, broad casts, `.cast<T>()`, `.asBroadcastStream()`, and `unawaited()` as risk markers, not fixes.
32
+
33
+ <!-- mustflow-section: use-when -->
34
+ ## Use When
35
+
36
+ - `.dart`, `pubspec.yaml`, `analysis_options.yaml`, lockfiles, `lib`, `bin`, `test`, `example`, or public exports change.
37
+ - The task touches nullable types, `!`, `late`, `dynamic`, casts, raw generics, `Future`, `Stream`, `StreamController`, `StreamSubscription`, isolates, analyzer lints, pub package layout, package exports, `bin` entrypoints, README examples, or package versioning.
38
+
39
+ <!-- mustflow-section: do-not-use-when -->
40
+ ## Do Not Use When
41
+
42
+ - The change is Flutter widget or platform UI behavior; use `flutter-code-change` and this skill only as an adjunct for shared Dart package/API risk.
43
+ - Dart files are read only for orientation.
44
+
45
+ <!-- mustflow-section: required-inputs -->
46
+ ## Required Inputs
47
+
48
+ - `pubspec.yaml`, analyzer config, package layout, public export files, `lib/src` exports, examples, README snippets, CLI entrypoints, tests, and lockfile policy.
49
+ - Existing null-safety, async, exception, and package API conventions.
50
+ - SDK constraints, dependency constraints, executables, public dependency types, and versioning policy when package API changes.
51
+ - Configured verification intents.
52
+
53
+ <!-- mustflow-section: preconditions -->
54
+ ## Preconditions
55
+
56
+ - Identify whether the change affects public exports, `lib/src` exposure, internal implementation, CLI behavior, async lifecycle, package metadata, or tests.
57
+ - Treat nullable values, decoded data, map lookups, user input, streams, subscriptions, ports, and isolate messages as boundaries that need explicit ownership and validation.
58
+ - Classify any public nullability, callback, `Future<T>`, `Stream<T>`, generic bound, or default-value change before editing.
59
+
60
+ <!-- mustflow-section: allowed-edits -->
61
+ ## Allowed Edits
62
+
63
+ - Narrow nullable values at boundaries and keep core logic non-null where truthful.
64
+ - Use `unawaited` only when detached behavior is intentional, documented, and has local error handling.
65
+ - Cancel subscriptions, close controllers, and document isolate message shape where relevant.
66
+ - Keep public API changes synchronized with examples and docs.
67
+ - Strengthen analyzer boundaries when the project already uses strict linting; do not weaken analyzer or lint rules to pass the current patch.
68
+
69
+ <!-- mustflow-section: procedure -->
70
+ ## Procedure
71
+
72
+ 1. Read package metadata, analyzer config, public exports, nearby implementation, tests, and examples.
73
+ 2. Classify the touched boundary: nullability, public API, package layout, async `Future`, `Stream`, isolate, exception mapping, or test-only.
74
+ 3. Identify every nullable boundary: JSON decode, HTTP response, DB row, environment variable, CLI args, platform channel, isolate message, external callback, cache miss, map lookup, and dependency lookup.
75
+ 4. Accept external or decoded data as `Object?` at the boundary, validate it in a parser or codec layer, and let only typed domain objects leave that boundary. Do not let `dynamic` flow into internal code.
76
+ 5. Distinguish missing optional data from invalid required data. Optional business facts may stay nullable; required facts should be validated once and remain non-nullable afterward.
77
+ 6. Do not use `!`, `dynamic`, `late`, broad `as` casts, raw generic types, or `.cast<T>()` as shortcuts around design uncertainty.
78
+ 7. Allow `!` only when the same local block has a visible guard proving non-null and flow analysis cannot express it. Prefer early return, throw, or local-variable promotion.
79
+ 8. Avoid `late` fields for initialization-order problems. Prefer constructor injection, async factory construction, explicit state objects, or stored `Future<T>` initialization. `late final` still needs read-after-initialize evidence when public behavior depends on it.
80
+ 9. Replace broad JSON and collection casts with checked parsers that report the failing field path when feasible.
81
+ 10. Ensure every `Future` is awaited, returned, stored for later awaiting or cancellation, or intentionally detached with documented `unawaited` plus local error handling.
82
+ 11. Use `Future<void>` for public async APIs that complete later or can fail but do not produce a value. Avoid public `void async` except where a framework callback type requires it.
83
+ 12. Ensure every stream subscription, controller, sink, timer, socket, file watcher, receive port, or isolate has an owner and explicit shutdown path. Await cleanup futures when the API exposes them.
84
+ 13. Do not use `.asBroadcastStream()` to hide accidental multiple listens. Determine whether the source is truly broadcast, or create an explicit fan-out owner.
85
+ 14. For `StreamController`, connect external resource creation and pause/resume/cancel behavior to the controller lifecycle when buffering or resource usage matters.
86
+ 15. For `async*` functions wrapping external resources or upstream subscriptions, release resources in a `finally` path.
87
+ 16. For long-lived isolates, define startup, request and response message shapes, error propagation, shutdown messages, receive-port closing, and isolate termination.
88
+ 17. Do not import another package's `src` implementation. Treat symbols exported from this package's public libraries as public API even when their files live under `lib/src`.
89
+ 18. If public exports change, update examples, README snippets, CLI smoke surfaces, and tests that represent consumer behavior when present.
90
+ 19. Choose configured verification intents that cover analyzer, formatting, tests, package build, dependency bounds, publish dry-run, examples, CLI behavior, and public API risk when available.
91
+
92
+ <!-- mustflow-section: null-safety-policy -->
93
+ ## Null-Safety Policy
94
+
95
+ - `!`, `late`, `dynamic`, broad `as`, raw generic types, `.cast<T>()`, and nullable-to-non-nullable casts are risk markers.
96
+ - Nullable values should be narrowed at the boundary. Core domain objects should be non-nullable when the value is required.
97
+ - `Object?` is preferred over `dynamic` for raw external input because it forces validation before use.
98
+ - Required fields that are missing should fail at the parser or constructor boundary. Do not make required domain fields nullable only to avoid validation.
99
+ - `late` should not hide initialization order. Use it only when local construction or framework lifecycle makes the initialization proof clear and the risk is reported.
100
+ - Public API nullability changes require compatibility classification before version changes.
101
+
102
+ <!-- mustflow-section: async-resource-policy -->
103
+ ## Async And Resource Policy
104
+
105
+ - Every future expression must be awaited, returned, stored for later awaiting or cancellation, or intentionally detached with documented `unawaited` and local error handling.
106
+ - `unawaited` must not be used only to silence analyzer warnings. Detached work needs an error sink and a reason.
107
+ - `Future` error handling should be attached before the future completes; prefer straightforward `await` with try/catch where local recovery is needed.
108
+ - Every `StreamSubscription` needs an owner and a lifecycle method that cancels it.
109
+ - Every `StreamController`, sink, timer, socket, watcher, port, or isolate needs an explicit close, cancel, kill, or shutdown path.
110
+ - Long-lived isolates must define message contracts, errors, shutdown, port ownership, and termination behavior.
111
+
112
+ <!-- mustflow-section: public-api-policy -->
113
+ ## Package Public API Policy
114
+
115
+ Public surface includes importable files under `lib`, exports from the main library, exported `lib/src` symbols, public classes, functions, typedefs, extensions, enums, constructors, fields, getters, setters, generic bounds, callback signatures, future and stream element types, documented errors, and `bin` executables.
116
+
117
+ - Do not treat `lib/src` as public unless a public library exports it.
118
+ - Do not import another package's `lib/src`.
119
+ - Nullability, required named parameters, default values, generic bounds, callback signatures, `Future<T>` and `Stream<T>` element types, dependency types in public signatures, CLI args, stdout/stderr shape, and exit codes are compatibility-sensitive.
120
+ - If a public API exposes a dependency type, dependency constraints become part of the public contract. Check lower-bound and upper-range compatibility when configured verification exists.
121
+ - README and `example` code are consumer smoke surfaces. Keep them aligned with public API changes.
122
+ - CLI entries under `bin` are public behavior. Command names, args, exit codes, and output formats need compatibility review.
123
+
124
+ <!-- mustflow-section: rejection-criteria -->
125
+ ## Review Rejection Criteria
126
+
127
+ Reject or revise the patch when any of these appear without explicit evidence and risk reporting:
128
+
129
+ - New `!`, `late`, `dynamic`, raw generic types, broad `as`, `.cast<T>()`, nullable-to-non-nullable casts, or analyzer ignores used only to make errors disappear.
130
+ - Decoded JSON, platform messages, isolate messages, CLI args, environment values, map lookups, or external callbacks trusted without boundary parsing.
131
+ - Required domain values made nullable instead of validating the boundary.
132
+ - A future expression is neither awaited, returned, stored, nor intentionally detached with error handling.
133
+ - Public `void async` is added where `Future<void>` would preserve completion and error signaling.
134
+ - Stream subscriptions, controllers, ports, timers, sockets, watchers, or isolates are created without cleanup ownership.
135
+ - `.asBroadcastStream()` is used to hide a design problem around multiple listeners.
136
+ - Public nullability, generic bound, callback, `Future<T>`, `Stream<T>`, export, CLI, SDK constraint, dependency constraint, or executable behavior changes without compatibility classification.
137
+
138
+ <!-- mustflow-section: postconditions -->
139
+ ## Postconditions
140
+
141
+ - Nullability and async ownership are explicit.
142
+ - Public package API impact is known.
143
+ - Analyzer and tests were preserved or skipped with reason.
144
+ - No safety boundary was hidden behind `!`, `dynamic`, `late`, casts, `unawaited`, or analyzer ignores without a risk note.
145
+ - Examples, README snippets, CLI entrypoints, and package metadata are synchronized when public behavior changes.
146
+
147
+ <!-- mustflow-section: verification -->
148
+ ## Verification
149
+
150
+ Use configured oneshot command intents when available:
151
+
152
+ - `lint`
153
+ - `build`
154
+ - `test_related`
155
+ - `test`
156
+ - `docs_validate_fast`
157
+ - `mustflow_check`
158
+
159
+ Report missing package publish or analyzer verification intents rather than inventing tool commands.
160
+
161
+ When the repository exposes configured intents for these surfaces, cover strict analyzer checks, tests, package dry-run, dependency lower and upper bound checks, example or README analysis, CLI smoke behavior, and consumer-style public-import checks.
162
+
163
+ <!-- mustflow-section: failure-handling -->
164
+ ## Failure Handling
165
+
166
+ - If nullable data cannot be narrowed safely, report the missing validation boundary.
167
+ - If stream or isolate lifetime is unclear, avoid adding more asynchronous ownership until the owner is identified.
168
+ - If public API compatibility is unclear, report the consumer risk and the changed public symbols or executables.
169
+ - If analyzer/lint rules block the patch, fix the code or report the real boundary issue instead of weakening analysis.
170
+
171
+ <!-- mustflow-section: output-format -->
172
+ ## Output Format
173
+
174
+ - Boundary checked
175
+ - Nullability, async, stream, or API notes
176
+ - Files changed
177
+ - Command intents run
178
+ - Skipped checks and reasons
179
+ - Remaining Dart risk
@@ -0,0 +1,178 @@
1
+ ---
2
+ mustflow_doc: skill.database-migration-change
3
+ locale: en
4
+ canonical: true
5
+ revision: 1
6
+ lifecycle: mustflow-owned
7
+ authority: procedure
8
+ name: database-migration-change
9
+ description: Apply this skill when database migration files, schema migration history, ORM schema migrations, generated clients, schema dumps, SQL snapshots, backfills, rolling deploy compatibility, expand-and-contract changes, destructive database changes, migration rollback claims, or production database migration procedures are created, changed, reviewed, or reported.
10
+ metadata:
11
+ mustflow_schema: "1"
12
+ mustflow_kind: procedure
13
+ pack_id: mustflow.core
14
+ skill_id: mustflow.core.database-migration-change
15
+ command_intents:
16
+ - changes_status
17
+ - changes_diff_summary
18
+ - lint
19
+ - build
20
+ - test_related
21
+ - test
22
+ - docs_validate_fast
23
+ - test_release
24
+ - mustflow_check
25
+ ---
26
+
27
+ # Database Migration Change
28
+
29
+ <!-- mustflow-section: purpose -->
30
+ ## Purpose
31
+
32
+ Keep database migrations safe for running systems by checking deploy compatibility, data preservation, backfill behavior, generated artifacts, ORM contracts, and rollback reality.
33
+
34
+ Do not treat migration authoring as "make a file that applies locally." Treat it as "old code and new code must survive the same database during rollout."
35
+
36
+ <!-- mustflow-section: use-when -->
37
+ ## Use When
38
+
39
+ - A database migration file, migration history entry, schema dump, ORM schema, SQL snapshot, generated client, seed, fixture, schema validator, or migration documentation is created or changed.
40
+ - A change adds, removes, renames, splits, merges, backfills, rewrites, validates, constrains, indexes, foreign-keys, type-changes, defaults, nullable rules, enum values, tables, columns, generated columns, triggers, views, functions, row-level policies, or data migrations.
41
+ - A task mentions rolling deploy, expand-and-contract, online migration, backfill, production schema change, rollback, down migration, migration lock, DDL transaction, generated ORM client, migration drift, schema drift, or database migration safety.
42
+ - Prisma, Drizzle, TypeORM, Rails Active Record, Django migrations, Alembic, Diesel, Ecto, Flyway, Liquibase, Knex, Sequelize, SQLx, or another migration tool changes schema, generated output, migration metadata, or deployment behavior.
43
+ - A final report claims a database migration is safe, reversible, applied, validated, production-ready, no-downtime, rollback-safe, or tested from an old schema.
44
+
45
+ <!-- mustflow-section: do-not-use-when -->
46
+ ## Do Not Use When
47
+
48
+ - The change only edits query logic or persisted data model code without a migration, generated schema artifact, or migration claim; use `database-change-safety`.
49
+ - The migration is not database-backed, such as file layout, template, cache, content, URL, export, import, or platform migration; use `migration-safety-check`.
50
+ - The task only discusses database design without changing or reporting migration behavior.
51
+
52
+ <!-- mustflow-section: required-inputs -->
53
+ ## Required Inputs
54
+
55
+ - Source schema, target schema, migration files, migration history table or metadata, generated clients, schema dumps, SQL snapshots, seeds, fixtures, and affected queries.
56
+ - Migration tool and ecosystem: Prisma, Drizzle, TypeORM, Rails, Django, Alembic, Diesel, Ecto, Flyway, Liquibase, Knex, Sequelize, SQLx, raw SQL, or another declared tool.
57
+ - Deployment shape: single-step deploy, rolling deploy, blue-green, multiple app versions, background workers, read replicas, multiple services, serverless functions, mobile clients, or external integrations.
58
+ - Database engine and operational surface: PostgreSQL, MySQL, SQLite, SQL Server, managed database, migration lock behavior, DDL transaction behavior, online DDL options, table size, expected lock time, statement timeout, lock timeout, and restore capability when known.
59
+ - Data preservation needs, compatibility window, backfill size, batch strategy, restart marker, validation query, rollback type, and whether old code can run after the new schema lands.
60
+ - Relevant command-intent entries for build, generated-output checks, tests, docs, release, and mustflow validation.
61
+
62
+ <!-- mustflow-section: preconditions -->
63
+ ## Preconditions
64
+
65
+ - The task matches the Use When conditions and does not match the Do Not Use When exclusions.
66
+ - Higher-priority instructions and `.mustflow/config/commands.toml` have been checked for the current scope.
67
+ - The migration is classified before editing as expand, backfill, switch, contract, destructive, data-only, schema-only, generated-output-only, ORM metadata-only, or rollback documentation.
68
+ - If personal data, tenant isolation, authorization, audit, retention, or secrets are involved, also use `security-privacy-review`.
69
+ - If public API response shape changes because of the migration, also use `api-contract-change`.
70
+ - If file paths or storage keys change with the database migration, also use `file-path-cross-platform-change`.
71
+
72
+ <!-- mustflow-section: allowed-edits -->
73
+ ## Allowed Edits
74
+
75
+ - Update migration files, ORM schema files, generated client expectations, schema dumps, SQL snapshots, seeds, fixtures, compatibility code, backfill code, validation checks, docs, and tests directly required by the migration.
76
+ - Prefer expand-and-contract for live systems: add compatible shape, backfill safely, switch reads and writes, then contract only after compatibility is proven.
77
+ - Keep destructive cleanup separate from expansion unless the repository explicitly proves a single-step deployment is safe.
78
+ - Do not weaken tests, delete migration history, hand-edit generated client output, suppress migration drift, or claim rollback safety for lossy changes.
79
+
80
+ <!-- mustflow-section: procedure -->
81
+ ## Procedure
82
+
83
+ 1. Classify the migration surface: schema DDL, data migration, backfill, generated client, schema dump, ORM metadata, seed, fixture, migration docs, or deploy procedure.
84
+ 2. Read the tool-specific source of truth before editing.
85
+ - Prisma: schema file, migrations directory, generated client use, migration history expectations, production deploy flow, and drift behavior.
86
+ - Drizzle: schema exports, generated SQL, snapshot or meta files, migration journal, generated client or query types, and runtime schema imports.
87
+ - TypeORM: entity metadata, migration files, data-source config, production synchronization setting, generated SQL, and runtime entity loading.
88
+ - Rails: migration files, schema dump, model validations, historical migration model usage, seeds, fixtures, callbacks, and deploy order.
89
+ - Django: migration files, state operations, historical models, schema editor behavior, generated SQL when relevant, and data migration functions.
90
+ - Alembic or SQLAlchemy: migration revisions, autogenerate output, branch heads, model metadata, downgrade functions, naming conventions, and generated SQL.
91
+ - Diesel, Ecto, Flyway, Liquibase, Knex, Sequelize, SQLx, and raw SQL: migration history, checked-in SQL, generated metadata, compile-time query checks, rollback files, and schema dumps.
92
+ 3. Build a migration ledger: old shape, new shape, rows affected, old code behavior, new code behavior, rollback expectation, generated artifact changes, dependent callers, and validation query.
93
+ 4. Classify compatibility.
94
+ - Old code on old schema.
95
+ - Old code on expanded schema.
96
+ - New code on expanded schema.
97
+ - New code after backfill.
98
+ - New code after contract.
99
+ If any required state fails, the migration is not rolling-deploy safe.
100
+ 5. For column add, decide nullability, default behavior, backfill strategy, write path, read fallback, index need, and when a future `NOT NULL` or constraint can be enforced.
101
+ 6. For column drop, first prove all reads, writes, generated clients, old app versions, jobs, analytics, exports, seeds, fixtures, docs, and external consumers stopped using the column. Treat drop as a contract phase, not as the first migration.
102
+ 7. For rename, do not implement rename as drop plus add unless data loss is explicitly intended and approved. Prefer add new column, dual-write or copy, backfill, switch reads, validate, then drop old column later.
103
+ 8. For type changes, check whether the database rewrites the table, whether old values can fail conversion, whether indexes or constraints rebuild, whether application serializers change, and whether API or generated client types change.
104
+ 9. For nullable and default changes, distinguish schema default from application default. Avoid assuming existing rows are backfilled by a new default.
105
+ 10. For constraints and foreign keys, use staged validation when the database supports it. Add the constraint without validating existing rows when appropriate, backfill or repair data, then validate in a separate phase.
106
+ 11. For indexes, check table size, write load, lock behavior, concurrent or online index support, uniqueness validation, existing duplicates, and whether generated ORM queries will use the index.
107
+ 12. For enum changes, check old code behavior, generated client unions, database enum migration limits, default values, serialization, API compatibility, and whether removing or renaming values requires a data migration first.
108
+ 13. For table split, table merge, or relationship rewrite, preserve stable identifiers, foreign keys, audit references, external IDs, permissions, search documents, exports, and old-to-new mapping until all callers switch.
109
+ 14. For backfills, make them bounded, restartable, observable, and validated. Define batch size, ordering key, checkpoint, retry behavior, idempotency, timeout, lock expectation, dead-letter or manual review behavior, and validation queries.
110
+ 15. Do not run or recommend full-table updates on production-sized data without measured volume, lock expectation, batch plan, timeout policy, and recovery plan.
111
+ 16. Keep external side effects out of database migrations unless the repository has an explicit recovery model. Sending emails, calling payment APIs, deleting files, or mutating external providers from a migration usually breaks rollback.
112
+ 17. Check generated surfaces after schema changes: ORM clients, types, SQL snapshots, schema dumps, OpenAPI or GraphQL projections, API mocks, fixtures, seeds, admin screens, analytics, ETL, BI queries, and docs examples.
113
+ 18. Review ORM-specific traps.
114
+ - Prisma generated client and migration history must match the migration files that production applies.
115
+ - Drizzle schema exports and generated SQL or snapshots must not drift.
116
+ - TypeORM production `synchronize` must not be used as a migration strategy.
117
+ - Django rename detection and autogeneration must be reviewed so rename does not become delete and create.
118
+ - Alembic autogenerate output is a candidate, not a reviewed migration.
119
+ - Rails migrations should not depend on current model callbacks or validations when historical data can outlive current model code.
120
+ 19. Decide rollback honestly.
121
+ - Reversible: schema-only and data-preserving.
122
+ - Forward-fix preferred: partial live migration can be corrected without restoring.
123
+ - Restore required: deletes, table merges, generated IDs, hashing, encryption, irreversible type conversions, external side effects, or lossy transforms.
124
+ Do not promise rollback for changes that cannot reconstruct old values.
125
+ 20. Rehearse from the previous production-like schema when possible. A migration that only applies to a freshly generated schema is not enough.
126
+ 21. Check dependent surfaces: application code, background jobs, cron tasks, workers, ETL, reports, admin tools, data exports, imports, mobile or older clients, webhooks, API clients, generated SDKs, test fixtures, seeds, docs, and monitoring.
127
+ 22. Select verification from the command contract. Major schema changes, generated client changes, rollback-sensitive changes, security-sensitive migrations, and production deployment changes need broader verification than local schema-only edits.
128
+
129
+ <!-- mustflow-section: postconditions -->
130
+ ## Postconditions
131
+
132
+ - Source schema, target schema, migration files, generated artifacts, schema dumps, seeds, fixtures, and dependent code agree.
133
+ - Expand, backfill, switch, and contract phases are separated or explicitly proven unnecessary.
134
+ - Old-code/new-schema and new-code/expanded-schema compatibility is classified.
135
+ - Backfill and validation behavior is bounded, restartable, and checkable where relevant.
136
+ - Rollback claims distinguish schema rollback, data rollback, app rollback, forward-fix, and restore-required cases.
137
+ - Destructive changes and production lock risks are either deferred, measured, or reported as remaining risk.
138
+
139
+ <!-- mustflow-section: verification -->
140
+ ## Verification
141
+
142
+ Use configured oneshot command intents when available:
143
+
144
+ - `changes_status`
145
+ - `changes_diff_summary`
146
+ - `lint`
147
+ - `build`
148
+ - `test_related`
149
+ - `test`
150
+ - `docs_validate_fast`
151
+ - `test_release`
152
+ - `mustflow_check`
153
+
154
+ Prefer configured migration dry-run, generated-output, schema-diff, or database test intents when the command contract exposes them. Do not invent raw migration commands inside the skill.
155
+
156
+ <!-- mustflow-section: failure-handling -->
157
+ ## Failure Handling
158
+
159
+ - If old/new application compatibility is unknown, do not call the migration rolling-deploy safe.
160
+ - If production table size, lock behavior, or validation cost is unknown, report the operation as production-risky.
161
+ - If an autogenerator proposes drop/create for a rename, stop and rewrite the migration plan.
162
+ - If a migration is lossy, do not claim rollback beyond restore or forward corrective migration.
163
+ - If generated clients or schema dumps drift, fix the source of truth and regenerated surfaces together.
164
+ - If configured verification is missing, report the missing command intent instead of inferring package-manager, ORM, or migration-tool commands.
165
+
166
+ <!-- mustflow-section: output-format -->
167
+ ## Output Format
168
+
169
+ - Database migration changed
170
+ - Tool and database engine surface inspected
171
+ - Source schema, target schema, and migration phase
172
+ - Old-code/new-schema and new-code/expanded-schema compatibility
173
+ - Backfill, validation, lock, timeout, and rollback classification
174
+ - ORM/generated client/schema dump/snapshot surfaces synchronized
175
+ - Dependent surfaces checked
176
+ - Command intents run
177
+ - Skipped migration checks and reasons
178
+ - Remaining database migration risk