Skip to content
Back to skills

Nuxt Knowledge Patch

ASecurity

Nuxt

  • 25 stars
  • 0 votes
  • 0 copies
  • 6 views
  • Added September 5, 2026
developmenttypescriptrustgoshellreactvuetestingapidatabasesecurity

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 10 files and shows the line behind each finding

Scanned December 1, 2026

npx -y skills add Nevaberry/nevaberry-plugins --skill nuxt-knowledge-patch --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Nuxt Knowledge Patch?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Nuxt Knowledge Patch
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nevaberry-nuxt-knowledge-patch-nevaberry-plugins/badge)](https://www.skillsdirectory.com/skills/nevaberry-nuxt-knowledge-patch-nevaberry-plugins)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: nuxt-knowledge-patch
description: Nuxt
version: "4.7.1"
license: MIT
metadata:
  author: Nevaberry
---


# Nuxt compatibility guidance

Load this skill when upgrading Nuxt or working on its routing, data fetching,
rendering, modules, build configuration, server deployment, or ecosystem modules.
Use the quick reference below, then open the relevant topic for examples and
the version-specific conditions attached to the guidance.

> [!CAUTION]
> The Nitro 3 guidance is prerelease and may change before stable release.
> Individual items in the Nitro reference carry prerelease notices.

## Reference index

| Reference | Topics |
| --- | --- |
| [Upgrading](references/upgrading.md) | Compatibility flags, app layout, removals, migration, security upgrades |
| [Data fetching and state](references/data-fetching-and-state.md) | Async-data keys, cancellation, caching, payloads, cookies, state, preview |
| [Rendering and components](references/rendering-and-components.md) | Streaming, islands, hydration, head metadata, errors, time, loading indicators |
| [Routing and navigation](references/routing-and-navigation.md) | Page discovery, metadata, layouts, route rules, links, transitions, accessibility |
| [Modules and layers](references/modules-and-layers.md) | Layer precedence, lifecycle, dependencies, Kit resolution, types, auto-imports |
| [Build systems, tooling, and types](references/build-and-types.md) | Builders, styles, environments, diagnostics, profiling, TypeScript, tests |
| [Nitro and deployment](references/nitro-and-deployment.md) | Server integration, requests, caching, prerendering, Nitro 3, deployment presets |
| [Ecosystem modules](references/ecosystem-modules.md) | Scripts, Icon, Content, Image, UI |

## Breaking changes and deprecations

Remove `experimental.treeshakeClientOnly`, `experimental.configSchema`,
`experimental.polyfillVueUseHead`, and `experimental.respectNoSSRHeader`.
Use an application plugin for VueUse head compatibility and server middleware
for the no-SSR header if you relied on those options.

For dependencies between Nuxt modules, replace deprecated `installModule()`
calls with `moduleDependencies`. Nuxt 4 removes Nuxt 2 compatibility from
`@nuxt/kit`. Code calling `mergeModels` directly must import it from `vue`.

In app code, use `createError({ status: 404, statusText: 'Not Found' })`.
The older `statusCode` and `statusMessage` names are deprecated.
In Nuxt 4.6.4, production SSR error messages and data reach the error page and
payload only for errors from `createError()`; use it for details intended for clients.

Use Nuxt's auto-imported head composables or `#app/composables/head` imports.
Direct `@unhead/vue` imports can lose Nuxt's async context.
Unhead 3 narrows `useHead` inputs and removes promise input: resolve asynchronous
values first. Nuxt 4.4.8 uses Unhead v2; match a direct dependency to that major.

Nuxt 4.5 uses Vite 8 with Rolldown; check custom Vite plugins and configuration
for compatibility. Its Rspack builder uses Rspack 2 with an Rsbuild middleware
dev server, which can affect custom Rspack configuration.
The `vite:extend`, `vite:extendConfig`, and `vite:configResolved` hooks are deprecated.
The shared `vite.optimizeDeps.include` list opts packages into client prebundling
only; Nuxt clears it for Vite's server environment.

For testing future defaults, set `future.compatibilityVersion` to `5`.
It enables the Vite Environment API and opts into future Nuxt 5 breaking changes,
including Nitro v3 once its integration ships.
From Nuxt 4.5.1, `vue.optionsApi` defaults to `false` at compatibility version 5
and later; explicitly enable it if the app or a dependency uses the Options API.

Nuxt 4 detects an existing Nuxt 3 layout. In the `app/` layout, place
`app.config.ts` and `error.vue` alongside `app.vue`; keep `nuxt.config.ts`,
`content/`, and `public/` at the project root.
The optional migration recipe automates common migration steps; review its changes
for remaining manual work. See the upgrading reference for its version-specific command.

## Security upgrades and request boundaries

For the security fixes shipped in 4.5.1, run `npx nuxt upgrade --dedupe`.
If routes use `cache`, `swr`, or `isr`, purge CDN or edge caches after upgrading:
earlier `_payload.json` responses may still be cached.
The security release accompanying 4.5.1 and 3.21.10 also fixes `@nuxt/devtools`
in 3.3.1; refresh the lockfile and check its resolved version.
Upgrade to 4.6.3 for Vite dev-server and Nitro request-path security fixes.

With Nitropack 2.13.6 in Nuxt 4.6.4, `cache`, `swr`, and `isr` rules cache only
`GET` and `HEAD`. Responses with `Set-Cookie`, `Cache-Control: private`, or
`no-store` are excluded from storage. Nitro trusts `X-Forwarded-Proto` only
when explicitly opted in; set up that opt-in for deployments relying on a trusted proxy.

In 4.6.4, webpack and Rspack reject unexpected `Host` headers, matching Vite.
Add custom or tunnel hostnames to `devServer.allowedHosts`.
During SSR, `useRequestFetch()` forwards request headers even to absolute URLs.

## Async data and state

Calls to `useAsyncData` or `useFetch` with the same key share state refs.
Multiple consumers watching the same dependency trigger a single fetch on change.
`useAsyncData` accepts a ref, computed ref, or getter as its key.
When a computed key changes, the previous result can remain while the new fetch runs.
From 4.4.6, a reactive `useFetch` key can change even with `watch: false`;
pass a fixed string as `key` to keep the same cache entry.

Forward the async-data handler's `signal` to `$fetch` so `clear()` or a refresh
with `dedupe: 'cancel'` aborts the pending request. A signal passed to `refresh()`
or `execute()` lets an `AbortController` cancel that run.

```ts
const { refresh } = await useAsyncData('users', (_nuxtApp, { signal }) =>
  $fetch('/api/users', { signal }),
)

const controller = new AbortController()
refresh({ signal: controller.signal })
controller.abort()
```

The reactive `enabled` option gates initial, watched, and manual executions.
Switching it to `false` cancels an in-flight execution and preserves existing data.
Return `undefined` from `getCachedData` to run the handler; `null` counts as cached data.
Use `createUseFetch` or `createUseAsyncData` for reusable defaults with automatic
SSR key injection. Call-site options override object defaults; a factory controls merging.

Experimental `extractAsyncDataHandlers` puts `useAsyncData` and `useLazyAsyncData`
handlers into chunks loaded on demand. A prerendered payload can provide data without
loading the handler on the client.
Preview mode reruns `useAsyncData` and `useFetch`, bypassing cached payload data.

Payload extraction requires SSR. For ISR and SWR routes, `'client'` mode inlines
the full payload in initial HTML while retaining `_payload.json` for navigation;
it becomes the default with compatibility version `5`.
From 4.5.1, Nuxt's in-memory payload cache is confined to prerendering; use route
caching configuration for payload responses cached across runtime requests.

`clearNuxtState` restores the initial value for state created with a `useState` initializer.
With cookie `refresh: true`, assigning the same value restarts `maxAge`.
In 4.6.3, Cookie Store updates leave expiration intact with that option enabled.
In 4.7.1, same-cookie `useCookie()` calls outside components share a ref.

## Routing, layouts, and navigation

Use one `definePageMeta` call per file. Build-time metadata scanning lets modules
inspect page metadata; `pages:resolved` exposes augmented pages.
List custom keys in `experimental.extraPageMetaExtractionKeys`.
With `experimental.inlineRouteRules`, modules can read `page.rules` and assign
rules in `pages:extend`. If an inline rule cannot map to an equivalent URL pattern,
Nuxt 4.5.1 warns and drops it; configure that pattern in top-level `routeRules`.

Route rules support named `appMiddleware` and `appLayout`.
Pass layout props as the second argument to `setPageLayout`, or use a
`definePageMeta` layout object with `name` and typed `props`.
`useLayout()` returns a readonly computed ref to the resolved layout.
File-based named views pair `child.vue` and `child@sidebar.vue`; metadata comes
from the default file, and rendering mode is a page-level setting.

From 4.6.2, server route rules follow the router's case sensitivity setting.
In 4.6.3, constrained rules cover only a subset of a dynamic page's URLs;
use an unconstrained pattern for settings applying to every URL it matches.
A `noScripts` rule `/docs/*` matches one segment; `/docs/**` covers nested paths.
From 4.6.4, encoded slashes can separate segments: `/api/**` also covers `/api%2Fadmin`.

In 4.6.3, `navigateTo` returns a redirect target only during route middleware.
Return `navigateTo(...)` from middleware and await it in ordinary app code.
Use `prefetch-on="interaction"` for hover/focus prefetching; visibility-triggered
`NuxtLink` prefetching is disabled in development.
Custom links expose `prefetch()`, `prefetched`, and `shouldPrefetch(trigger)`.

Use `<NuxtRouteAnnouncer />` for navigation announcements, or `useRouteAnnouncer()`
for a custom announcer. For in-page updates, render `<NuxtAnnouncer />` and call
`polite` or `assertive` from `useAnnouncer()` while focus remains where it is.

## Rendering and hydration

Experimental `ssrStreaming` flushes the shell first and commits status and headers
before rendering finishes. Use `streaming: false` on routes setting status,
headers, or cookies during rendering. Responses are buffered for crawlers and routes
with `redirect`, `cache`, `isr`, `swr`, `noScripts`, or `ssr: false`.

Server components are experimental and automatically enabled when a project or layer
contains a server-only component or page. For static hosting, crawl every page using
them, render the components during generation, and keep their props fixed at runtime.
App plugins run during island rendering; account for their side effects.
Island props must be objects. Rename reserved top-level `as` props, and `template`
props when the Vue runtime compiler is enabled.

Use `onPrehydrate` for browser code before Vue hydrates.
Lazy components support idle, interaction, media-query, and delay triggers;
listen for `@hydrated` on completion. `defineLazyHydrationComponent` supports
dynamic imports even with `components: false` or `imports.autoImport` set to `false`.
`<NuxtErrorBoundary>` exposes `error` and `clearError()` through its component instance.
Use loading-indicator methods to update its readonly state.

## Modules, layers, and tooling

Project files override auto-scanned layers, which override `extends` layers.
Later alphabetical auto-scanned names win; the first `extends` entry has highest priority.
Use `getLayerDirectories()` for resolved project and layer directories.
`shared/` must avoid Vue and Nitro imports; `#server` is blocked in client and shared code.

`moduleDependencies` loads dependencies before the declaring module.
`optional: true` limits an entry to projects already using that dependency.
Option precedence is `overrides`, project configuration, `defaults`, then dependency defaults.
Use `onInstall(nuxt)` and `onUpgrade(inlineOptions, nuxt, previousVersion)`;
commit `.nuxtrc` for module-version tracking.

`nuxt build --profile` records build timings and memory changes; `--profile=verbose`
prints timing breakdowns. `nuxt typecheck` detects Golar or accepts explicit
`--checker=golar` and `--checker=vue-tsc` choices.
Keep `defineVitestProject` out of Nuxt end-to-end test configuration.
See the build reference for generated TypeScript contexts, diagnostics, and editor setup.

## Ecosystem integration

Nuxt Scripts' typed `proxy` is safe during SSR and queues early client calls until
the script loads. Use `trigger` for consent or interaction and `bundle: true`
to serve a remote script from the site's own `/_scripts/{hash}` URL.

Content v3 replaces `ContentSlot` with `Slot`. Its collection schemas drive query types.
For serverless hosting, select a persistent adapter through Content database configuration;
development, server hosting, and static generation work without database setup.

Nuxt Image v2 requires Nuxt 3.1 or later. Replace named provider `getImage` exports
with a default `defineProvider` export, replace `joinWith` with `formatter`, and
switch away from removed `layer0` or `edgio` providers.
Restore `xs` and `xxl` breakpoints if existing `sizes` values rely on them.

Nuxt UI v4 includes former Pro components in `@nuxt/ui` and supports AI SDK v5
chat messages through `message.parts`. See the ecosystem reference for theming,
installation, templates, documentation integrations, and Icon rendering behavior.

Files in this skill

  • SKILL.md11.5 KB
  • coverage.json2.6 KB
  • references/build-and-types.md8.9 KB
  • references/data-fetching-and-state.md7 KB
  • references/ecosystem-modules.md9.1 KB
  • references/modules-and-layers.md7.9 KB
  • references/nitro-and-deployment.md8.4 KB
  • references/rendering-and-components.md9.3 KB
  • references/routing-and-navigation.md7.3 KB
  • references/upgrading.md4.7 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.