Generated banner for Nuxt
Generated logo for Nuxt

Nuxt

Anthony FuCommunityCreated by Anthony Fu

  • Skill
  • Tool integration
  • Software development
  • MIT
  • Low risk

From the author

Nuxt full-stack Vue framework with SSR, auto-imports, and file-based routing. Use when working with Nuxt apps, server routes, useFetch, middleware, or hybrid rendering.
— the description by Anthony Fu

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

Nuxt is a full-stack Vue framework designed for universal deployment. This skill provides essential guidance on Nuxt 5, covering its directory structure, file-based routing, server-side rendering, and Nitro-based server engine. It includes best practices for data fetching, state management, and modular architecture, helping developers leverage features like auto-imports and hybrid rendering.

What it does

  • Explains the Nuxt 5 directory structure and configuration conventions.
  • Details file-based routing, including typed and case-sensitive routes.
  • Provides guidance on data fetching using useFetch and $fetch.
  • Covers server-side rendering, hybrid rendering, and Nitro server integration.
  • Explains how to extend applications using Nuxt Layers and modules.
  • Outlines lifecycle hooks for build-time and runtime customization.

When to use it

  • When starting a new full-stack project with Vue and Nuxt.
  • When migrating existing projects to Nuxt 5 and Nitro v3.
  • When implementing server-side rendering or hybrid rendering strategies.
  • When creating reusable application layers or custom Nuxt modules.
  • When optimizing data fetching patterns and state management in SSR environments.

Advantages

  • Provides standardized patterns for Nuxt 5 development.
  • Simplifies complex concepts like Nitro server integration and lifecycle hooks.
  • Offers clear guidance on project structure and file-based routing.
  • Supports efficient code reuse through the Nuxt Layers system.

Usage examples

“How do I structure my Nuxt 5 project directory?”
The agent explains the default app/ directory structure for Vue code and the root-level placement for server/, public/, and nuxt.config.ts files.
“Explain how to use layers to share components between projects.”
The agent provides instructions on using the extends property in nuxt.config.ts to import layers from local directories, git repositories, or npm packages.
“How do I hook into the page navigation lifecycle?”
The agent shows how to use nuxtApp.hook('page:finish', ...) within a plugin to execute code after navigation completes.

Install

  1. Download the skill as a ZIP:

    https://autogineer.com/agent-skills/antfu/nuxt/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip nuxt.zip -d .agents/skills

Documentation by Anthony Fu

Nuxt is a full-stack Vue framework that provides server-side rendering, file-based routing, auto-imports, and a powerful module system. It uses Nitro as its server engine for universal deployment across Node.js, serverless, and edge platforms.

The skill is based on Nuxt 5.x (5.0.0-0), generated at 2026-11-05.

Directory layout: the default srcDir is app/ — Vue app code (app.vue, components/, composables/, pages/, etc.) lives under app/, while server/, shared/, public/, modules/, layers/ and nuxt.config.ts stay at the project root. The ~/@ aliases point at app/; use ~~/@@ for the root.

Nuxt 5 note: Nuxt 5 makes many former experimental flags the default. The biggest shifts for agents: server code moves to Nitro v3 (h3 v2, Web-standard Request/Response), server utilities import from nuxt/server and are no longer auto-imported by default, $fetch/useFetch are typed from generated route types, routing is case-sensitive and typed by default, and the bundler is Vite 8 (Rolldown). Nuxt 5 requires Node 22.19/24.11+. A Nitro v2 compatibility layer (nitroLegacy) keeps older server code building during migration. See individual references for details.

Core

TopicDescriptionReference
Directory StructureNuxt 4 app/ srcDir, shared/, aliases, conventionscore-directory-structure
Configurationnuxt.config.ts, app.config.ts, aliases, Nuxt 5 defaults, jiti removal, experimentalcore-config
CLI CommandsDev server, build, generate, preview, and utility commandscore-cli
RoutingFile-based routing, case-sensitive + typed routes, named views, layout props, middlewarecore-routing
Data FetchinguseFetch, useAsyncData, $fetch, typed routes, createUseFetch factories, cachingcore-data-fetching
ModulesCreating and using Nuxt modules, Nuxt Kit utilitiescore-modules
DeploymentPlatform-agnostic deployment with Nitro, Vercel, Netlify, Cloudflarecore-deployment

Features

TopicDescriptionReference
Composables Auto-importsVue/Nuxt composables, custom composables, shared/, useAnnouncerfeatures-composables
Components Auto-importsComponent naming, lazy loading, hydration strategiesfeatures-components-autoimport
Built-in ComponentsNuxtLink, NuxtPage, NuxtLayout, NuxtAnnouncer, ClientOnly, and morefeatures-components
State ManagementuseState composable, SSR-friendly state, Pinia integrationfeatures-state
Server RoutesAPI routes, nuxt/server imports, Nitro v3 (h3 v2), sessions, middlewarefeatures-server

Rendering

TopicDescriptionReference
Rendering ModesUniversal (SSR), client-side (SPA), hybrid rendering, route rulesrendering-modes

Best Practices

TopicDescriptionReference
Data Fetching PatternsEfficient fetching, caching, parallel requests, error handlingbest-practices-data-fetching
SSR & HydrationAvoiding context leaks, hydration mismatches, composable patternsbest-practices-ssr

Advanced

TopicDescriptionReference
LayersExtending applications with reusable layersadvanced-layers
Lifecycle HooksBuild-time, runtime, and server hooksadvanced-hooks
Module AuthoringPublishable modules with Nuxt Kit, keyed composables, dependenciesadvanced-module-authoring

Files

references/core-config.md


name: configuration description: Nuxt configuration files including nuxt.config.ts, app.config.ts, and runtime configuration

Nuxt Configuration

Nuxt uses configuration files to customize application behavior. The main configuration options are nuxt.config.ts for build-time settings and app.config.ts for runtime settings.

nuxt.config.ts

The main configuration file at the root of your project:

// nuxt.config.ts
export default defineNuxtConfig({
  // Configuration options
  devtools: { enabled: true },
  modules: ['@nuxt/ui'],
})
Path Aliases

The default srcDir is app/, so path aliases resolve as:

AliasResolves to
~ / @<rootDir>/app
~~ / @@<rootDir> (project root)
#shared<rootDir>/shared
#server<rootDir>/server

Reference root-level paths (modules, server handlers) with ~~ or #server:

export default defineNuxtConfig({
  modules: ['~~/custom-modules/awesome.js'], // relative to rootDir
  serverHandlers: [
    { route: '/foo/**', handler: '#server/foohandler.ts' },
  ],
})
nuxt.config Loading (Nuxt 5: no more jiti)

Nuxt 5 no longer bundles jiti. nuxt.config.ts, files in modules/, and layer configs are loaded by the Node runtime directly (requires Node 22.19/24.11+, which strip types natively). Two consequences:

  • Relative imports in these files need an explicit extension — write ./build/plugin.ts, not ./build/plugin (TS reports TS2835). Bare package imports are unaffected.

  • Use erasable TypeScript only in config/module files — no enum, namespace, constructor parameter properties, or decorators (TS reports TS1294).

App and shared/ code go through Vite and are unaffected. Published layers/modules must ship compiled JS (a shipped config as nuxt.config.mjs). Install jiti (-D) to restore the old fallback behavior; a nuxt.schema file always needs it.

Compatibility Version

Nuxt 5 behavior is now the default. future.compatibilityVersion is mostly historical — Nuxt 4 code paths that were opt-in are now unconditional. Individual behaviors are restored via specific experimental/config options (see each section below and the upgrade notes).

Environment Overrides

Configure environment-specific settings:

export default defineNuxtConfig({
  $production: {
    routeRules: {
      '/**': { isr: true },
    },
  },
  $development: {
    // Development-specific config
  },
  $env: {
    staging: {
      // Staging environment config
    },
  },
})

Use --envName flag to select environment: nuxt build --envName staging

Runtime Config

For values that need to be overridden via environment variables:

// nuxt.config.ts
export default defineNuxtConfig({
  runtimeConfig: {
    // Server-only keys
    apiSecret: '123',
    // Keys within public are exposed to client
    public: {
      apiBase: '/api',
    },
  },
})

Override with environment variables:

# .env
NUXT_API_SECRET=api_secret_token
NUXT_PUBLIC_API_BASE=https://api.example.com

Access in components/composables:

<script setup lang="ts">
const config = useRuntimeConfig()
// Server: config.apiSecret, config.public.apiBase
// Client: config.public.apiBase only
</script>

App Config

For public tokens determined at build time (not overridable via env vars):

// app/app.config.ts
export default defineAppConfig({
  title: 'Hello Nuxt',
  theme: {
    dark: true,
    colors: {
      primary: '#ff0000',
    },
  },
})

Access in components:

<script setup lang="ts">
const appConfig = useAppConfig()
</script>

runtimeConfig vs app.config

FeatureruntimeConfigapp.config
Client-sideHydratedBundled
Environment variablesYesNo
ReactiveYesYes
Hot module replacementNoYes
Non-primitive JS typesNoYes

Use runtimeConfig for secrets and values that change per environment. Use app.config for public tokens, theme settings, and non-sensitive config.

External Tool Configuration

Nuxt uses nuxt.config.ts as single source of truth. Configure external tools within it:

export default defineNuxtConfig({
  // Nitro configuration
  nitro: {
    // nitro options (storage mounts are `nitro.kv` + `useKV()`; `nitro.storage`/`useStorage()` are deprecated)
  },
  // Prerendering applies to any server builder; Nitro-only options (concurrency, failOnError) stay in `nitro.prerender`
  prerender: {
    routes: ['/user/1', '/user/2'],
    ignore: ['/dynamic'],
    crawlLinks: true,
  },
  // Client bundler: 'vite' (default) | 'webpack' | 'rsbuild' (`rspack` is deprecated, use rsbuild + `rsbuild: {}` options)
  // builder: 'rsbuild',
  // Vite configuration
  vite: {
    // vite options
    vue: {
      // @vitejs/plugin-vue options
    },
  },
  // PostCSS configuration
  postcss: {
    // postcss options
  },
})
Environment-specific Vite Config

Top-level vite options are shared. Use $client and $server to target a single Vite build:

export default defineNuxtConfig({
  vite: {
    $client: {
      build: { rollupOptions: { output: { manualChunks: { analytics: ['analytics-package'] } } } },
    },
    $server: {
      build: { sourcemap: 'inline' }, // `sourcemap` also accepts 'hidden' | 'nosource' at the top level
    },
  },
})

Vite 8 / Rolldown: vite.esbuild and vite.optimizeDeps.esbuildOptions are deprecated for vite.oxc and vite.optimizeDeps.rolldownOptions; build.rollupOptions for build.rolldownOptions. A Nitro rollup plugin that must run before Vite's resolution needs to be a Vite plugin with enforce: 'pre' (scope server-only plugins with applyToEnvironment: env => env.name === 'nitro').

Vue Configuration

Enable Vue experimental features:

export default defineNuxtConfig({
  vue: {
    propsDestructure: true,
  },
})

Nuxt 5 Default Changes

Many former experimental flags are now on by default. Each can be reverted via the named option:

BehaviorNow defaultRestore Nuxt 4 with
Case-sensitive page routingrouter.options.sensitive: truerouter.options.sensitive: false
Typed pages (useRoute/navigateTo/<NuxtLink> type-checked)onexperimental.typedPages: false
Page component name = route nameonexperimental.normalizePageNames: false
All serializable definePageMeta written to route recordonexperimental.extractSerializablePageMeta: false
Payload inlined in HTML, _payload.json only for SPA navexperimental.payloadExtraction: 'client'payloadExtraction: true
clearNuxtState resets to useState init valueonexperimental.defaults.useState.resetOnClear: false
await navigateTo() early-returns from setup()onexperimental.navigateToEarlyReturn: false
callHook may return void (not always a Promise)onexperimental.asyncCallHook: true
Client-only SSR placeholder is a comment node, not <div>onexperimental.clientNodePlaceholder: false
Reuse builder's file watcherexperimental.watcher: 'builder'watcher: 'chokidar'
Server auto-imports (Nitro helpers)offexperimental.nitroAutoImports: true
Error format: page errors return the HTML error page, server route errors return JSON (request headers no longer matter)experimental.inlineErrorRendering onexperimental.inlineErrorRendering: false
$fetch is not set on globalThis in the browser (import from #build/fetch)onprovide your own instance via a plugin (provide: { api: $fetch.create(...) })
routeRules keys use URLPattern: * matches nested paths, one */** per key, regex constraints cannot match encoded charsonuse named params (/blog/:slug)
server/utils/ subdirectories not auto-imported (warns NUXT_B9006)onre-export from a top-level file, or nitroLegacy.imports
h3 v1 / nitropack imports in your server/ dirnot supported (NUXT_B9005 lists them)nitroLegacy: true (or per-switch object) while migrating
error.data parsed (never stringified)forced on— (parseErrorData no longer configurable)
Vue Options API compiled out of client bundleonvue: { optionsApi: true }
noUncheckedSideEffectImports in generated tsconfigontypescript.tsConfig.compilerOptions.noUncheckedSideEffectImports: false

Removed options (behavior now unconditional): experimental.viteEnvironmentApi, experimental.routeTypedFetch, experimental.renderJsonPayloads, experimental.externalVue. Delete them from config.

unhead.legacy is ignored (setting it warns); Capo title sorting is always on.

Other Experimental Flags

On by default (disable with false): serverPathFallback (client navigation to a path matching no page, e.g. <NuxtLink to="/rss.xml">, loads as a full document so public files/server routes respond), templateDiagnostics (build warnings NUXT_B4025 for <NuxtLink to> matching no route, B3014 v-on/v-model on server components, B3015 function/class props to server components or <NuxtIsland>), deferPrefetchHints (prefetch hints rendered as data-href, activated by onNuxtReady), compileHints (V8 compile hint on entry/layout/page chunks, Vite prod builds), compilerComponentResolution (auto-imported components resolved in the Vue compiler).

Notable opt-in flags under experimental (see source for the full list):

export default defineNuxtConfig({
  experimental: {
    // Stream the HTML shell first, then render body progressively (better TTFB)
    ssrStreaming: true,
    // Reject fetches to paths no server route answers (true | 'isomorphic')
    strictRouteTypes: true,
    // Respond 404 for unmatched paths without loading the Vue app/plugins/middleware
    early404: true,
    // Prerender error.vue into 404.html at build time
    prerenderErrorPages: true,
    // Default options for core composables/components
    defaults: {
      nuxtLink: { prefetch: true, prefetchOn: { visibility: true } },
      useAsyncData: { deep: true },
    },
  },
})

<!-- Source references: - https://nuxt.com/docs/getting-started/configuration - https://nuxt.com/docs/getting-started/upgrade - https://nuxt.com/docs/guide/going-further/runtime-config - https://nuxt.com/docs/api/nuxt-config - https://nuxt.com/docs/guide/going-further/experimental-features - https://nuxt.com/docs/getting-started/prerendering - https://nuxt.com/docs/errors/b4025 - https://nuxt.com/docs/errors/b3014 - https://nuxt.com/docs/errors/b3015 -->

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Security

What our scanner noticed· Low risk

  • Instructions that use the network

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Created by
Anthony Fu
Publisher
Anthony Fu (Community)
Source
antfu/skills · skills/nuxt · commit f63e9ec
Licence
MIT License (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE.md)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by Anthony Fu or Anthony Fu.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download nuxt.zip