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.
- package/README.md +31 -0
- package/dist/module.d.mts +41 -0
- package/dist/module.json +12 -0
- package/dist/module.mjs +1912 -0
- package/dist/types.d.mts +3 -0
- package/nuxt-best-practices/index.template.md +74 -0
- package/nuxt-best-practices/rules/abstraction-disambiguation.md +58 -0
- package/nuxt-best-practices/rules/architecture-boundaries.md +58 -0
- package/nuxt-best-practices/rules/content-modeling-navigation.md +58 -0
- package/nuxt-best-practices/rules/data-fetching-ssr.md +115 -0
- package/nuxt-best-practices/rules/error-surfaces-recovery.md +39 -0
- package/nuxt-best-practices/rules/hydration-consistency.md +58 -0
- package/nuxt-best-practices/rules/migrations.md +58 -0
- package/nuxt-best-practices/rules/module-authoring.md +77 -0
- package/nuxt-best-practices/rules/nitro-h3-patterns.md +96 -0
- package/nuxt-best-practices/rules/nuxt-ui-primitives.md +58 -0
- package/nuxt-best-practices/rules/page-meta-head-layout.md +58 -0
- package/nuxt-best-practices/rules/performance-rendering.md +77 -0
- package/nuxt-best-practices/rules/plugins.md +58 -0
- package/nuxt-best-practices/rules/server-routes-runtime-config.md +58 -0
- package/nuxt-best-practices/rules/verification-finish.md +58 -0
- package/package.json +64 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
## Nitro and h3 Server Patterns
|
|
2
|
+
|
|
3
|
+
### Rule ID: `nitro-validated-input-helpers`
|
|
4
|
+
### Rule: Use h3 validated helpers for route params, query, and body
|
|
5
|
+
### When to apply
|
|
6
|
+
Creating or refactoring `server/api/*` handlers with external input.
|
|
7
|
+
|
|
8
|
+
### Wrong pattern
|
|
9
|
+
Casting `event.context.params`, `getQuery(event)`, or `readBody(event)` to trusted shapes without validation.
|
|
10
|
+
|
|
11
|
+
### Recommended pattern
|
|
12
|
+
Use `getValidatedRouterParams`, `getValidatedQuery`, and `readValidatedBody` (for example with Zod parsers) at handler boundaries.
|
|
13
|
+
|
|
14
|
+
### Nuxt-specific caveat
|
|
15
|
+
Nuxt server routes run on h3; validated helpers provide both runtime safety and stronger type flow than ad-hoc casting.
|
|
16
|
+
|
|
17
|
+
### Execution checklist
|
|
18
|
+
- [ ] Inputs to inspect: all untrusted handler inputs (params/query/body).
|
|
19
|
+
- [ ] Minimal verification: invalid inputs return explicit client-safe errors.
|
|
20
|
+
- [ ] Stop condition: accepted schema/validator is not available in project constraints.
|
|
21
|
+
|
|
22
|
+
### Rule ID: `nitro-waituntil-for-nonblocking-work`
|
|
23
|
+
### Rule: Move non-critical async side work to `event.waitUntil`
|
|
24
|
+
### When to apply
|
|
25
|
+
Logging, cache warmup, or analytics in server handlers that should not delay response.
|
|
26
|
+
|
|
27
|
+
### Wrong pattern
|
|
28
|
+
Awaiting non-essential async jobs before sending response.
|
|
29
|
+
|
|
30
|
+
### Recommended pattern
|
|
31
|
+
Return response early and schedule non-critical work with `event.waitUntil(...)`.
|
|
32
|
+
|
|
33
|
+
### Nuxt-specific caveat
|
|
34
|
+
`event.waitUntil` integrates with runtime providers to finish background work after response, including edge-like runtimes.
|
|
35
|
+
|
|
36
|
+
### Execution checklist
|
|
37
|
+
- [ ] Inputs to inspect: awaited tasks in request critical path.
|
|
38
|
+
- [ ] Minimal verification: response path no longer blocks on non-critical work.
|
|
39
|
+
- [ ] Stop condition: task result is required to compute response.
|
|
40
|
+
|
|
41
|
+
### Rule ID: `nitro-cache-varies-for-tenant-host`
|
|
42
|
+
### Rule: Configure `cache.varies` when caching depends on request headers
|
|
43
|
+
### When to apply
|
|
44
|
+
Using Nitro cache/route rules with host-aware or tenant-aware logic.
|
|
45
|
+
|
|
46
|
+
### Wrong pattern
|
|
47
|
+
Reading host-based request data under cached routes without declaring varying headers.
|
|
48
|
+
|
|
49
|
+
### Recommended pattern
|
|
50
|
+
Set `cache.varies` for headers that affect output (typically `host`, `x-forwarded-host` in multi-tenant setups).
|
|
51
|
+
|
|
52
|
+
### Nuxt-specific caveat
|
|
53
|
+
With cached responses, incoming request headers are dropped by default; `useRequestURL()` can otherwise resolve host as `localhost`.
|
|
54
|
+
|
|
55
|
+
### Execution checklist
|
|
56
|
+
- [ ] Inputs to inspect: cached route logic that branches on headers/host.
|
|
57
|
+
- [ ] Minimal verification: cache keys vary by intended tenant headers.
|
|
58
|
+
- [ ] Stop condition: output is fully header-invariant.
|
|
59
|
+
|
|
60
|
+
### Rule ID: `nitro-api-error-shape-client-safe`
|
|
61
|
+
### Rule: Use client-safe API error shape in server handlers
|
|
62
|
+
### When to apply
|
|
63
|
+
Throwing errors from `server/api/*` endpoints consumed by clients.
|
|
64
|
+
|
|
65
|
+
### Wrong pattern
|
|
66
|
+
Throwing generic errors or relying on long/internal `message` values to reach clients.
|
|
67
|
+
|
|
68
|
+
### Recommended pattern
|
|
69
|
+
Throw `createError` with explicit `status` and short `statusText`; use `data` for structured client payload and keep sensitive detail server-side.
|
|
70
|
+
|
|
71
|
+
### Nuxt-specific caveat
|
|
72
|
+
In API routes, `statusText` is the safer client-facing channel; avoid embedding dynamic user input in messages.
|
|
73
|
+
|
|
74
|
+
### Execution checklist
|
|
75
|
+
- [ ] Inputs to inspect: thrown API errors and exposed message payloads.
|
|
76
|
+
- [ ] Minimal verification: consistent status code/text contract with no sensitive leakage.
|
|
77
|
+
- [ ] Stop condition: upstream error contract cannot be mapped safely.
|
|
78
|
+
|
|
79
|
+
### Rule ID: `nitro-runtime-config-from-event`
|
|
80
|
+
### Rule: Prefer `useRuntimeConfig(event)` in server routes
|
|
81
|
+
### When to apply
|
|
82
|
+
Accessing runtime config inside server handlers.
|
|
83
|
+
|
|
84
|
+
### Wrong pattern
|
|
85
|
+
Reading config without event context in handlers that may depend on runtime overrides.
|
|
86
|
+
|
|
87
|
+
### Recommended pattern
|
|
88
|
+
Pass `event` to `useRuntimeConfig(event)` in server handlers.
|
|
89
|
+
|
|
90
|
+
### Nuxt-specific caveat
|
|
91
|
+
Passing event is optional but recommended for runtime-overridden environment values in route execution.
|
|
92
|
+
|
|
93
|
+
### Execution checklist
|
|
94
|
+
- [ ] Inputs to inspect: server handlers using runtime config.
|
|
95
|
+
- [ ] Minimal verification: handler config values resolve correctly in runtime deployment environment.
|
|
96
|
+
- [ ] Stop condition: execution context is not an h3 event handler.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
## Nuxt UI Primitives
|
|
2
|
+
|
|
3
|
+
### Rule ID: `ui-primitives-before-custom-markup`
|
|
4
|
+
### Rule: Prefer Nuxt UI primitives before custom markup
|
|
5
|
+
### When to apply
|
|
6
|
+
Building or fixing page chrome, tables, forms, modals, command palettes, dropdowns, or similar UI surfaces.
|
|
7
|
+
|
|
8
|
+
### Wrong pattern
|
|
9
|
+
Rebuilding a UI surface with raw HTML, custom keyboard handlers, or ad hoc styling when Nuxt UI already provides a first-class component.
|
|
10
|
+
|
|
11
|
+
### Recommended pattern
|
|
12
|
+
Start with the Nuxt UI primitive first and only fall back to custom markup when the primitive cannot express the required behavior.
|
|
13
|
+
|
|
14
|
+
### Nuxt-specific caveat
|
|
15
|
+
Nuxt UI tasks often fail because agents build something that looks correct while bypassing the intended component.
|
|
16
|
+
|
|
17
|
+
### Execution checklist
|
|
18
|
+
- [ ] Inputs to inspect: whether a matching Nuxt UI component exists for the surface.
|
|
19
|
+
- [ ] Minimal verification: the implementation uses the framework component when one fits.
|
|
20
|
+
- [ ] Stop condition: the required behavior is genuinely outside the component model.
|
|
21
|
+
|
|
22
|
+
### Rule ID: `ui-current-api-shape-not-lookalike`
|
|
23
|
+
### Rule: Match the current Nuxt UI API shape, not a plausible lookalike
|
|
24
|
+
### When to apply
|
|
25
|
+
Using existing or newly added Nuxt UI components.
|
|
26
|
+
|
|
27
|
+
### Wrong pattern
|
|
28
|
+
Guessing old props, old slot names, or generic dialog and table APIs that only resemble the real component.
|
|
29
|
+
|
|
30
|
+
### Recommended pattern
|
|
31
|
+
Use the documented prop names, models, slots, and grouping patterns for the exact Nuxt UI component.
|
|
32
|
+
|
|
33
|
+
### Nuxt-specific caveat
|
|
34
|
+
Nuxt UI evals frequently expose “wrong but plausible” API memory rather than outright broken UI.
|
|
35
|
+
|
|
36
|
+
### Execution checklist
|
|
37
|
+
- [ ] Inputs to inspect: component props, slot API, and state model.
|
|
38
|
+
- [ ] Minimal verification: component usage matches the expected API shape for the installed version.
|
|
39
|
+
- [ ] Stop condition: the installed module intentionally wraps or replaces the upstream component API.
|
|
40
|
+
|
|
41
|
+
### Rule ID: `ui-page-shells-belong-to-framework-components`
|
|
42
|
+
### Rule: Use framework page-shell components when they exist
|
|
43
|
+
### When to apply
|
|
44
|
+
Docs pages, marketing shells, dashboards, or app page chrome where Nuxt UI supplies a page primitive.
|
|
45
|
+
|
|
46
|
+
### Wrong pattern
|
|
47
|
+
Hand-assembling repeated header and footer page chrome when a framework page-shell component exists.
|
|
48
|
+
|
|
49
|
+
### Recommended pattern
|
|
50
|
+
Prefer the page-shell component and compose around it.
|
|
51
|
+
|
|
52
|
+
### Nuxt-specific caveat
|
|
53
|
+
A raw HTML page can look polished while still being the wrong answer if the framework expects a Nuxt UI shell.
|
|
54
|
+
|
|
55
|
+
### Execution checklist
|
|
56
|
+
- [ ] Inputs to inspect: repeated page chrome, layout composition, and available Nuxt UI shell primitives.
|
|
57
|
+
- [ ] Minimal verification: shared page chrome is expressed through the framework primitive when available.
|
|
58
|
+
- [ ] Stop condition: the prompt explicitly requires bespoke shell markup.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
## Page Meta, Head, and Layout
|
|
2
|
+
|
|
3
|
+
### Rule ID: `page-define-page-meta-for-page-behavior`
|
|
4
|
+
### Rule: Use `definePageMeta` for page behavior, not document metadata
|
|
5
|
+
### When to apply
|
|
6
|
+
Changing layout, middleware, route rules, page transitions, keepalive, or other page-level behavior.
|
|
7
|
+
|
|
8
|
+
### Wrong pattern
|
|
9
|
+
Using `useHead` or ad hoc component wiring for concerns that belong in page metadata.
|
|
10
|
+
|
|
11
|
+
### Recommended pattern
|
|
12
|
+
Use `definePageMeta` in page files for page behavior and routing-related options.
|
|
13
|
+
|
|
14
|
+
### Nuxt-specific caveat
|
|
15
|
+
`definePageMeta` is about how a page behaves inside the app, not what goes into the document head.
|
|
16
|
+
|
|
17
|
+
### Execution checklist
|
|
18
|
+
- [ ] Inputs to inspect: whether the change lives in a page file and affects app behavior rather than head tags.
|
|
19
|
+
- [ ] Minimal verification: page behavior is expressed through page metadata instead of custom glue.
|
|
20
|
+
- [ ] Stop condition: the change is not page-scoped.
|
|
21
|
+
|
|
22
|
+
### Rule ID: `page-use-head-for-document-metadata`
|
|
23
|
+
### Rule: Use `useHead` or `useSeoMeta` for title and meta tags
|
|
24
|
+
### When to apply
|
|
25
|
+
Changing page title, meta description, canonical URLs, social metadata, or structured head elements.
|
|
26
|
+
|
|
27
|
+
### Wrong pattern
|
|
28
|
+
Trying to set document metadata with `definePageMeta` or template markup.
|
|
29
|
+
|
|
30
|
+
### Recommended pattern
|
|
31
|
+
Use `useHead` for general document head state and `useSeoMeta` for SEO-focused metadata.
|
|
32
|
+
|
|
33
|
+
### Nuxt-specific caveat
|
|
34
|
+
Head metadata and page metadata are adjacent concepts but are not interchangeable.
|
|
35
|
+
|
|
36
|
+
### Execution checklist
|
|
37
|
+
- [ ] Inputs to inspect: the exact metadata surface being changed.
|
|
38
|
+
- [ ] Minimal verification: head data is emitted through Nuxt head composables.
|
|
39
|
+
- [ ] Stop condition: the task is about route behavior, layout, or middleware instead.
|
|
40
|
+
|
|
41
|
+
### Rule ID: `page-layout-structure-belongs-in-layouts`
|
|
42
|
+
### Rule: Put shared page chrome and structure in layouts or framework shells
|
|
43
|
+
### When to apply
|
|
44
|
+
Repeated headers, footers, navigation shells, or shared page structure across routes.
|
|
45
|
+
|
|
46
|
+
### Wrong pattern
|
|
47
|
+
Copying shell markup into pages or mixing layout concerns into unrelated components.
|
|
48
|
+
|
|
49
|
+
### Recommended pattern
|
|
50
|
+
Use layout files or framework-owned shell primitives for shared structure.
|
|
51
|
+
|
|
52
|
+
### Nuxt-specific caveat
|
|
53
|
+
Layout confusion often travels with `definePageMeta` vs `useHead` confusion, so resolve both surfaces together.
|
|
54
|
+
|
|
55
|
+
### Execution checklist
|
|
56
|
+
- [ ] Inputs to inspect: whether the structure is shared across pages and whether a layout already exists.
|
|
57
|
+
- [ ] Minimal verification: shared shell concerns live in the layout layer, not duplicated page markup.
|
|
58
|
+
- [ ] Stop condition: the structure is intentionally page-specific.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
## Performance and Rendering
|
|
2
|
+
|
|
3
|
+
### Rule ID: `perf-use-nuxtlink-for-internal-nav`
|
|
4
|
+
### Rule: Use `NuxtLink` for internal navigation
|
|
5
|
+
### When to apply
|
|
6
|
+
Creating or refactoring internal navigation links.
|
|
7
|
+
|
|
8
|
+
### Wrong pattern
|
|
9
|
+
Using raw `<a>` tags for internal routes without Nuxt link behavior.
|
|
10
|
+
|
|
11
|
+
### Recommended pattern
|
|
12
|
+
Use `NuxtLink` for internal routes and tune prefetch strategy when needed (`visible` vs `interaction`).
|
|
13
|
+
|
|
14
|
+
### Nuxt-specific caveat
|
|
15
|
+
`NuxtLink` carries built-in route-aware prefetching and defaults that reduce navigation latency.
|
|
16
|
+
|
|
17
|
+
### Execution checklist
|
|
18
|
+
- [ ] Inputs to inspect: internal links in pages/layout/components.
|
|
19
|
+
- [ ] Minimal verification: internal links use `NuxtLink` and preserve semantics/accessibility.
|
|
20
|
+
- [ ] Stop condition: link target is external or deliberately bypasses router.
|
|
21
|
+
|
|
22
|
+
### Rule ID: `perf-match-route-rules-to-content-volatility`
|
|
23
|
+
### Rule: Use route rules to match rendering strategy to content volatility
|
|
24
|
+
### When to apply
|
|
25
|
+
Pages with mixed static, stale-while-revalidate, ISR, or client-only requirements.
|
|
26
|
+
|
|
27
|
+
### Wrong pattern
|
|
28
|
+
Applying one rendering mode globally when route behavior differs.
|
|
29
|
+
|
|
30
|
+
### Recommended pattern
|
|
31
|
+
Set explicit `routeRules` per route family (`prerender`, `swr`, `isr`, `ssr: false`) based on freshness and SEO needs.
|
|
32
|
+
|
|
33
|
+
### Nuxt-specific caveat
|
|
34
|
+
Nuxt/Nitro route rules directly shape cache semantics and server behavior per route.
|
|
35
|
+
|
|
36
|
+
### Execution checklist
|
|
37
|
+
- [ ] Inputs to inspect: route patterns, freshness requirements, and SEO constraints.
|
|
38
|
+
- [ ] Minimal verification: configured rules align with intended cache/render behavior.
|
|
39
|
+
- [ ] Stop condition: deployment target cannot support required route rule semantics.
|
|
40
|
+
|
|
41
|
+
### Rule ID: `perf-lazy-load-and-hydrate-intentionally`
|
|
42
|
+
### Rule: Use lazy component loading and lazy hydration intentionally
|
|
43
|
+
### When to apply
|
|
44
|
+
Components not required for first meaningful paint or immediate interactivity.
|
|
45
|
+
|
|
46
|
+
### Wrong pattern
|
|
47
|
+
Hydrating all components eagerly on initial page load.
|
|
48
|
+
|
|
49
|
+
### Recommended pattern
|
|
50
|
+
Use `Lazy*` component imports and hydration triggers (for example `hydrate-on-visible`) for non-critical islands.
|
|
51
|
+
|
|
52
|
+
### Nuxt-specific caveat
|
|
53
|
+
Lazy hydration support exists in Nuxt and can materially reduce main-thread work on initial navigation.
|
|
54
|
+
|
|
55
|
+
### Execution checklist
|
|
56
|
+
- [ ] Inputs to inspect: above-the-fold criticality and interactive timing needs.
|
|
57
|
+
- [ ] Minimal verification: non-critical UI defers code/hydration without breaking UX.
|
|
58
|
+
- [ ] Stop condition: component must be immediately interactive for first render flow.
|
|
59
|
+
|
|
60
|
+
### Rule ID: `perf-reduce-payload-and-asset-cost`
|
|
61
|
+
### Rule: Reduce payload and asset cost before adding infra complexity
|
|
62
|
+
### When to apply
|
|
63
|
+
Performance regressions tied to response size, client JS, images, or third-party scripts.
|
|
64
|
+
|
|
65
|
+
### Wrong pattern
|
|
66
|
+
Adding caching layers first while shipping oversized payloads/assets.
|
|
67
|
+
|
|
68
|
+
### Recommended pattern
|
|
69
|
+
Trim async-data payload shape, optimize images/fonts/scripts with Nuxt-native tooling, and profile with DevTools + `nuxi analyze`.
|
|
70
|
+
|
|
71
|
+
### Nuxt-specific caveat
|
|
72
|
+
Nuxt Image, Nuxt Fonts, and Nuxt Scripts are designed to target LCP/CLS/INP regressions with Nuxt-aware defaults.
|
|
73
|
+
|
|
74
|
+
### Execution checklist
|
|
75
|
+
- [ ] Inputs to inspect: payload tab, bundle analysis, image/script/font loading paths.
|
|
76
|
+
- [ ] Minimal verification: measurable reduction in transferred bytes or blocking work on critical path.
|
|
77
|
+
- [ ] Stop condition: bottleneck is backend latency unrelated to client payload/asset behavior.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
## Plugins and Runtime Boot
|
|
2
|
+
|
|
3
|
+
### Rule ID: `plugin-use-composables-before-plugin`
|
|
4
|
+
### Rule: Prefer composables/utilities before creating a plugin
|
|
5
|
+
### When to apply
|
|
6
|
+
Adding shared logic or helper functions used by limited parts of the app.
|
|
7
|
+
|
|
8
|
+
### Wrong pattern
|
|
9
|
+
Creating a global plugin for logic that can live in local composables/utilities.
|
|
10
|
+
|
|
11
|
+
### Recommended pattern
|
|
12
|
+
Use plugins only for true app-wide injection, app hooks, or framework integration boundaries.
|
|
13
|
+
|
|
14
|
+
### Nuxt-specific caveat
|
|
15
|
+
Every plugin participates in startup/hydration paths; unnecessary plugins add global boot cost.
|
|
16
|
+
|
|
17
|
+
### Execution checklist
|
|
18
|
+
- [ ] Inputs to inspect: plugin purpose, usage breadth, and required injection scope.
|
|
19
|
+
- [ ] Minimal verification: plugin is justified by app-wide behavior, not convenience alone.
|
|
20
|
+
- [ ] Stop condition: integration requires app-level hook/injection semantics.
|
|
21
|
+
|
|
22
|
+
### Rule ID: `plugin-async-parallel-when-independent`
|
|
23
|
+
### Rule: Run async plugins in parallel when they are independent
|
|
24
|
+
### When to apply
|
|
25
|
+
Multiple async plugins with no ordering dependency.
|
|
26
|
+
|
|
27
|
+
### Wrong pattern
|
|
28
|
+
Leaving independent async plugins serialized.
|
|
29
|
+
|
|
30
|
+
### Recommended pattern
|
|
31
|
+
Use object plugin syntax with `parallel: true`; define `dependsOn` only for real ordering constraints.
|
|
32
|
+
|
|
33
|
+
### Nuxt-specific caveat
|
|
34
|
+
Nuxt plugin runtime supports parallel execution and dependency-aware sequencing.
|
|
35
|
+
|
|
36
|
+
### Execution checklist
|
|
37
|
+
- [ ] Inputs to inspect: plugin async work and inter-plugin dependency graph.
|
|
38
|
+
- [ ] Minimal verification: independent plugins run in parallel without race conditions.
|
|
39
|
+
- [ ] Stop condition: plugin order is required for correctness.
|
|
40
|
+
|
|
41
|
+
### Rule ID: `plugin-order-controls-only-when-necessary`
|
|
42
|
+
### Rule: Use plugin ordering controls sparingly
|
|
43
|
+
### When to apply
|
|
44
|
+
You need deterministic plugin execution order.
|
|
45
|
+
|
|
46
|
+
### Wrong pattern
|
|
47
|
+
Using `order`/`enforce` aggressively to patch unclear plugin design.
|
|
48
|
+
|
|
49
|
+
### Recommended pattern
|
|
50
|
+
Keep default order first; use `dependsOn` for explicit dependency edges and reserve `order` for advanced edge cases.
|
|
51
|
+
|
|
52
|
+
### Nuxt-specific caveat
|
|
53
|
+
`order` overrides `enforce` and increases maintenance risk when plugin graphs evolve.
|
|
54
|
+
|
|
55
|
+
### Execution checklist
|
|
56
|
+
- [ ] Inputs to inspect: plugin metadata (`enforce`, `dependsOn`, `order`) and real dependency needs.
|
|
57
|
+
- [ ] Minimal verification: ordering metadata is minimal and documented by dependency reason.
|
|
58
|
+
- [ ] Stop condition: required order cannot be represented without broad global ordering hacks.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
## Server Routes, h3 Patterns, and Runtime Config
|
|
2
|
+
|
|
3
|
+
### Rule ID: `server-validate-input-at-boundary`
|
|
4
|
+
### Rule: Validate request input at handler boundaries
|
|
5
|
+
### When to apply
|
|
6
|
+
Creating or updating `server/api/*` routes, webhook handlers, or actions.
|
|
7
|
+
|
|
8
|
+
### Wrong pattern
|
|
9
|
+
Trusting payload shape and casting request body directly.
|
|
10
|
+
|
|
11
|
+
### Recommended pattern
|
|
12
|
+
Validate input at handler entry and return explicit HTTP errors on invalid data.
|
|
13
|
+
|
|
14
|
+
### Nuxt-specific caveat
|
|
15
|
+
Keep validation close to h3 handler entrypoints to avoid hidden assumptions.
|
|
16
|
+
|
|
17
|
+
### Execution checklist
|
|
18
|
+
- [ ] Inputs to inspect: new/edited handler params, body parsing, query usage.
|
|
19
|
+
- [ ] Minimal verification: invalid payload returns explicit error status.
|
|
20
|
+
- [ ] Stop condition: handler cannot define a stable input contract.
|
|
21
|
+
|
|
22
|
+
### Rule ID: `server-runtime-config-public-minimal`
|
|
23
|
+
### Rule: Keep runtime config exposure intentional
|
|
24
|
+
### When to apply
|
|
25
|
+
Adding env vars or endpoint values in `runtimeConfig`.
|
|
26
|
+
|
|
27
|
+
### Wrong pattern
|
|
28
|
+
Moving broad server configuration into `runtimeConfig.public`.
|
|
29
|
+
|
|
30
|
+
### Recommended pattern
|
|
31
|
+
Expose only the minimum public keys required by the client.
|
|
32
|
+
|
|
33
|
+
### Nuxt-specific caveat
|
|
34
|
+
Changes under `runtimeConfig.public` are effectively public API changes.
|
|
35
|
+
|
|
36
|
+
### Execution checklist
|
|
37
|
+
- [ ] Inputs to inspect: `nuxt.config` runtime config additions/changes.
|
|
38
|
+
- [ ] Minimal verification: only intended public keys are exposed.
|
|
39
|
+
- [ ] Stop condition: feature requires exposing secrets in public config.
|
|
40
|
+
|
|
41
|
+
### Rule ID: `server-header-forwarding-allowlist`
|
|
42
|
+
### Rule: Forward request headers intentionally
|
|
43
|
+
### When to apply
|
|
44
|
+
Proxying request context from SSR to internal or external API calls.
|
|
45
|
+
|
|
46
|
+
### Wrong pattern
|
|
47
|
+
Blindly forwarding all inbound headers to upstream services.
|
|
48
|
+
|
|
49
|
+
### Recommended pattern
|
|
50
|
+
Use `useFetch('/api/*')` for internal request-context propagation and explicit allowlists for external API calls.
|
|
51
|
+
|
|
52
|
+
### Nuxt-specific caveat
|
|
53
|
+
Relative `useFetch` calls on server use request-aware fetch behavior; external forwarding still requires explicit safety controls.
|
|
54
|
+
|
|
55
|
+
### Execution checklist
|
|
56
|
+
- [ ] Inputs to inspect: forwarded header sets and upstream destination type (internal vs external).
|
|
57
|
+
- [ ] Minimal verification: only required headers are forwarded, with no unsafe pass-through.
|
|
58
|
+
- [ ] Stop condition: upstream contract demands full raw header pass-through.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
## Verification and Finish
|
|
2
|
+
|
|
3
|
+
### Rule ID: `verify-check-the-intended-surface`
|
|
4
|
+
### Rule: Verify the intended framework surface, not only the visible result
|
|
5
|
+
### When to apply
|
|
6
|
+
Before concluding a Nuxt change.
|
|
7
|
+
|
|
8
|
+
### Wrong pattern
|
|
9
|
+
Stopping once the UI looks correct or once one failing line was changed.
|
|
10
|
+
|
|
11
|
+
### Recommended pattern
|
|
12
|
+
Confirm that the final implementation uses the intended Nuxt, Nuxt Content, or Nuxt UI surface.
|
|
13
|
+
|
|
14
|
+
### Nuxt-specific caveat
|
|
15
|
+
Framework tasks often fail because the behavior is visibly fixed but implemented through the wrong abstraction.
|
|
16
|
+
|
|
17
|
+
### Execution checklist
|
|
18
|
+
- [ ] Inputs to inspect: the final primitive, composable, or component choice.
|
|
19
|
+
- [ ] Minimal verification: the solution matches the framework-owned abstraction expected by the task.
|
|
20
|
+
- [ ] Stop condition: the prompt explicitly asks for a framework-agnostic implementation.
|
|
21
|
+
|
|
22
|
+
### Rule ID: `verify-second-surface-before-finish`
|
|
23
|
+
### Rule: Check for a second required surface before finishing
|
|
24
|
+
### When to apply
|
|
25
|
+
Tasks involving errors, layout plus page behavior, or server/client boundaries.
|
|
26
|
+
|
|
27
|
+
### Wrong pattern
|
|
28
|
+
Editing the first obvious file and concluding the work without checking paired surfaces.
|
|
29
|
+
|
|
30
|
+
### Recommended pattern
|
|
31
|
+
Ask whether the change also needs a global/local or server/client counterpart, then verify both surfaces explicitly.
|
|
32
|
+
|
|
33
|
+
### Nuxt-specific caveat
|
|
34
|
+
Nuxt patterns often span more than one file or render surface, especially around errors and privileged data flow.
|
|
35
|
+
|
|
36
|
+
### Execution checklist
|
|
37
|
+
- [ ] Inputs to inspect: related files such as `app/error.vue`, local boundaries, server routes, client callers, layouts, and pages.
|
|
38
|
+
- [ ] Minimal verification: both required surfaces are updated or explicitly ruled out.
|
|
39
|
+
- [ ] Stop condition: the task is intentionally isolated to one surface.
|
|
40
|
+
|
|
41
|
+
### Rule ID: `verify-version-sensitive-api-shapes`
|
|
42
|
+
### Rule: Re-check version-sensitive API shapes before finalizing
|
|
43
|
+
### When to apply
|
|
44
|
+
Using components or module APIs that have plausible older alternatives.
|
|
45
|
+
|
|
46
|
+
### Wrong pattern
|
|
47
|
+
Trusting approximate memory for component props, slot names, or composable signatures.
|
|
48
|
+
|
|
49
|
+
### Recommended pattern
|
|
50
|
+
Re-check the installed skill or linked docs when an API shape looks close but uncertain.
|
|
51
|
+
|
|
52
|
+
### Nuxt-specific caveat
|
|
53
|
+
Version drift often shows up as “almost right” component or module usage that passes casual review but is wrong for the installed version.
|
|
54
|
+
|
|
55
|
+
### Execution checklist
|
|
56
|
+
- [ ] Inputs to inspect: wrapper links, installed skill guidance, and exact component or composable signature.
|
|
57
|
+
- [ ] Minimal verification: current API names and state models match the installed version.
|
|
58
|
+
- [ ] Stop condition: the local project intentionally wraps the upstream API with a different contract.
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "nuxt-skill-hub",
|
|
3
|
+
"version": "0.0.1-beta.1",
|
|
4
|
+
"description": "Teach your AI agent the Nuxt way with best practices and module guidance.",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/maxi/nuxt-skill-hub.git"
|
|
8
|
+
},
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"type": "module",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/types.d.mts",
|
|
14
|
+
"import": "./dist/module.mjs"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"main": "./dist/module.mjs",
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"nuxt-best-practices"
|
|
21
|
+
],
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@nuxt/kit": "^4.3.1",
|
|
24
|
+
"automd": "^0.4.3",
|
|
25
|
+
"consola": "^3.4.0",
|
|
26
|
+
"giget": "^3.1.2",
|
|
27
|
+
"gray-matter": "^4.0.3",
|
|
28
|
+
"ofetch": "^1.5.0",
|
|
29
|
+
"pathe": "^2.0.0",
|
|
30
|
+
"pkg-types": "^2.3.0",
|
|
31
|
+
"unagent": "^0.0.8"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@nuxt/devtools": "^3.2.1",
|
|
35
|
+
"@nuxt/eslint-config": "^1.15.1",
|
|
36
|
+
"@nuxt/module-builder": "^1.0.2",
|
|
37
|
+
"@nuxt/schema": "^4.3.1",
|
|
38
|
+
"@nuxt/test-utils": "^4.0.0",
|
|
39
|
+
"@nuxtjs/mdc": "^0.20.2",
|
|
40
|
+
"@types/node": "latest",
|
|
41
|
+
"@vue/test-utils": "^2.4.6",
|
|
42
|
+
"changelogen": "^0.6.2",
|
|
43
|
+
"eslint": "^10.0.1",
|
|
44
|
+
"happy-dom": "^20.7.0",
|
|
45
|
+
"nuxt": "^4.3.1",
|
|
46
|
+
"typescript": "~5.9.3",
|
|
47
|
+
"vitest": "^4.0.18",
|
|
48
|
+
"vue": "^3.5.29",
|
|
49
|
+
"vue-tsc": "^3.2.5"
|
|
50
|
+
},
|
|
51
|
+
"scripts": {
|
|
52
|
+
"dev": "pnpm --dir docs dev",
|
|
53
|
+
"dev:build": "nuxt-module-build build --stub --watch",
|
|
54
|
+
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare",
|
|
55
|
+
"release": "pnpm run lint && pnpm run typecheck && pnpm run test && pnpm run prepack && changelogen --release --push",
|
|
56
|
+
"lint": "eslint .",
|
|
57
|
+
"test": "pnpm run dev:prepare && vitest run && pnpm run test:pack",
|
|
58
|
+
"test:pack": "node ./scripts/check-packlist.mjs",
|
|
59
|
+
"test:watch": "vitest watch",
|
|
60
|
+
"test:types": "pnpm run dev:prepare && vue-tsc --noEmit",
|
|
61
|
+
"docs:typecheck": "pnpm --dir docs typecheck",
|
|
62
|
+
"typecheck": "pnpm run test:types && pnpm run docs:typecheck"
|
|
63
|
+
}
|
|
64
|
+
}
|