All skills
onmax avatar

/nuxt

@de09c7b official
by Maxonmax/nuxt-skills715 stars
38

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.

Use this Skill: https://skilld.dev/gh/onmax/nuxt-skills/nuxt

This session only. Nothing lands on disk.

referencescore-config.md

≈1.4k tokens on demand. Your agent reads this file only when SKILL.md points to it.

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'],
})

Nuxt 4 Path Aliases

In Nuxt 4 the default srcDir is app/, so the path aliases changed:

Alias Resolves 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' },
  ],
})

Compatibility Version

Nuxt 4 is the default behavior. To preview upcoming Nuxt 5 defaults (Vite Environment API, normalized page names, etc.):

export default defineNuxtConfig({
  future: {
    compatibilityVersion: 5,
  },
})

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

Feature runtimeConfig app.config
Client-side Hydrated Bundled
Environment variables Yes No
Reactive Yes Yes
Hot module replacement No Yes
Non-primitive JS types No Yes

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
  },
  // 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' },
    },
  },
})

Vue Configuration

Enable Vue experimental features:

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

Experimental Features & Defaults

Notable Nuxt 4 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,
    // Run useFetch when its key changes even if immediate:false and not yet triggered
    alwaysRunFetchOnKeyChange: true,
    // Split useAsyncData handlers into separate chunks (static builds)
    extractAsyncDataHandlers: true,
    // pending is true before fetching starts
    pendingWhenIdle: true,
    // Default options for core composables/components
    defaults: {
      nuxtLink: { prefetch: true, prefetchOn: { visibility: true } },
      useAsyncData: { deep: true },
      useState: { resetOnClear: true },
    },
  },
})
<!-- Source references: - https://nuxt.com/docs/4.x/getting-started/configuration - https://nuxt.com/docs/4.x/guide/going-further/runtime-config - https://nuxt.com/docs/4.x/api/nuxt-config - https://nuxt.com/docs/4.x/guide/going-further/experimental-features -->

Source: SKILL.md on GitHub

No alerts9d5 checks · Risk SAFE
  • Gen Agent Trust Hub9d

    This skill provides a comprehensive technical reference for the Nuxt full-stack framework, including documentation on directory structure, routing, data fetching, and deployment. No security issues or malicious patterns were detected.

  • Socket9d

    No alerts

  • Snyk9d

    Risk: LOW · No issues

  • Runlayer7mo

    8 files scanned · No issues

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at de09c7b. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 days ago.

Activeupdated last week
Other metadata
metadata
{
  "author": "Anthony Fu",
  "version": "2026.6.22",
  "source": "Generated from https://github.com/nuxt/nuxt, scripts located at https://github.com/antfu/skills"
}

README badge

README badge for onmax/nuxt-skills/nuxt

Provides patterns and reference files for Nuxt 4.3+ projects, covering server routes with h3 validation, file-based routing, middleware, plugins, and Nuxt composables. Use this when building API endpoints, setting up pages and layouts, or working with Nuxt-specific features like auto-imports and route guards.

Generated from the current SKILL.md.

Does this skill cover Nuxt 3 or only Nuxt 4+?
This skill targets Nuxt 4.3+ only. It includes patterns specific to Nuxt 4, such as typed router and getRouterParam, and does not cover Nuxt 2 or 3 conventions.
Does this skill include guidance for h3 and Nitro?
Yes. The skill covers h3 v1 helpers (validation, WebSocket, SSE) and nitropack v2 patterns for server routes and middleware.
Does this cover UI components like buttons or forms?
No. The skill covers Nuxt-specific components (NuxtLink, NuxtImg, NuxtTime) but delegates UI component libraries to the separate nuxt-ui skill.
Can I use this skill for creating Nuxt modules?
No. For module development, use the nuxt-modules skill instead. This skill focuses on building applications with Nuxt 4+.
Does this skill include database or content management guidance?
No. For databases, use the nuxthub skill; for content-driven sites, use the nuxt-content skill.

Generated from the current SKILL.md. These answers refresh after source changes.