nuxt-skill-hub 0.0.1-beta.1

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.
@@ -0,0 +1,3 @@
1
+ export { default } from './module.mjs'
2
+
3
+ export { type ModuleOptions, type SkillHubContribution, type SkillHubContributionContext, type SkillHubTarget } from './module.mjs'
@@ -0,0 +1,74 @@
1
+ # Nuxt Best Practices
2
+
3
+ These notes improve execution quality for AI agents in this repository.
4
+ They complement Nuxt docs; they do not replace official documentation.
5
+
6
+ ## Source baseline
7
+ - Nuxt docs: `docs/3.guide/2.best-practices/*`, `docs/1.getting-started/10.data-fetching.md`, `docs/3.guide/4.modules/6.best-practices.md`
8
+ - Nuxt source: `packages/nuxt/src/app/composables/{asyncData,fetch,once}.ts`, `packages/nuxt/src/app/nuxt.ts`
9
+
10
+ ## How to use this file
11
+ 1. Start with the smallest high-priority pack that matches the actual surface or symptom.
12
+ 2. Apply rule IDs directly; do not paraphrase away Nuxt-specific caveats.
13
+ 3. Treat the first six packs as disambiguation overlays before broader infra packs.
14
+ 4. Keep scope narrow: open only the sections needed for the current change.
15
+ 5. Nuxt guidance is default; module guidance overrides it only inside explicit module scope.
16
+
17
+ ## Rule Packs by Priority
18
+
19
+ | Priority | Pack | Focus | Rule ID Prefix |
20
+ | --- | --- | --- | --- |
21
+ | 1 | Abstraction Disambiguation | Choose framework-owned primitives before generic Vue or raw HTML | `disambiguation-` |
22
+ | 2 | Page Meta, Head, and Layout | Separate page behavior, document metadata, and layout structure | `page-` |
23
+ | 3 | Error Surfaces and Recovery | Cover both global and local error surfaces with the right recovery utilities | `error-` |
24
+ | 4 | Verification and Finish | Re-check paired surfaces and verify framework behavior before concluding | `verify-` |
25
+ | 5 | Data Fetching and SSR | Deduplication, payload correctness, and request safety | `data-` |
26
+ | 6 | Hydration and SSR Consistency | SSR and CSR determinism and client-only boundaries | `hydration-` |
27
+ | 7 | Architecture Boundaries | Server-only secrets and request-safe state | `arch-` |
28
+ | 8 | Server Routes and Runtime Config | Handler contracts and config exposure | `server-` |
29
+ | 9 | Nitro and h3 Server Patterns | Request contracts, caching behavior, and edge-safe server work | `nitro-` |
30
+ | 10 | Plugins and Runtime Boot | Plugin startup cost, ordering, and isolation | `plugin-` |
31
+ | 11 | Performance and Rendering | Rendering strategy, links, payload, and asset cost | `perf-` |
32
+ | 12 | Module Authoring Conventions | Nuxt Kit module safety and ecosystem fit | `module-` |
33
+ | 13 | Migrations and Compatibility | Safe incremental upgrades | `migration-` |
34
+
35
+ ## Rule Packs
36
+
37
+ <!-- automd:file src="./rules/abstraction-disambiguation.md" -->
38
+ <!-- /automd -->
39
+
40
+ <!-- automd:file src="./rules/page-meta-head-layout.md" -->
41
+ <!-- /automd -->
42
+
43
+ <!-- automd:file src="./rules/error-surfaces-recovery.md" -->
44
+ <!-- /automd -->
45
+
46
+ <!-- automd:file src="./rules/verification-finish.md" -->
47
+ <!-- /automd -->
48
+
49
+ <!-- automd:file src="./rules/data-fetching-ssr.md" -->
50
+ <!-- /automd -->
51
+
52
+ <!-- automd:file src="./rules/hydration-consistency.md" -->
53
+ <!-- /automd -->
54
+
55
+ <!-- automd:file src="./rules/architecture-boundaries.md" -->
56
+ <!-- /automd -->
57
+
58
+ <!-- automd:file src="./rules/server-routes-runtime-config.md" -->
59
+ <!-- /automd -->
60
+
61
+ <!-- automd:file src="./rules/nitro-h3-patterns.md" -->
62
+ <!-- /automd -->
63
+
64
+ <!-- automd:file src="./rules/plugins.md" -->
65
+ <!-- /automd -->
66
+
67
+ <!-- automd:file src="./rules/performance-rendering.md" -->
68
+ <!-- /automd -->
69
+
70
+ <!-- automd:file src="./rules/module-authoring.md" -->
71
+ <!-- /automd -->
72
+
73
+ <!-- automd:file src="./rules/migrations.md" -->
74
+ <!-- /automd -->
@@ -0,0 +1,58 @@
1
+ ## Abstraction Disambiguation
2
+
3
+ ### Rule ID: `disambiguation-framework-primitives-first`
4
+ ### Rule: Prefer framework-owned primitives before generic Vue or raw HTML
5
+ ### When to apply
6
+ Any fix where generic Vue code, hand-rolled HTML, or custom event wiring looks plausible.
7
+
8
+ ### Wrong pattern
9
+ Solving a Nuxt problem with ad hoc watchers, raw fetches, or custom markup when Nuxt, Nuxt Content, or Nuxt UI already owns the surface.
10
+
11
+ ### Recommended pattern
12
+ Identify the framework-owned abstraction first, then use generic Vue primitives only when the framework does not provide a suitable surface.
13
+
14
+ ### Nuxt-specific caveat
15
+ Visually correct custom code can still be the wrong answer if it bypasses a Nuxt-native abstraction that hidden evals or framework conventions expect.
16
+
17
+ ### Execution checklist
18
+ - [ ] Inputs to inspect: the exact surface being edited and whether Nuxt, Nuxt Content, or Nuxt UI already provides a first-class primitive.
19
+ - [ ] Minimal verification: the final solution uses the framework abstraction when one exists.
20
+ - [ ] Stop condition: the task explicitly requires behavior outside the owned abstraction.
21
+
22
+ ### Rule ID: `disambiguation-nearby-concepts-before-editing`
23
+ ### Rule: Resolve nearby concept pairs before changing code
24
+ ### When to apply
25
+ Tasks that could map to two similar Nuxt concepts.
26
+
27
+ ### Wrong pattern
28
+ Editing the first plausible API without deciding the actual concept pair first.
29
+
30
+ ### Recommended pattern
31
+ Explicitly decide the concept pair before editing, such as `definePageMeta` vs `useHead`, data collection vs page collection, `NuxtLink` vs raw `<a>`, or `useCookie` vs `document.cookie`.
32
+
33
+ ### Nuxt-specific caveat
34
+ Many strong agents fail Nuxt tasks by choosing the wrong nearby abstraction rather than by writing broken code.
35
+
36
+ ### Execution checklist
37
+ - [ ] Inputs to inspect: prompt symptoms, file location, and framework-owned surface.
38
+ - [ ] Minimal verification: the chosen abstraction matches the actual responsibility of the change.
39
+ - [ ] Stop condition: both concepts are intentionally involved and clearly separated.
40
+
41
+ ### Rule ID: `disambiguation-do-not-stop-at-visually-correct`
42
+ ### Rule: Do not accept a visually correct result as sufficient
43
+ ### When to apply
44
+ UI, docs, or content tasks where a hand-built implementation can look correct.
45
+
46
+ ### Wrong pattern
47
+ Declaring success because the output looks fine while bypassing Nuxt UI, Content, or SSR-aware primitives.
48
+
49
+ ### Recommended pattern
50
+ Check whether the implementation is framework-correct, not only visually correct.
51
+
52
+ ### Nuxt-specific caveat
53
+ Nuxt evals often reject custom HTML solutions even when they render acceptably, because the intended abstraction was a framework primitive.
54
+
55
+ ### Execution checklist
56
+ - [ ] Inputs to inspect: component usage, slot API, and data source wiring.
57
+ - [ ] Minimal verification: the implementation matches the expected framework primitive and API shape.
58
+ - [ ] Stop condition: the prompt explicitly asks for custom markup or behavior the primitive cannot support.
@@ -0,0 +1,58 @@
1
+ ## Architecture Boundaries
2
+
3
+ ### Rule ID: `arch-secrets-server-only`
4
+ ### Rule: Keep secrets and request checks server-side
5
+ ### When to apply
6
+ Implementing auth, secret-bearing API calls, or per-request business logic.
7
+
8
+ ### Wrong pattern
9
+ Placing secret usage in shared composables imported by client code.
10
+
11
+ ### Recommended pattern
12
+ Move sensitive logic to `server/api/*` handlers, server utilities, or server plugins.
13
+
14
+ ### Nuxt-specific caveat
15
+ Anything in `runtimeConfig.public` is client-visible.
16
+
17
+ ### Execution checklist
18
+ - [ ] Inputs to inspect: changed files in `server/`, `composables/`, and `runtimeConfig` usage.
19
+ - [ ] Minimal verification: no secret values or token checks in client bundles.
20
+ - [ ] Stop condition: a required server-only check cannot be moved out of client code.
21
+
22
+ ### Rule ID: `arch-request-safe-state`
23
+ ### Rule: Use request-safe state boundaries
24
+ ### When to apply
25
+ Adding reusable cross-page logic with state.
26
+
27
+ ### Wrong pattern
28
+ Using mutable module-level singletons for request-scoped state.
29
+
30
+ ### Recommended pattern
31
+ Use `useState`/composables for shared state and pass request context explicitly where needed.
32
+
33
+ ### Nuxt-specific caveat
34
+ SSR runs per request; module globals can leak state across requests.
35
+
36
+ ### Execution checklist
37
+ - [ ] Inputs to inspect: shared state in module scope and composable state factories.
38
+ - [ ] Minimal verification: request-specific data is not shared globally.
39
+ - [ ] Stop condition: solution depends on mutable globals without explicit isolation.
40
+
41
+ ### Rule ID: `arch-server-entrypoint-for-sensitive-io`
42
+ ### Rule: Keep sensitive I/O behind server entrypoints
43
+ ### When to apply
44
+ Calling third-party APIs, databases, or internal services with credentials.
45
+
46
+ ### Wrong pattern
47
+ Making direct browser fetches to privileged upstream services with forwarded sensitive headers.
48
+
49
+ ### Recommended pattern
50
+ Expose a constrained `server/api/*` boundary and call it from client/UI code.
51
+
52
+ ### Nuxt-specific caveat
53
+ `useFetch('/api/*')` on server uses request-aware fetch behavior; external APIs require explicit header allowlisting.
54
+
55
+ ### Execution checklist
56
+ - [ ] Inputs to inspect: upstream fetch targets, header forwarding, and token placement.
57
+ - [ ] Minimal verification: browser code only talks to safe internal endpoints.
58
+ - [ ] Stop condition: architecture requires direct client access to privileged credentials.
@@ -0,0 +1,58 @@
1
+ ## Content Modeling and Navigation
2
+
3
+ ### Rule ID: `content-data-collections-for-structured-records`
4
+ ### Rule: Use data collections for structured JSON or YAML records
5
+ ### When to apply
6
+ Working with structured records that are not authored as full content pages.
7
+
8
+ ### Wrong pattern
9
+ Treating JSON or YAML records as page content just because they live in the content tree.
10
+
11
+ ### Recommended pattern
12
+ Model structured records as Nuxt Content data collections when they represent data rather than pages.
13
+
14
+ ### Nuxt-specific caveat
15
+ The right collection type changes the query surface and avoids page-oriented assumptions in navigation and rendering.
16
+
17
+ ### Execution checklist
18
+ - [ ] Inputs to inspect: file formats, collection config, and whether entries represent records or renderable pages.
19
+ - [ ] Minimal verification: collection type matches the underlying content model.
20
+ - [ ] Stop condition: the data is intentionally authored and rendered as page content.
21
+
22
+ ### Rule ID: `content-navigation-from-collections`
23
+ ### Rule: Use collection navigation primitives for generated docs navigation
24
+ ### When to apply
25
+ Building sidebars, section navigation, or docs trees from content.
26
+
27
+ ### Wrong pattern
28
+ Manually assembling navigation trees when the collection model can generate them.
29
+
30
+ ### Recommended pattern
31
+ Use collection-navigation helpers such as `queryCollectionNavigation` before writing custom navigation assembly.
32
+
33
+ ### Nuxt-specific caveat
34
+ Manual sidebar assembly is a repeated failure mode when Nuxt Content already has a first-class navigation primitive.
35
+
36
+ ### Execution checklist
37
+ - [ ] Inputs to inspect: navigation source, collection schema, and current sidebar code.
38
+ - [ ] Minimal verification: the navigation derives from collection primitives instead of custom tree-building.
39
+ - [ ] Stop condition: the navigation behavior cannot be represented with collection helpers.
40
+
41
+ ### Rule ID: `content-model-before-rendering`
42
+ ### Rule: Finalize content modeling before choosing rendering primitives
43
+ ### When to apply
44
+ Tasks that mix collection setup, querying, and rendering.
45
+
46
+ ### Wrong pattern
47
+ Choosing the rendering component or sidebar implementation before deciding the collection model.
48
+
49
+ ### Recommended pattern
50
+ Lock the collection type and query surface first, then render from that model.
51
+
52
+ ### Nuxt-specific caveat
53
+ Many content bugs come from modeling mistakes that are then hidden under custom rendering code.
54
+
55
+ ### Execution checklist
56
+ - [ ] Inputs to inspect: collection config, query usage, and rendering components.
57
+ - [ ] Minimal verification: the rendering code follows the collection model rather than compensating for a wrong model.
58
+ - [ ] Stop condition: the collection model is already fixed and correct.
@@ -0,0 +1,115 @@
1
+ ## Data Fetching and SSR
2
+
3
+ ### Rule ID: `data-usefetch-or-asyncdata-for-initial`
4
+ ### Rule: Use `useFetch`/`useAsyncData` for initial render data
5
+ ### When to apply
6
+ Building SSR pages or route-level data loading.
7
+
8
+ ### Wrong pattern
9
+ Using `$fetch` directly in setup for initial render data, causing SSR+CSR duplicate requests.
10
+
11
+ ### Recommended pattern
12
+ Use `useFetch` for HTTP-first fetching and `useAsyncData` for custom async logic or multi-request composition.
13
+
14
+ ### Nuxt-specific caveat
15
+ `$fetch` is ideal for event-driven interactions; initial view data should normally be payload-backed via `useFetch`/`useAsyncData`.
16
+
17
+ ### Execution checklist
18
+ - [ ] Inputs to inspect: setup-time `$fetch` usage and async data composable usage.
19
+ - [ ] Minimal verification: initial render data is transferred via Nuxt payload, without extra hydration fetch.
20
+ - [ ] Stop condition: call is explicitly client-only and non-SEO-critical.
21
+
22
+ ### Rule ID: `data-stable-keys-and-option-consistency`
23
+ ### Rule: Keep async-data keys explicit and option-consistent
24
+ ### When to apply
25
+ Sharing `useAsyncData` or `useFetch` state across components/composables.
26
+
27
+ ### Wrong pattern
28
+ Relying on autogenerated keys in wrappers or using same key with conflicting `transform`/`pick`/`deep` behavior.
29
+
30
+ ### Recommended pattern
31
+ Use explicit stable keys and keep key-sharing options consistent.
32
+
33
+ ### Nuxt-specific caveat
34
+ Nuxt warns on incompatible shared-key options and can produce confusing state reuse if keys are unstable.
35
+
36
+ ### Execution checklist
37
+ - [ ] Inputs to inspect: key construction and repeated composable calls.
38
+ - [ ] Minimal verification: no key collisions; shared-key options match.
39
+ - [ ] Stop condition: scope truly requires isolated state per call site.
40
+
41
+ ### Rule ID: `data-side-effects-via-callonce`
42
+ ### Rule: Keep `useAsyncData` handlers side-effect free
43
+ ### When to apply
44
+ Data loaders that also trigger analytics, store mutations, or one-time bootstrapping.
45
+
46
+ ### Wrong pattern
47
+ Running side effects inside the `useAsyncData` handler.
48
+
49
+ ### Recommended pattern
50
+ Return data only from handler; move side effects to `callOnce` or explicit event handlers.
51
+
52
+ ### Nuxt-specific caveat
53
+ `useAsyncData` re-execution paths (`watch`, refresh, navigation) can replay embedded side effects.
54
+
55
+ ### Execution checklist
56
+ - [ ] Inputs to inspect: handler body for side effects, store writes, and non-idempotent calls.
57
+ - [ ] Minimal verification: handler remains pure relative to its inputs.
58
+ - [ ] Stop condition: third-party API requires coupled side effects and cannot be decoupled.
59
+
60
+ ### Rule ID: `data-reactive-url-not-watch-only`
61
+ ### Rule: Use reactive URL/options, not `watch` alone, for parameterized fetches
62
+ ### When to apply
63
+ Fetching data from reactive route params, filters, or query inputs.
64
+
65
+ ### Wrong pattern
66
+ Passing a static URL string and expecting `watch: [id]` to change endpoint automatically.
67
+
68
+ ### Recommended pattern
69
+ Use computed URL or reactive fetch options (`query`, `params`) and opt out with `watch: false` only intentionally.
70
+
71
+ ### Nuxt-specific caveat
72
+ Reactive fetch options are watched by default; computed URL updates are first-class.
73
+
74
+ ### Execution checklist
75
+ - [ ] Inputs to inspect: URL construction, watch config, and query/params refs.
76
+ - [ ] Minimal verification: endpoint and data refresh when reactive dependencies change.
77
+ - [ ] Stop condition: endpoint must remain static while auxiliary state changes.
78
+
79
+ ### Rule ID: `data-minimize-payload-shape`
80
+ ### Rule: Minimize payload transfer for SSR data
81
+ ### When to apply
82
+ Fetching large objects/arrays where only a subset is needed for initial render.
83
+
84
+ ### Wrong pattern
85
+ Transferring full backend payload to client when template uses a few fields.
86
+
87
+ ### Recommended pattern
88
+ Use `pick`/`transform` for payload shaping and split non-critical data into lazy client-only fetches when appropriate.
89
+
90
+ ### Nuxt-specific caveat
91
+ `pick`/`transform` reduce payload transfer size, not upstream API response size.
92
+
93
+ ### Execution checklist
94
+ - [ ] Inputs to inspect: fetched object shape vs template usage.
95
+ - [ ] Minimal verification: payload contains only needed fields for first paint.
96
+ - [ ] Stop condition: downstream consumers rely on full object in the same render boundary.
97
+
98
+ ### Rule ID: `data-serialization-boundary-awareness`
99
+ ### Rule: Respect serialization differences between payload and API routes
100
+ ### When to apply
101
+ Returning non-primitive values (Date, Map, Set, custom classes) through SSR data and server API routes.
102
+
103
+ ### Wrong pattern
104
+ Assuming all Nuxt data transfer paths serialize complex types identically.
105
+
106
+ ### Recommended pattern
107
+ Treat `useAsyncData` payload serialization and server-route JSON serialization as distinct boundaries; normalize API outputs (or custom `toJSON`) when needed.
108
+
109
+ ### Nuxt-specific caveat
110
+ Nuxt payload transfer uses `devalue`, while server route responses are serialized via JSON behavior, which has stricter type limits.
111
+
112
+ ### Execution checklist
113
+ - [ ] Inputs to inspect: returned types across `useAsyncData` handlers and `server/api/*` responses.
114
+ - [ ] Minimal verification: client receives expected shape/types on both transport paths.
115
+ - [ ] Stop condition: upstream contract mandates non-serializable runtime-only values.
@@ -0,0 +1,39 @@
1
+ ## Error Surfaces and Recovery
2
+
3
+ ### Rule ID: `error-check-global-and-local-surfaces`
4
+ ### Rule: Check both global and local error surfaces
5
+ ### When to apply
6
+ Handling runtime errors, route failures, or fallback UI in Nuxt.
7
+
8
+ ### Wrong pattern
9
+ Fixing only `app/error.vue` or only a local `NuxtErrorBoundary` when the flow requires both.
10
+
11
+ ### Recommended pattern
12
+ Identify whether the issue needs a global error surface, a local boundary, or both, then implement both surfaces explicitly when required.
13
+
14
+ ### Nuxt-specific caveat
15
+ Nuxt error handling is often multi-surface; solving only half the pattern is a recurring failure mode in strong models.
16
+
17
+ ### Execution checklist
18
+ - [ ] Inputs to inspect: where the error originates and whether recovery is route-wide or local to a subtree.
19
+ - [ ] Minimal verification: the intended error surface actually receives and renders the failure.
20
+ - [ ] Stop condition: the issue is intentionally scoped to one surface only.
21
+
22
+ ### Rule ID: `error-use-nuxt-recovery-utilities`
23
+ ### Rule: Use Nuxt recovery helpers instead of ad hoc reset logic
24
+ ### When to apply
25
+ Recovering from an error state or clearing error UI.
26
+
27
+ ### Wrong pattern
28
+ Resetting local refs or forcing navigation without using Nuxt recovery utilities.
29
+
30
+ ### Recommended pattern
31
+ Use Nuxt error helpers such as `clearError`, `showError`, and framework-supported retry paths.
32
+
33
+ ### Nuxt-specific caveat
34
+ Custom reset logic can leave the app in an inconsistent state if it bypasses Nuxt's error lifecycle.
35
+
36
+ ### Execution checklist
37
+ - [ ] Inputs to inspect: current error state flow and whether Nuxt helpers are already present.
38
+ - [ ] Minimal verification: recovery clears the error surface and restores intended navigation or rendering behavior.
39
+ - [ ] Stop condition: the task explicitly requires a non-standard recovery path.
@@ -0,0 +1,58 @@
1
+ ## Hydration and SSR Consistency
2
+
3
+ ### Rule ID: `hydration-no-browser-apis-in-ssr-path`
4
+ ### Rule: Keep browser-only APIs out of SSR execution paths
5
+ ### When to apply
6
+ Reading storage, window size, document state, or navigator data in setup/render paths.
7
+
8
+ ### Wrong pattern
9
+ Accessing `window`, `document`, or `localStorage` during server render.
10
+
11
+ ### Recommended pattern
12
+ Use SSR-safe primitives (`useCookie`, server data, request headers) or gate browser-only logic in `ClientOnly`/`onMounted`.
13
+
14
+ ### Nuxt-specific caveat
15
+ Hydration mismatch can force full subtree re-render and break event binding assumptions.
16
+
17
+ ### Execution checklist
18
+ - [ ] Inputs to inspect: setup code for browser globals and conditional rendering paths.
19
+ - [ ] Minimal verification: first SSR HTML and first client render produce matching structure/content.
20
+ - [ ] Stop condition: third-party dependency cannot run without browser APIs before mount.
21
+
22
+ ### Rule ID: `hydration-deterministic-first-render`
23
+ ### Rule: Make first render deterministic across server and client
24
+ ### When to apply
25
+ Rendering dynamic values such as timestamps, randomness, or locale-sensitive formatting.
26
+
27
+ ### Wrong pattern
28
+ Using `Math.random()`, `new Date()`, or environment-specific formatting directly in template/setup for first paint.
29
+
30
+ ### Recommended pattern
31
+ Seed shared state with `useState`, use `NuxtTime`, or defer non-deterministic values until after mount.
32
+
33
+ ### Nuxt-specific caveat
34
+ Time/randomness differences between SSR and CSR are a common hydration mismatch cause.
35
+
36
+ ### Execution checklist
37
+ - [ ] Inputs to inspect: first-render values derived from time/random/browser environment.
38
+ - [ ] Minimal verification: page hydrates without mismatch warnings.
39
+ - [ ] Stop condition: feature explicitly requires client-personalized first paint with acceptable fallback.
40
+
41
+ ### Rule ID: `hydration-client-only-libraries-after-mount`
42
+ ### Rule: Initialize DOM-mutating third-party libraries after hydration
43
+ ### When to apply
44
+ Integrating analytics, tag managers, embeds, or widgets that touch DOM directly.
45
+
46
+ ### Wrong pattern
47
+ Running library initialization in universal setup path.
48
+
49
+ ### Recommended pattern
50
+ Load/init libraries in `onMounted` or dedicated client plugins and provide SSR-safe fallback markup.
51
+
52
+ ### Nuxt-specific caveat
53
+ `import.meta.client` guards code path, but DOM writes before hydration completion can still create mismatch risk.
54
+
55
+ ### Execution checklist
56
+ - [ ] Inputs to inspect: library init location and DOM mutation timing.
57
+ - [ ] Minimal verification: no hydration warnings and no visible layout flash from re-render.
58
+ - [ ] Stop condition: library requires synchronous pre-hydration bootstrap with no fallback option.
@@ -0,0 +1,58 @@
1
+ ## Migrations and Compatibility
2
+
3
+ ### Rule ID: `migration-reversible-slices`
4
+ ### Rule: Perform migrations in reversible slices
5
+ ### When to apply
6
+ Nuxt, Nitro, h3, or module major/minor upgrades.
7
+
8
+ ### Wrong pattern
9
+ Large unscoped migration commits with no rollback checkpoints.
10
+
11
+ ### Recommended pattern
12
+ Split migration into small steps with explicit validation after each step.
13
+
14
+ ### Nuxt-specific caveat
15
+ Validate both SSR render path and client hydration path.
16
+
17
+ ### Execution checklist
18
+ - [ ] Inputs to inspect: changed APIs, config keys, and migration commit boundaries.
19
+ - [ ] Minimal verification: each slice can be reverted independently.
20
+ - [ ] Stop condition: migration cannot be tested incrementally.
21
+
22
+ ### Rule ID: `migration-upgrade-touched-deprecations`
23
+ ### Rule: Remove deprecated APIs in touched areas
24
+ ### When to apply
25
+ Editing files already using deprecated Nuxt/Nitro/h3 patterns.
26
+
27
+ ### Wrong pattern
28
+ Keeping mixed old/new patterns in the same touched code path.
29
+
30
+ ### Recommended pattern
31
+ Upgrade touched deprecated usage while context is active.
32
+
33
+ ### Nuxt-specific caveat
34
+ Prefer official migration mappings over ad-hoc replacements.
35
+
36
+ ### Execution checklist
37
+ - [ ] Inputs to inspect: touched deprecated symbols and replacement mapping.
38
+ - [ ] Minimal verification: no deprecated usage remains in modified files.
39
+ - [ ] Stop condition: required replacement API is not yet stable in target version.
40
+
41
+ ### Rule ID: `migration-verify-ssr-and-hydration`
42
+ ### Rule: Verify both server render and hydration behavior after each slice
43
+ ### When to apply
44
+ Any migration touching rendering, data fetching, plugins, or runtime config.
45
+
46
+ ### Wrong pattern
47
+ Validating only build success without browser hydration and runtime checks.
48
+
49
+ ### Recommended pattern
50
+ Validate SSR output, hydration warnings, critical data paths, and route navigation on each migration slice.
51
+
52
+ ### Nuxt-specific caveat
53
+ Nuxt migrations can pass type checks while still regressing payload transfer or hydration behavior.
54
+
55
+ ### Execution checklist
56
+ - [ ] Inputs to inspect: browser console hydration warnings, route transitions, and async-data behavior.
57
+ - [ ] Minimal verification: no hydration mismatch warnings and no duplicate initial fetch regressions.
58
+ - [ ] Stop condition: environment lacks a runnable app context for runtime verification.
@@ -0,0 +1,77 @@
1
+ ## Module Authoring Conventions
2
+
3
+ ### Rule ID: `module-keep-setup-fast-and-defer-heavy-work`
4
+ ### Rule: Keep module setup fast and defer heavy work
5
+ ### When to apply
6
+ Authoring or updating a Nuxt module with runtime behavior.
7
+
8
+ ### Wrong pattern
9
+ Performing expensive async work directly in module `setup`.
10
+
11
+ ### Recommended pattern
12
+ Keep `setup` lightweight and defer heavier tasks to lifecycle hooks or deferred build/runtime hooks.
13
+
14
+ ### Nuxt-specific caveat
15
+ Nuxt warns when module setup takes too long; slow setup delays dev server and build startup.
16
+
17
+ ### Execution checklist
18
+ - [ ] Inputs to inspect: `defineNuxtModule` setup body and async operations.
19
+ - [ ] Minimal verification: startup-critical path avoids long blocking work.
20
+ - [ ] Stop condition: required initialization must complete before app/module lifecycle proceeds.
21
+
22
+ ### Rule ID: `module-prefix-public-exports`
23
+ ### Rule: Prefix public exports and routes
24
+ ### When to apply
25
+ Adding module composables, components, plugins, or server routes.
26
+
27
+ ### Wrong pattern
28
+ Publishing generic names like `useData`, `<Button>`, or `/api/auth` from a module.
29
+
30
+ ### Recommended pattern
31
+ Prefix public surface with module identity (`useFooData`, `<FooButton>`, `/api/_foo/*`).
32
+
33
+ ### Nuxt-specific caveat
34
+ Unprefixed module routes/components collide easily with app code and other modules.
35
+
36
+ ### Execution checklist
37
+ - [ ] Inputs to inspect: names of components/composables/runtime API routes.
38
+ - [ ] Minimal verification: exported names are collision-resistant and module-scoped.
39
+ - [ ] Stop condition: backward compatibility policy requires legacy unprefixed aliases.
40
+
41
+ ### Rule ID: `module-public-kit-apis-only`
42
+ ### Rule: Prefer documented Nuxt Kit APIs over internals
43
+ ### When to apply
44
+ Implementing Nuxt module behavior and code generation logic.
45
+
46
+ ### Wrong pattern
47
+ Relying on private Nuxt internals or undocumented hooks.
48
+
49
+ ### Recommended pattern
50
+ Use stable `@nuxt/kit` APIs, documented hooks, and declared compatibility constraints.
51
+
52
+ ### Nuxt-specific caveat
53
+ Private internals can break across minor/patch updates even when compatibility appears broad.
54
+
55
+ ### Execution checklist
56
+ - [ ] Inputs to inspect: imported kit functions/hooks and internal path imports.
57
+ - [ ] Minimal verification: implementation uses public Nuxt APIs with explicit compatibility.
58
+ - [ ] Stop condition: required behavior has no documented public API yet.
59
+
60
+ ### Rule ID: `module-skill-scope-only`
61
+ ### Rule: Scope module skills to module APIs only
62
+ ### When to apply
63
+ Publishing `agents.skills` with a module.
64
+
65
+ ### Wrong pattern
66
+ Embedding global Nuxt framework guidance inside module-specific skill docs.
67
+
68
+ ### Recommended pattern
69
+ Document only module APIs, integration points, and module-specific caveats.
70
+
71
+ ### Nuxt-specific caveat
72
+ Module guidance can override Nuxt guidance only inside that module's explicit scope.
73
+
74
+ ### Execution checklist
75
+ - [ ] Inputs to inspect: skill frontmatter, rule language, examples.
76
+ - [ ] Minimal verification: instructions are module-scoped and version-aligned.
77
+ - [ ] Stop condition: module skill introduces global rules unrelated to module behavior.