Skills
Skillsnuxt-skilld

nuxt-skilld

SeedPublic
ProjectSkilld

ALWAYS use when writing code importing "nuxt". Consult for debugging, best practices, or modifying nuxt.

At a glance

  • Source: skilld
  • Category: framework-docs
  • Scope: project
  • User-invocable: no
  • Version: 4.4.8
  • Package: nuxt@4.4.8 (nuxt/nuxt)

Location

.claude/skills/nuxt-skilld/


Auto-generated by scripts/sync-skills-content.ts. Add your own notes below — re-runs preserve the body and your soft frontmatter fields.

SKILL.md

.claude/skills/nuxt-skilld/SKILL.md

98 lines
Raw
---
name: nuxt-skilld
description: "Nuxt is a free and open-source framework with an intuitive and extendable way to create type-safe, performant and production-grade full-stack web applications and websites with Vue.js. ALWAYS use when writing code importing \"nuxt\". Consult for debugging, best practices, or modifying nuxt."
metadata:
  version: 4.5.1
  generated_by: cached
  generated_at: 2026-08-09
---

# nuxt/nuxt `nuxt@4.5.1`
**Tags:** 1x: 1.4.5, 2x: 2.18.1, alpha: 4.0.0-alpha.4

**References:** [package.json](./.skilld/pkg/package.json) • [README](./.skilld/pkg/README.md) • [Docs](./.skilld/docs/_INDEX.md) • [Issues](./.skilld/issues/_INDEX.md) • [Discussions](./.skilld/discussions/_INDEX.md) • [Releases](./.skilld/releases/_INDEX.md)

## Search

Use `skilld search "query" -p nuxt` instead of grepping `.skilld/` directories. Run `skilld search --guide -p nuxt` for full syntax, filters, and operators.

<!-- skilld:api-changes -->
## API Changes

This section documents version-specific API changes across recent Nuxt v4.x releases. Focus on changes that affect runtime behavior or introduce new APIs unknown to LLMs trained on older versions.

- BREAKING: `unhead` v3 — type-narrowing for `useHead` introduces stricter typing, breaking type changes if relying on v2's looser types; promise input deprecated and no longer supported [source](./.skilld/releases/v4.5.0.md:L266:271)

- BREAKING: Vue Router v5 upgrade — removes dependency on `unplugin-vue-router`; for most apps transparent, but if using `unplugin-vue-router` directly can remove from dependencies [source](./.skilld/releases/v4.4.0.md:L55:60)

- BREAKING: `unctx` v3 — resolves long-standing async context issues affecting composable-context reliability; potential subtle behavior changes if code relied on v2 quirks [source](./.skilld/releases/v4.5.0.md:L273:275)

- BREAKING: Vite 8 — major version bump with faster cold starts and Rolldown-powered internals; requires checking custom Vite plugins and config against Vite migration guide [source](./.skilld/releases/v4.5.0.md:L36:43)

- BREAKING: Rspack 2 and Rsbuild — internals rebuilt on Rsbuild; public surface (`builder: 'rspack'`) unchanged but custom Rspack config may need review [source](./.skilld/releases/v4.5.0.md:L45:64)

- BREAKING: `statusCode` → `status`, `statusMessage` → `statusText` — deprecated properties in preparation for Nitro v3; old properties still work but will be removed in v5 [source](./.skilld/releases/v4.3.0.md:L197:204)

- BREAKING: `noUncheckedIndexedAccess` enabled by default in server tsconfig — improves type safety but may surface new type errors in server code; can be disabled if needed [source](./.skilld/releases/v4.3.0.md:L220:239)

- NEW: `useLayout()` composable — reactively reads the layout resolved for the current route; returns a read-only computed ref [source](./.skilld/releases/v4.5.0.md:L112:129)

- NEW: Named views support via `name@view.vue` convention — parent pages can render multiple `<NuxtPage>` outlets with named siblings [source](./.skilld/releases/v4.5.0.md:L131:161)

- NEW: `enabled` option for `useFetch` and `useAsyncData` — gates data fetching with reactive boolean; blocks execution and cancels in-flight requests when toggled [source](./.skilld/releases/v4.5.0.md:L163:181)

- NEW: `NuxtLink` prefetch slot props for custom slots — exposes `prefetch`, `prefetched`, `shouldPrefetch` to wire prefetching manually when using `custom` prop [source](./.skilld/releases/v4.5.0.md:L183:209)

- NEW: Experimental SSR streaming (`experimental.ssrStreaming`) — dramatically improves TTFB by streaming HTML shell immediately; automatically disabled for bots; routes can opt out with `streaming: false` [source](./.skilld/releases/v4.5.0.md:L66:99)

- NEW: Stable error code system — warnings and errors now carry stable codes (e.g., `NUXT_E1001`) with why/fix inline; verbose text stripped in production [source](./.skilld/releases/v4.5.0.md:L102:110)

- NEW: `createUseFetch()` and `createUseAsyncData()` — factory functions to create custom instances with default options; fully typed, support all same options [source](./.skilld/releases/v4.4.0.md:L14:52)

- NEW: Typed layout props in `definePageMeta` — `layout` property accepts object with `name` and typed `props`; props autocomplete and type-check against layout's `defineProps` [source](./.skilld/releases/v4.4.0.md:L62:92)

- NEW: `useAnnouncer()` composable and `<NuxtAnnouncer>` component — announces dynamic in-page changes (form submissions, loading states) to screen readers with `polite()` and `assertive()` methods [source](./.skilld/releases/v4.4.0.md:L94:128)

- NEW: `appLayout` route rule property — set layouts directly in route rules for centralized, declarative layout management [source](./.skilld/releases/v4.3.0.md:L33:47)

- NEW: ISR/SWR Payload Extraction — payload extraction now works with `isr`, `swr`, and `cache` route rules; previously only prerendered [source](./.skilld/releases/v4.3.0.md:L57:74)

- NEW: Route groups in page meta (`route.meta.groups`) — parenthesized folders exposed in meta for convention-based authorization checks [source](./.skilld/releases/v4.3.0.md:L95:114)

**Also changed:** `payloadExtraction: 'client'` mode inlines payload in HTML (v4.4.0) · Abort control for `useAsyncData` via `signal` parameter (v4.2.0) · `refresh` option for `useCookie` extends expiration (v4.4.0) · `useState`/`clearNuxtState` reset to initial value not `undefined` (v4.4.0) · `#server` alias for server directory imports (v4.3.0) · Disable modules by setting options to `false` (v4.3.0) · Dev mode payload extraction in dev with `nitro.static: true` (v4.3.0) · Layout props with `setPageLayout(name, props)` in middleware (v4.3.0) · Async plugin constructors via `addVitePlugin`/`addWebpackPlugin` with lazy import (v4.3.0) · Module dependencies via `moduleDependencies` with version constraints (v4.1.0) · Module lifecycle hooks `onInstall`/`onUpgrade` triggered on first install/upgrade (v4.1.0) · `getLayerDirectories()` utility for accessing layer dirs without private API (v4.1.0) · Experimental Vite environment API with `viteEnvironmentApi: true` (v4.2.0) · Experimental `extractAsyncDataHandlers` for prerendered sites removes data fetching logic from client (v4.2.0) · Experimental TypeScript plugin via `typescriptPlugin: true` with component renaming and go-to-definition (v4.2.0) · Experimental Rolldown support via `rolldown-vite` override (v4.1.0) · Experimental `prefetchPreloadTags` forwards destination preload hints as prefetch (v4.5.0) · `import.meta.envName` for runtime environment name access (v4.5.0)
<!-- /skilld:api-changes -->

<!-- skilld:best-practices -->
## Best Practices

- Lazy-load components with the `Lazy` prefix to defer JavaScript bundling until needed — reduces initial bundle size and improves Time to Interactive [source](./.skilld/docs/3.guide/2.best-practices/performance.md#lazy-loading-components)

- Lazy-hydrate components with `hydrate-on-visible` to defer interactivity until visible — controls when components become interactive and improves time-to-interactive metrics [source](./.skilld/docs/3.guide/2.best-practices/performance.md#lazy-hydration)

- Use `useFetch` or `useAsyncData` for data fetching instead of `$fetch` directly — prevents fetching twice (once server, once client) and automatically serializes data to the hydration payload [source](./.skilld/docs/1.getting-started/10.data-fetching.md#the-need-for-usefetch-and-useasyncdata)

- Define shared state with a composable using `useState()`, never as a module-level `ref()` — module-level refs are shared across server requests and cause memory leaks [source](./.skilld/docs/1.getting-started/11.state-management.md#best-practices)

- Use route rules to implement hybrid rendering instead of global rendering mode — enables different caching strategies per route (prerender, swr, isr, ssr: false) [source](./.skilld/docs/3.guide/1.concepts/1.rendering.md#hybrid-rendering)

- Use `useCookie()` or `<ClientOnly>` for client-only data to avoid hydration mismatches — browser-only APIs like `localStorage` cause SSR/client inconsistencies [source](./.skilld/docs/3.guide/2.best-practices/hydration.md#browser-only-apis-in-server-context)

- Set `parallel: true` on async plugins to allow concurrent initialization — by default plugins load synchronously, blocking the server/dev startup [source](./.skilld/docs/3.guide/2.best-practices/plugins.md#if-async-enable-parallel)

- Avoid expensive setup in plugins; defer time-consuming logic to Nuxt hooks instead — plugins run during hydration and block rendering [source](./.skilld/docs/3.guide/2.best-practices/plugins.md#avoid-costly-plugin-setup)

- Use `<NuxtLink>` instead of native `<a>` tags for internal navigation — provides built-in prefetching, smart rendering (RouterLink vs `<a>`), and performance optimizations [source](./.skilld/docs/3.guide/2.best-practices/performance.md#links)

- Enable type-checking with `typescript.typeCheck: true` in `nuxt.config.ts` to catch errors at build time [source](./.skilld/docs/3.guide/1.concepts/8.typescript.md#type-checking)

- Prefer not awaiting `useLazyFetch()` or `useLazyAsyncData()` for non-blocking navigation — awaiting defeats the purpose of `lazy`; instead handle loading state via returned refs [source](./.skilld/docs/1.getting-started/10.data-fetching.md#a-note-on-await)

- Use the `watch` option in `useAsyncData`/`useFetch` to automatically refetch when reactive keys change — avoids manual dependency management and potential bugs [source](./.skilld/docs/4.api/2.composables/use-async-data.md#watch-parameters)

- Always pass the `signal` parameter to `$fetch` inside `useAsyncData` for proper request cancellation — enables cleanup when components unmount or requests become outdated [source](./.skilld/docs/4.api/2.composables/use-async-data.md#make-your-handler-abortable)

- Prefix module exports with the module name (components, composables, routes) to avoid conflicts — e.g., `<FooButton>` not `<Button>`, `/api/_foo/...` not `/api/data` [source](./.skilld/docs/3.guide/4.modules/7.best-practices.md#prefix-your-exports)
<!-- /skilld:best-practices -->

Related: vue-skilld

Install it elsewhere with curl -o .claude/skills/nuxt-skilld/SKILL.md --create-dirs https://uxlab.designcoder.net/api/skills/nuxt-skilld/source. Record what you changed in this page's notes.

  • a: Appearance
  • ?: Keyboard shortcuts