mustflow 2.22.16 → 2.22.46

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 (67) hide show
  1. package/dist/cli/commands/dashboard.js +51 -4
  2. package/dist/cli/commands/explain.js +3 -2
  3. package/dist/cli/commands/help.js +0 -1
  4. package/dist/cli/commands/run.js +51 -4
  5. package/dist/cli/commands/verify.js +2 -1
  6. package/dist/cli/i18n/en.js +5 -0
  7. package/dist/cli/i18n/es.js +5 -0
  8. package/dist/cli/i18n/fr.js +5 -0
  9. package/dist/cli/i18n/hi.js +5 -0
  10. package/dist/cli/i18n/ko.js +5 -0
  11. package/dist/cli/i18n/zh.js +5 -0
  12. package/dist/cli/lib/cli-output.js +1 -1
  13. package/dist/cli/lib/dashboard-html/client-script.js +9 -0
  14. package/dist/cli/lib/dashboard-html/styles.js +48 -1
  15. package/dist/cli/lib/doc-review-ledger.js +1 -1
  16. package/dist/cli/lib/git-changes.js +2 -0
  17. package/dist/cli/lib/local-index/index.js +324 -298
  18. package/dist/cli/lib/repo-map.js +19 -5
  19. package/dist/cli/lib/run-plan.js +20 -7
  20. package/dist/cli/lib/run-root-trust.js +33 -2
  21. package/dist/cli/lib/validation/index.js +6 -2
  22. package/dist/cli/lib/validation/test-selection.js +11 -1
  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/command-intent-eligibility.js +7 -0
  27. package/dist/core/contract-lint.js +3 -3
  28. package/dist/core/line-endings.js +2 -0
  29. package/dist/core/repeated-failure.js +1 -1
  30. package/dist/core/run-write-drift.js +42 -26
  31. package/dist/core/safe-filesystem.js +54 -5
  32. package/dist/core/skill-route-explanation.js +2 -1
  33. package/dist/core/source-anchors.js +7 -3
  34. package/dist/core/test-selection.js +13 -2
  35. package/dist/core/test-target-paths.js +17 -0
  36. package/dist/core/validation-ratchet.js +62 -17
  37. package/dist/core/verification-decision-graph.js +8 -1
  38. package/package.json +1 -1
  39. package/templates/default/i18n.toml +141 -3
  40. package/templates/default/locales/en/.mustflow/skills/INDEX.md +24 -1
  41. package/templates/default/locales/en/.mustflow/skills/api-contract-change/SKILL.md +212 -0
  42. package/templates/default/locales/en/.mustflow/skills/astro-code-change/SKILL.md +184 -0
  43. package/templates/default/locales/en/.mustflow/skills/auth-permission-change/SKILL.md +194 -0
  44. package/templates/default/locales/en/.mustflow/skills/config-env-change/SKILL.md +189 -0
  45. package/templates/default/locales/en/.mustflow/skills/css-code-change/SKILL.md +199 -0
  46. package/templates/default/locales/en/.mustflow/skills/dart-code-change/SKILL.md +179 -0
  47. package/templates/default/locales/en/.mustflow/skills/database-migration-change/SKILL.md +178 -0
  48. package/templates/default/locales/en/.mustflow/skills/dependency-upgrade-review/SKILL.md +151 -0
  49. package/templates/default/locales/en/.mustflow/skills/elysia-code-change/SKILL.md +115 -0
  50. package/templates/default/locales/en/.mustflow/skills/file-path-cross-platform-change/SKILL.md +147 -0
  51. package/templates/default/locales/en/.mustflow/skills/flutter-code-change/SKILL.md +116 -0
  52. package/templates/default/locales/en/.mustflow/skills/go-code-change/SKILL.md +156 -0
  53. package/templates/default/locales/en/.mustflow/skills/hono-code-change/SKILL.md +117 -0
  54. package/templates/default/locales/en/.mustflow/skills/html-code-change/SKILL.md +173 -0
  55. package/templates/default/locales/en/.mustflow/skills/javascript-code-change/SKILL.md +149 -0
  56. package/templates/default/locales/en/.mustflow/skills/python-code-change/SKILL.md +154 -0
  57. package/templates/default/locales/en/.mustflow/skills/release-publish-change/SKILL.md +172 -0
  58. package/templates/default/locales/en/.mustflow/skills/routes.toml +138 -0
  59. package/templates/default/locales/en/.mustflow/skills/rust-code-change/SKILL.md +154 -0
  60. package/templates/default/locales/en/.mustflow/skills/security-privacy-review/SKILL.md +22 -7
  61. package/templates/default/locales/en/.mustflow/skills/security-regression-tests/SKILL.md +31 -20
  62. package/templates/default/locales/en/.mustflow/skills/svelte-code-change/SKILL.md +186 -0
  63. package/templates/default/locales/en/.mustflow/skills/tailwind-code-change/SKILL.md +164 -0
  64. package/templates/default/locales/en/.mustflow/skills/tauri-code-change/SKILL.md +185 -0
  65. package/templates/default/locales/en/.mustflow/skills/typescript-code-change/SKILL.md +184 -0
  66. package/templates/default/locales/en/.mustflow/skills/unocss-code-change/SKILL.md +186 -0
  67. package/templates/default/manifest.toml +158 -1
@@ -2,7 +2,7 @@
2
2
  mustflow_doc: skill.security-regression-tests
3
3
  locale: en
4
4
  canonical: true
5
- revision: 9
5
+ revision: 11
6
6
  lifecycle: mustflow-owned
7
7
  authority: procedure
8
8
  name: security-regression-tests
@@ -32,11 +32,13 @@ Convert security-sensitive behavior changes into safe negative tests that preser
32
32
 
33
33
  - Authentication, authorization, session, CSRF, rate-limit, admin, payment, credit, subscription, personal-data, or tenant-boundary behavior changes.
34
34
  - Input validation, output encoding, file upload, path handling, webhook callback, redirect, or external URL handling changes.
35
+ - Public action, webhook, callback, replay, job enqueue, idempotency, deduplication, or in-memory intake-store behavior changes.
35
36
  - Cookie, JWT, OAuth callback, reset token, invite token, logout, reauthentication, file download, upload processing, business-rule, entitlement, pricing, inventory, database query, ORM bulk operation, or deployment-configuration behavior changes.
36
37
  - AI-generated or vibe-coded routes, data access, external fetchers, admin screens, or database rules need denied-case coverage beyond a happy-path test.
37
38
  - Cryptography, password hashing, secure randomness, HTTPS/TLS, certificate validation, scanner-gate, or security-invariant behavior changes.
38
39
  - Command construction, command recommendation, executable resolution, command-contract linting, or copy-to-clipboard command behavior changes.
39
40
  - Filesystem containment, symlink handling, package publishing, build pipeline, or release automation behavior changes.
41
+ - Policy engines, architecture linters, rule-catalog loaders, schema validators, generated compliance reports, or governance gates change how security-sensitive data, API, AI, payment, tier, deployment, ownership, or repository boundaries are approved.
40
42
  - A bug fix closes an abuse case and the fix needs a regression test to prevent reintroduction.
41
43
  - A review identifies a concrete security-sensitive boundary that can be expressed as a deterministic test.
42
44
  - A static analysis alert identifies a concrete data flow, permission boundary, command boundary, artifact boundary, or input-handling bug that can be locked with a local test.
@@ -96,13 +98,18 @@ Convert security-sensitive behavior changes into safe negative tests that preser
96
98
  - unsafe external URL, callback, redirect, or server-side request target
97
99
  - SSRF-style private network, localhost, link-local metadata, redirect, or DNS re-resolution target
98
100
  - missing webhook signature validation or unsafe retry behavior for external callbacks
101
+ - insecure verifier, authenticator, authorizer, normalizer, or dedupe default where missing configuration silently becomes allow-all, unsigned, no-op, or test-only behavior on a public endpoint
99
102
  - CSRF-style state change that relies on browser credentials without an origin, token, or same-site boundary
100
103
  - missing rate limit or lockout on login, signup, token reset, invitation, webhook, or expensive generation endpoints
101
104
  - client-supplied price, discount, role, owner, entitlement, plan, inventory, seat, refund, coupon, or usage value trusted by the server
102
105
  - ORM mass assignment, unscoped `findMany`, `updateMany`, `deleteMany`, unsafe migration default, or missing database policy enforcement
103
106
  - unsafe shell command construction, command name interpolation, clipboard command output, or executable lookup
104
- - filesystem escape through symlinks, path traversal, archive entries, generated state, or package contents
107
+ - repository inspection command that unexpectedly executes local Git helpers, hooks, credential helpers, package lifecycle hooks, PATH shims, or other repository-controlled executables
108
+ - filesystem escape through symlinks, path traversal, archive entries, Git tree entries, generated state, or package contents
105
109
  - mismatch between two validators, linters, dashboards, schemas, or release gates that claim the same policy
110
+ - policy-source mismatch where a validator loads a security rule from the wrong catalog, silently disables a missing rule, or accepts a legacy fallback without an explicit compatibility test
111
+ - untrusted metadata override where a repository-controlled field, nested duplicate, component, owner, stage, tier, role, or exemption value is treated as trusted ownership or authorization evidence
112
+ - invalid-but-present security control values where `false`, `0`, `{}`, `[]`, empty strings, or type-mismatched placeholders satisfy required policy fields
106
113
  - release or package-publishing pipeline code execution before artifact publication
107
114
  - incomplete escaping, quoting, encoding, or sanitization where the safe behavior can be asserted without invoking a real shell or network target
108
115
  - stack trace or internal error exposure through a user-visible API, report, dashboard, or command output
@@ -116,6 +123,7 @@ Convert security-sensitive behavior changes into safe negative tests that preser
116
123
  - missing capability or scoped permission object where a sensitive operation depends on broad user, role, or global authorization state
117
124
  - missing invariant policy where a sensitive state change could violate a non-negotiable rule such as last-owner, entitlement, paid-order, refund, or retention constraints
118
125
  - missing idempotency key, action ledger, or outbox/inbox record where repeated execution of a side effect could charge, refund, notify, grant, revoke, publish, or delete more than once
126
+ - unbounded public request identifiers, idempotency keys, webhook event ids, replay ids, provider names, request ids, or header values retained in process memory without length, entry-count, TTL, eviction, or cleanup on rejected requests
119
127
  - exposed debug, admin, metrics, storage, GraphQL, development console, root container user, default credential, or fork pull-request secret path that can be checked locally
120
128
  3. Search for existing tests that already cover the same boundary. Strengthen the existing test when that gives clearer coverage than adding a new one.
121
129
  4. Build the smallest safe negative test data: at least one allowed control case when useful, and one denied case that proves the boundary rejects the abuse condition.
@@ -124,24 +132,27 @@ Convert security-sensitive behavior changes into safe negative tests that preser
124
132
  7. For CSRF and browser-credential state changes, assert that the mutating operation rejects missing or mismatched token, origin, or same-site evidence according to the project framework.
125
133
  8. For rate limits and lockouts, use injected time, local stores, or fake counters to prove repeated attempts are bounded without slowing the suite.
126
134
  9. For session, JWT, OAuth, reset, invite, logout, or reauthentication boundaries, assert the denied condition directly: invalid signature, expired token, wrong issuer, wrong audience, missing state, revoked token, reused token, or missing recent authentication.
127
- 10. For upload and download boundaries, use local fixture files and fake storage. Assert authorization, content signature, MIME, size, filename, path, metadata stripping, and conversion resource-limit behavior without using live user files.
128
- 11. For business-rule boundaries, use server-side fixtures that try manipulated price, discount, role, owner, entitlement, plan, inventory, seat, refund, coupon, or usage fields. Assert that state remains unchanged or is recalculated from trusted server data.
129
- 12. For database and ORM boundaries, assert scoped queries or policies through observable behavior: cross-tenant rows stay invisible, bulk update or delete affects only owned rows, mass-assigned privileged fields are ignored, and unsafe migration defaults cannot create elevated access.
130
- 13. For cryptography and token-generation boundaries, assert behavior through the project-owned API rather than hard-coding private implementation details: password verifiers reject plaintext or fast-hash storage, token generation uses injected secure randomness or a deterministic test double, and custom cryptography shortcuts are absent where the project exposes that decision.
131
- 14. For transport-security boundaries, assert configuration rejects disabled certificate validation or insecure HTTP for sensitive endpoints when the project owns that configuration.
132
- 15. For architecture-drift boundaries, write the test around the security invariant, not the refactor shape: unauthorized access stays denied, sensitive output stays omitted, and side effects remain scoped after the generated structure changes.
133
- 16. For parser, validator, serializer, path, command, or workflow boundaries, consider a bounded property-based or fuzz-style regression when the invariant is clearer than a list of hand-written examples. Keep generators local, deterministic under the test runner, size-limited, and focused on the defensive invariant.
134
- 17. When adding a fuzzing or property-based testing dependency, keep dependency metadata, lockfiles, test selection rules, and package tests synchronized. Prefer an existing project dependency when it can express the invariant cleanly.
135
- 18. Use mocks or local fakes for external requests, uploads, redirects, webhooks, payment providers, file systems, shell commands, package registries, and CI workflows. Do not contact live suspicious endpoints or publish real artifacts.
136
- 19. Name the test after the defensive expectation, such as `cannot_read_other_users_invoice` or `rejects_private_network_callback_url`.
137
- 20. Keep assertions tied to observable behavior: status code, returned error shape, unchanged database state, missing side effect, sanitized output, rejected job, or invariant preserved for all generated cases.
138
- 21. Avoid dumping long exploit strings into the test. Use minimal representative inputs or generated values that prove the validation or boundary rule without becoming an offensive payload corpus.
139
- 22. For command and filesystem boundaries, assert the denied side effect directly: no injected command appears in a runnable recommendation, no repository-local shim is executed, no background shell pattern is counted runnable, no symlink target outside the root is read or written.
140
- 23. For plan/apply, capability, invariant, time, and idempotency boundaries, assert the safety contract directly: planning produces no side effect, commit rejects stale or unauthorized capability, invalid transitions preserve state, injected time controls expiry, and repeated side-effect keys do not repeat the effect.
141
- 24. For workflow scanner fixes, prefer repository-local assertions for durable contracts: action references are pinned to commit SHAs or digest-pinned containers, privileged permissions are job-scoped, fork pull requests do not receive secrets, deployment or scanner jobs can be manually rerun when useful, and dependency scans exclude fixture-only manifests unless intentionally included.
142
- 25. For deployment and configuration fixes, prefer local config assertions: debug flags are off for production, sample credentials are absent, public admin or metrics endpoints are not enabled by default, storage is not public, containers do not run as root when the project controls that setting, and HTTPS requirements are preserved.
143
- 26. For scanner-driven fixes, include a regression only when the rule reflects a durable project contract. Do not add brittle tests that merely assert the scanner's current wording, line number, or severity.
144
- 27. If the project lacks enough context to write a deterministic test, output a concrete test proposal instead of inventing fixtures or behavior.
135
+ 10. For public webhook, callback, and action-intake defaults, assert missing verifier, authenticator, or authorizer configuration fails registration or setup. If an intentionally unsafe local/test mode exists, require the test to pass that mode explicitly and name it in the fixture.
136
+ 11. For public idempotency, deduplication, replay, rate-limit, and request-tracking stores, assert malformed rejected requests do not permanently claim keys, oversized keys are rejected or normalized before retention, and default memory stores have observable bounds such as entry eviction, TTL, or a configured capacity.
137
+ 12. For upload and download boundaries, use local fixture files and fake storage. Assert authorization, content signature, MIME, size, filename, path, metadata stripping, and conversion resource-limit behavior without using live user files.
138
+ 13. For business-rule boundaries, use server-side fixtures that try manipulated price, discount, role, owner, entitlement, plan, inventory, seat, refund, coupon, or usage fields. Assert that state remains unchanged or is recalculated from trusted server data.
139
+ 14. For database and ORM boundaries, assert scoped queries or policies through observable behavior: cross-tenant rows stay invisible, bulk update or delete affects only owned rows, mass-assigned privileged fields are ignored, and unsafe migration defaults cannot create elevated access.
140
+ 15. For cryptography and token-generation boundaries, assert behavior through the project-owned API rather than hard-coding private implementation details: password verifiers reject plaintext or fast-hash storage, token generation uses injected secure randomness or a deterministic test double, and custom cryptography shortcuts are absent where the project exposes that decision.
141
+ 16. For transport-security boundaries, assert configuration rejects disabled certificate validation or insecure HTTP for sensitive endpoints when the project owns that configuration.
142
+ 17. For architecture-drift boundaries, write the test around the security invariant, not the refactor shape: unauthorized access stays denied, sensitive output stays omitted, and side effects remain scoped after the generated structure changes.
143
+ 18. For policy-engine or governance-linter boundaries, add denied cases that prove the invariant cannot be bypassed by newly named entities, spoofed duplicate fields, self-declared ownership metadata, missing or misplaced rule files, or invalid-but-present values. Include an allowed control case when it clarifies the intended trusted source.
144
+ 19. For parser, validator, serializer, path, command, or workflow boundaries, consider a bounded property-based or fuzz-style regression when the invariant is clearer than a list of hand-written examples. Keep generators local, deterministic under the test runner, size-limited, and focused on the defensive invariant.
145
+ 20. When adding a fuzzing or property-based testing dependency, keep dependency metadata, lockfiles, test selection rules, and package tests synchronized. Prefer an existing project dependency when it can express the invariant cleanly.
146
+ 21. Use mocks or local fakes for external requests, uploads, redirects, webhooks, payment providers, file systems, shell commands, package registries, Git helpers, and CI workflows. Do not contact live suspicious endpoints or publish real artifacts.
147
+ 22. Name the test after the defensive expectation, such as `cannot_read_other_users_invoice` or `rejects_private_network_callback_url`.
148
+ 23. Keep assertions tied to observable behavior: status code, returned error shape, unchanged database state, missing side effect, sanitized output, rejected job, or invariant preserved for all generated cases.
149
+ 24. Avoid dumping long exploit strings into the test. Use minimal representative inputs or generated values that prove the validation or boundary rule without becoming an offensive payload corpus.
150
+ 25. For command and filesystem boundaries, assert the denied side effect directly: no injected command appears in a runnable recommendation, no repository-local shim or Git helper is executed, no background shell pattern is counted runnable, no symlink target outside the root is read or written, and no Git tree or archive path writes outside the intended destination.
151
+ 26. For plan/apply, capability, invariant, time, and idempotency boundaries, assert the safety contract directly: planning produces no side effect, commit rejects stale or unauthorized capability, invalid transitions preserve state, injected time controls expiry, and repeated side-effect keys do not repeat the effect.
152
+ 27. For workflow scanner fixes, prefer repository-local assertions for durable contracts: action references are pinned to commit SHAs or digest-pinned containers, privileged permissions are job-scoped, fork pull requests do not receive secrets, deployment or scanner jobs can be manually rerun when useful, and dependency scans exclude fixture-only manifests unless intentionally included.
153
+ 28. For deployment and configuration fixes, prefer local config assertions: debug flags are off for production, sample credentials are absent, public admin or metrics endpoints are not enabled by default, storage is not public, containers do not run as root when the project controls that setting, and HTTPS requirements are preserved.
154
+ 29. For scanner-driven fixes, include a regression only when the rule reflects a durable project contract. Do not add brittle tests that merely assert the scanner's current wording, line number, or severity.
155
+ 30. If the project lacks enough context to write a deterministic test, output a concrete test proposal instead of inventing fixtures or behavior.
145
156
 
146
157
  <!-- mustflow-section: postconditions -->
147
158
  ## Postconditions
@@ -0,0 +1,186 @@
1
+ ---
2
+ mustflow_doc: skill.svelte-code-change
3
+ locale: en
4
+ canonical: true
5
+ revision: 2
6
+ lifecycle: mustflow-owned
7
+ authority: procedure
8
+ name: svelte-code-change
9
+ description: Apply this skill when Svelte or SvelteKit components, routes, load functions, server actions, endpoints, stores, context, runes, SSR boundaries, server-only imports, accessibility warnings, or tests are created or changed.
10
+ metadata:
11
+ mustflow_schema: "1"
12
+ mustflow_kind: procedure
13
+ pack_id: mustflow.core
14
+ skill_id: mustflow.core.svelte-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
+ # Svelte Code Change
27
+
28
+ <!-- mustflow-section: purpose -->
29
+ ## Purpose
30
+
31
+ Preserve Svelte component reactivity, SvelteKit SSR/server/client boundaries, data secrecy, load/action/endpoint contracts, request-scoped state ownership, accessibility, and generated route behavior. Choose files by data boundary first, not by filename habit.
32
+
33
+ <!-- mustflow-section: use-when -->
34
+ ## Use When
35
+
36
+ - `.svelte`, `+page`, `+layout`, `+page.server`, `+layout.server`, `+server`, load functions, form actions, endpoints, stores, context, runes, `$app` imports, `$lib/server`, hooks, route params, or Svelte tests change.
37
+ - The task touches state management, SSR errors, browser APIs, forms, routing, progressive enhancement, request-local data, server-only imports, private/public environment variables, or Svelte 5 runes.
38
+
39
+ <!-- mustflow-section: do-not-use-when -->
40
+ ## Do Not Use When
41
+
42
+ - The change is plain CSS or HTML with no Svelte or SvelteKit behavior; use the relevant UI foundation skill.
43
+ - The service code is framework-free and no Svelte boundary changes.
44
+
45
+ <!-- mustflow-section: required-inputs -->
46
+ ## Required Inputs
47
+
48
+ - Package metadata, Svelte config, Vite config, TypeScript config, route segment files, hooks, app types, stores/runes/context, form schema, and tests.
49
+ - Svelte version, route data source, secrecy, request scope, mutation type, serialization requirement, SSR/client boundary, browser dependency, and state owner.
50
+ - Imports from `$lib/server`, `*.server.*`, `$env/static/private`, `$env/dynamic/private`, DB/filesystem/server SDK modules, cookies, auth headers, and `event.locals`.
51
+ - Configured verification intents.
52
+
53
+ <!-- mustflow-section: preconditions -->
54
+ ## Preconditions
55
+
56
+ - For route work, read the sibling `+layout`, `+page`, `+page.server`, and `+server` files as one boundary.
57
+ - Classify every data access by origin, secrecy, request scope, mutation, browser dependency, and serialization before choosing a SvelteKit file.
58
+ - Treat all route files as potentially server-executed until proven otherwise.
59
+
60
+ <!-- mustflow-section: allowed-edits -->
61
+ ## Allowed Edits
62
+
63
+ - Keep secrets, private environment, database clients, and cookie-authenticated data in server-only files.
64
+ - Use browser APIs only behind client-safe lifecycle or environment guards.
65
+ - Keep state local unless shared ownership is justified.
66
+ - Preserve form actions and progressive enhancement instead of replacing all forms with client-only fetch.
67
+ - Use context for request-scoped component-tree sharing instead of module singletons.
68
+ - Use `$derived` for computed display values and `$effect` only for browser-side effects and cleanup.
69
+
70
+ <!-- mustflow-section: procedure -->
71
+ ## Procedure
72
+
73
+ 1. Read route segment files, parent layouts, stores/runes/context, hooks, app types, and tests.
74
+ 2. Identify Svelte version and whether the code uses runes or legacy reactivity.
75
+ 3. Before choosing a file, classify every data access with: origin, secrecy, request scope, mutation, browser dependency, and serialization.
76
+ 4. If data requires DB, filesystem, private env, cookies, auth headers, `event.locals`, server SDKs, or request-local identity, keep it in server-only code: `+page.server`, `+layout.server`, `+server`, `hooks.server`, or `$lib/server`.
77
+ 5. If data is public and can be safely fetched by the browser without secrets, universal load is allowed.
78
+ 6. If the operation is a page form mutation, prefer `+page.server` actions over a custom JSON endpoint.
79
+ 7. If the operation is a public HTTP API, webhook, mobile API, stream, file response, or non-page endpoint, use `+server`.
80
+ 8. If the value is UI-only state such as modal open, selected tab, draft input, accordion state, hover state, or local editing state, keep it in component `$state` or local context.
81
+ 9. If a value is computed from reactive inputs, use `$derived`. Do not use `$effect` to copy or synchronize derived state.
82
+ 10. Use `$effect`, lifecycle hooks, event handlers, actions, or dynamic imports for browser-only APIs and browser-only libraries. Do not touch `window`, `document`, `localStorage`, `matchMedia`, canvas, or browser-only imports in SSR top-level code.
83
+ 11. Keep request-specific user/session/auth state out of module-level mutable variables, global stores, exported `$state`, and load/action side effects.
84
+ 12. Do not write to stores from load functions.
85
+ 13. Keep server load return values intentionally serializable and minimal. Do not pass secrets, raw sessions, tokens, hidden DB fields, or whole service responses to the browser.
86
+ 14. Prefer `$app/state` over legacy `$app/stores` in SvelteKit projects that use the newer SvelteKit state API.
87
+ 15. Do not hide SSR errors by disabling SSR unless the user explicitly accepts that product and architecture change.
88
+ 16. Treat accessibility compiler warnings as real findings unless a local false-positive reason is documented.
89
+
90
+ <!-- mustflow-section: data-boundary-policy -->
91
+ ## Data Boundary Policy
92
+
93
+ - Public route params and public query values may live in universal load until they drive private DB/API access.
94
+ - Public external APIs and public CMS data may live in universal load only when the browser may call them directly without secrets.
95
+ - DB, filesystem, private env, server SDKs, cookies, auth headers, sessions, and `event.locals` belong in server-only files.
96
+ - User-specific data must be read server-side and narrowed before being serialized into `data`.
97
+ - Page forms should use form actions by default.
98
+ - External clients, webhooks, mobile apps, streaming responses, and custom HTTP responses belong in `+server`.
99
+ - Browser-only values belong in component effects, event handlers, dynamic imports, or browser actions.
100
+
101
+ <!-- mustflow-section: route-boundary-policy -->
102
+ ## Route Boundary Policy
103
+
104
+ - `+page.ts` and `+layout.ts` are universal. They may run on the server and in the browser.
105
+ - `+page.server.ts` and `+layout.server.ts` are for server-only page data.
106
+ - `+page.server.ts` actions are for page-owned form mutations.
107
+ - `+server.ts` is for HTTP endpoints, webhooks, non-page APIs, streams, files, and custom responses.
108
+ - Do not create a JSON endpoint for a normal page form unless there is a non-page consumer.
109
+ - Do not wrap server-only imports in browser guards. Fix the import graph.
110
+
111
+ <!-- mustflow-section: runes-state-policy -->
112
+ ## Runes And State Policy
113
+
114
+ - Use `$state` for local interactive UI state.
115
+ - Use `$derived` for calculations from props, route data, page state, or local state.
116
+ - Use `$effect` only for browser-side effects, subscriptions, DOM, canvas, analytics, third-party browser libraries, and cleanup.
117
+ - Use stores for external streams or manual subscribe/unsubscribe interop, not ordinary component state.
118
+ - Use context for parent-owned values shared down the component tree, especially request-scoped layout data.
119
+ - Do not reassign reactive context objects after placing them in context; update their properties or pass getter functions when needed.
120
+
121
+ <!-- mustflow-section: ssr-debug-policy -->
122
+ ## SSR Debug Policy
123
+
124
+ When SSR breaks, inspect in this order:
125
+
126
+ 1. Private env imports.
127
+ 2. `$lib/server`, `*.server.*`, DB, filesystem, admin SDK, or server-only import chains.
128
+ 3. Request-local state stored in module singletons, stores, or exported `$state`.
129
+ 4. Browser API access at module top-level or during SSR render.
130
+ 5. Hydration mismatch from time, randomness, locale, timezone, localStorage, or browser-only initial state.
131
+ 6. Route-level SSR disabling only after the product accepts an SPA-like shell.
132
+
133
+ <!-- mustflow-section: hard-bans -->
134
+ ## Hard Bans
135
+
136
+ - Do not add route-level SSR disabling to fix `window is not defined`.
137
+ - Do not move required first-render page data into lifecycle hooks or `$effect`.
138
+ - Do not import `$lib/server`, `*.server.*`, private env modules, DB clients, filesystem, or admin SDKs from universal/client route files or shared client utilities.
139
+ - Do not mutate module-scope variables, global stores, or exported `$state` with user/session/request data during SSR, load, or actions.
140
+ - Do not use `$effect` to compute derived values.
141
+ - Do not put browser-only library imports at top level when the package touches browser globals during import.
142
+ - Do not serialize secrets, raw sessions, access tokens, hidden DB fields, or whole service responses through load data.
143
+
144
+ <!-- mustflow-section: postconditions -->
145
+ ## Postconditions
146
+
147
+ - Server/client and SSR boundaries are explicit.
148
+ - State owner and derived/effect behavior are clear.
149
+ - Forms remain progressive unless intentionally changed.
150
+ - Private data stays server-only and serialized data is intentionally minimal.
151
+ - Request-scoped sharing uses load data, props, or context instead of module singletons.
152
+ - Accessibility warnings are resolved or justified.
153
+
154
+ <!-- mustflow-section: verification -->
155
+ ## Verification
156
+
157
+ Use configured oneshot command intents when available:
158
+
159
+ - `lint`
160
+ - `build`
161
+ - `test_related`
162
+ - `test`
163
+ - `docs_validate_fast`
164
+ - `mustflow_check`
165
+
166
+ Report missing Svelte check, SSR render, form action, or browser verification intents when relevant.
167
+
168
+ <!-- mustflow-section: failure-handling -->
169
+ ## Failure Handling
170
+
171
+ - If a browser API breaks SSR, move it to a client-safe boundary instead of disabling SSR by default.
172
+ - If data source ownership is unclear, inspect route server files and hooks before editing.
173
+ - If accessibility warnings require an ignore, include the specific reason in the code or report.
174
+ - If server-only imports leak into universal/client files, move the boundary instead of adding runtime guards.
175
+ - If request-local data is stored globally, move it to server load, actions, context, or persistent storage with user scoping.
176
+
177
+ <!-- mustflow-section: output-format -->
178
+ ## Output Format
179
+
180
+ - Boundary checked
181
+ - SSR/server/client and state notes
182
+ - Form/action/accessibility impact
183
+ - Files changed
184
+ - Command intents run
185
+ - Skipped checks and reasons
186
+ - Remaining Svelte risk
@@ -0,0 +1,164 @@
1
+ ---
2
+ mustflow_doc: skill.tailwind-code-change
3
+ locale: en
4
+ canonical: true
5
+ revision: 2
6
+ lifecycle: mustflow-owned
7
+ authority: procedure
8
+ name: tailwind-code-change
9
+ description: Apply this skill when Tailwind classes, className composition, static class detection, theme tokens, variants, safelists, arbitrary values, Tailwind config, @theme, @apply, or Tailwind migration surfaces are created or changed.
10
+ metadata:
11
+ mustflow_schema: "1"
12
+ mustflow_kind: procedure
13
+ pack_id: mustflow.core
14
+ skill_id: mustflow.core.tailwind-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
+ # Tailwind Code Change
27
+
28
+ <!-- mustflow-section: purpose -->
29
+ ## Purpose
30
+
31
+ Preserve Tailwind static class detection, design tokens, bounded variants, responsive/state behavior, accessibility states, and production build output. Treat Tailwind utilities as build-time tokens, not runtime strings.
32
+
33
+ <!-- mustflow-section: use-when -->
34
+ ## Use When
35
+
36
+ - Tailwind `class`, `className`, `@apply`, `@theme`, config, source scanning, safelist, theme tokens, variants, arbitrary values, or component class composition change.
37
+ - The task touches Tailwind v3/v4 migration, token addition, responsive modifiers, state modifiers, `clsx`/`cn`, CVA-style variant helpers, `@source`, or production CSS generation risk.
38
+ - Component APIs accept status, tone, intent, size, column count, color, spacing, or class-related props that affect Tailwind utilities.
39
+
40
+ <!-- mustflow-section: do-not-use-when -->
41
+ ## Do Not Use When
42
+
43
+ - Styling is plain CSS without Tailwind utilities; use `css-code-change`.
44
+ - Utility generation is UnoCSS, not Tailwind; use `unocss-code-change`.
45
+
46
+ <!-- mustflow-section: required-inputs -->
47
+ ## Required Inputs
48
+
49
+ - Tailwind version/config or CSS entry, content/source scanning rules, theme tokens, PostCSS/build config, class merge helpers, variant helpers, component patterns, and tests.
50
+ - Existing design system vocabulary, token naming conventions, accessibility state patterns, and component prop APIs.
51
+ - Any runtime source for visual values: props, CMS, database, tenant config, user input, API data, or external package markup.
52
+ - Configured verification intents.
53
+
54
+ <!-- mustflow-section: preconditions -->
55
+ ## Preconditions
56
+
57
+ - Confirm how Tailwind detects source classes before changing class composition.
58
+ - Identify whether the project is using Tailwind v3 config safelists or Tailwind v4 CSS source directives.
59
+ - Identify tokens, variant helpers, and semantic visual states before adding arbitrary values or raw colors.
60
+ - Confirm whether affected components are local one-offs, shared components, or public design-system surfaces.
61
+
62
+ <!-- mustflow-section: allowed-edits -->
63
+ ## Allowed Edits
64
+
65
+ - Use full static class strings that the build can detect.
66
+ - Use existing theme tokens before arbitrary values or raw colors.
67
+ - Use static maps, component extraction, or variant helpers for finite repeated variants.
68
+ - Use safelists only for finite class candidates that cannot appear in scanned source.
69
+ - Use inline styles plus CSS variables for unbounded runtime values such as tenant, database, or user-provided colors.
70
+ - Keep hover, focus-visible, disabled, aria/data, dark, and motion variants aligned with existing component behavior.
71
+
72
+ <!-- mustflow-section: procedure -->
73
+ ## Procedure
74
+
75
+ 1. Read Tailwind config or CSS entry, scanning rules, theme tokens, helpers, and nearby components.
76
+ 2. Classify the change: token, utility usage, dynamic variant, component extraction, responsive state, accessibility state, or migration.
77
+ 3. Treat every Tailwind class as a complete build-time token. Reject runtime interpolation, concatenation, array joins, or fragment assembly for utilities such as color, spacing, grid count, span, tone, or arbitrary values.
78
+ 4. For finite choices, use a static map with semantic keys and full class strings. Good keys describe UI meaning such as `danger`, `muted`, `compact`, or `featured`; bad keys store Tailwind fragments such as `red`, `600`, or `cols-3` for later assembly.
79
+ 5. Use a CVA-style variant helper only when a shared component has multiple variant axes, defaults, or compound variants. The helper must still contain full static class strings.
80
+ 6. Use safelists only as a last resort for finite candidates that cannot be present in source files. Tailwind v4 projects should express this through the project's CSS source policy; Tailwind v3 maintenance projects may use config safelists when that is the existing pattern. Do not safelist broad palettes or unbounded ranges to avoid fixing a bad component API.
81
+ 7. Use inline style plus a CSS variable bridge for unbounded runtime values from databases, APIs, tenants, CMS content, or user input. Do not try to mint Tailwind class names from unbounded values.
82
+ 8. Treat arbitrary values as escape hatches. Allow them for one-off asset alignment, complex grid templates, complex calculations, local CSS variable assignment, or values that cannot be expressed with regular utilities.
83
+ 9. Reject arbitrary raw colors in component markup, arbitrary spacing that approximates existing scale values, arbitrary container widths, arbitrary radius or shadow used as a hidden token, and repeated arbitrary values. Repeated values must be promoted to a semantic design token or component variant.
84
+ 10. Keep raw color literals in theme or token files only. Token names should describe purpose, not numeric value.
85
+ 11. Use `clsx` or `cn` only to combine complete class strings. Do not hide dynamic Tailwind string construction inside helper functions.
86
+ 12. Do not expose unrestricted class fragments through public component APIs. If a `className` passthrough exists, preserve internal layout-critical classes and prevent consumer props from becoming the source of required Tailwind generation.
87
+ 13. Do not extract a component only because a class list is long. Extract a component when structure, behavior, accessibility, and styling repeat together across files.
88
+ 14. Do not use `@apply` to hide long JSX or template class lists. Reserve `@apply` for third-party markup overrides, CSS-module boundaries, or template systems where component extraction is genuinely heavier.
89
+ 15. Use mobile-first responsive classes and include focus-visible or equivalent keyboard states for interactive elements.
90
+ 16. Check for conflicting utilities on one element, such as mutually exclusive display, spacing, text-size, or layout utilities.
91
+ 17. Choose configured verification intents that cover production build, lint, component tests, accessibility states, and visual risk when available.
92
+
93
+ <!-- mustflow-section: generation-policy -->
94
+ ## Generation Policy
95
+
96
+ - Tailwind classes must appear as complete static strings in scanned source, a static variant map, a CVA-style variant declaration, or an explicit finite safelist.
97
+ - Dynamic visual state must be represented by exactly one of: static map entry, variant helper entry, explicit safelist entry, or CSS variable bridge.
98
+ - Status, tone, intent, size, density, and column props are closed sets until proven otherwise. Model them as finite typed variants, not string fragments.
99
+ - Production CSS is the contract. If a class only exists after runtime string construction, assume production CSS may omit it.
100
+
101
+ <!-- mustflow-section: token-policy -->
102
+ ## Token Policy
103
+
104
+ - Use existing tokens and approved utilities first.
105
+ - Add a design token when a value repeats, has product meaning, appears in more than one component, supports theming, or has a designer-owned name.
106
+ - Do not add value-named tokens such as pixel-width or random-color names. Name tokens by role, surface, status, container, spacing purpose, or component meaning.
107
+ - Keep component markup free of raw hex, RGB, OKLCH, arbitrary color, and arbitrary shadow values unless the file is itself a token/theme definition.
108
+
109
+ <!-- mustflow-section: review-rejection-criteria -->
110
+ ## Review Rejection Criteria
111
+
112
+ Reject the change when:
113
+
114
+ - A Tailwind utility is assembled from runtime fragments.
115
+ - A raw color appears outside a token or theme file.
116
+ - An arbitrary value appears without a narrow reason.
117
+ - The same arbitrary value appears in more than one place.
118
+ - A wrapper component exists only to hide a one-off class list.
119
+ - `@apply` hides component-specific styling instead of handling a CSS boundary.
120
+ - A public component exposes unconstrained Tailwind class fragments.
121
+ - A safelist covers broad palettes, broad numeric ranges, or unknown runtime values.
122
+ - Conflicting utilities are present on the same element.
123
+
124
+ <!-- mustflow-section: postconditions -->
125
+ ## Postconditions
126
+
127
+ - All generated utilities are visible to Tailwind's detector, a static map, a variant helper, or an intentional finite safelist.
128
+ - Arbitrary values are rare, justified, and not repeated without token promotion.
129
+ - Runtime visual values are constrained by semantic variants or bridged through CSS variables.
130
+ - Interactive states include keyboard and disabled behavior where relevant.
131
+ - Production-build class loss risk is checked or reported.
132
+
133
+ <!-- mustflow-section: verification -->
134
+ ## Verification
135
+
136
+ Use configured oneshot command intents when available:
137
+
138
+ - `lint`
139
+ - `build`
140
+ - `test_related`
141
+ - `test`
142
+ - `docs_validate_fast`
143
+ - `mustflow_check`
144
+
145
+ Report missing production CSS or visual verification intents when relevant.
146
+
147
+ <!-- mustflow-section: failure-handling -->
148
+ ## Failure Handling
149
+
150
+ - If production styling disappears, inspect dynamic class generation and source scanning first.
151
+ - If arbitrary values accumulate, stop and consider whether the design token system is missing a token.
152
+ - If helper utilities erase class visibility, rewrite to static maps or report the build risk.
153
+ - If a component API requires arbitrary Tailwind fragments, narrow it to semantic variants or report the public API risk.
154
+
155
+ <!-- mustflow-section: output-format -->
156
+ ## Output Format
157
+
158
+ - Boundary checked
159
+ - Class detection and token notes
160
+ - Responsive and accessibility state notes
161
+ - Files changed
162
+ - Command intents run
163
+ - Skipped checks and reasons
164
+ - Remaining Tailwind risk