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
Download the skill as a ZIP:
https://mp-staging.autogineer.com/agent-skills/antfu/nuxt/downloadUnzip 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
srcDirisapp/— Vue app code (app.vue,components/,composables/,pages/, etc.) lives underapp/, whileserver/,shared/,public/,modules/,layers/andnuxt.config.tsstay at the project root. The~/@aliases point atapp/; 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 fromnuxt/serverand are no longer auto-imported by default,$fetch/useFetchare typed from generated route types, routing is case-sensitive and typed by default, and the bundler is Vite 8 (Rolldown). Nuxt 5 requires Node22.19/24.11+. A Nitro v2 compatibility layer (nitroLegacy) keeps older server code building during migration. See individual references for details.
Core
| Topic | Description | Reference |
|---|---|---|
| Directory Structure | Nuxt 4 app/ srcDir, shared/, aliases, conventions | core-directory-structure |
| Configuration | nuxt.config.ts, app.config.ts, aliases, Nuxt 5 defaults, jiti removal, experimental | core-config |
| CLI Commands | Dev server, build, generate, preview, and utility commands | core-cli |
| Routing | File-based routing, case-sensitive + typed routes, named views, layout props, middleware | core-routing |
| Data Fetching | useFetch, useAsyncData, $fetch, typed routes, createUseFetch factories, caching | core-data-fetching |
| Modules | Creating and using Nuxt modules, Nuxt Kit utilities | core-modules |
| Deployment | Platform-agnostic deployment with Nitro, Vercel, Netlify, Cloudflare | core-deployment |
Features
| Topic | Description | Reference |
|---|---|---|
| Composables Auto-imports | Vue/Nuxt composables, custom composables, shared/, useAnnouncer | features-composables |
| Components Auto-imports | Component naming, lazy loading, hydration strategies | features-components-autoimport |
| Built-in Components | NuxtLink, NuxtPage, NuxtLayout, NuxtAnnouncer, ClientOnly, and more | features-components |
| State Management | useState composable, SSR-friendly state, Pinia integration | features-state |
| Server Routes | API routes, nuxt/server imports, Nitro v3 (h3 v2), sessions, middleware | features-server |
Rendering
| Topic | Description | Reference |
|---|---|---|
| Rendering Modes | Universal (SSR), client-side (SPA), hybrid rendering, route rules | rendering-modes |
Best Practices
| Topic | Description | Reference |
|---|---|---|
| Data Fetching Patterns | Efficient fetching, caching, parallel requests, error handling | best-practices-data-fetching |
| SSR & Hydration | Avoiding context leaks, hydration mismatches, composable patterns | best-practices-ssr |
Advanced
| Topic | Description | Reference |
|---|---|---|
| Layers | Extending applications with reusable layers | advanced-layers |
| Lifecycle Hooks | Build-time, runtime, and server hooks | advanced-hooks |
| Module Authoring | Publishable modules with Nuxt Kit, keyed composables, dependencies | advanced-module-authoring |
Files
- ATTRIBUTION.mdAdded by AutoGineer889 B
- GENERATION.md134 B
- LICENSELicence file added by AutoGineer1.1 KiB
- SKILL.md4.5 KiB
- references/advanced-hooks.md7.2 KiB
- references/advanced-layers.md5.1 KiB
- references/advanced-module-authoring.md16.5 KiB
- references/best-practices-data-fetching.md9.2 KiB
- references/best-practices-ssr.md7.5 KiB
- references/core-cli.md4.8 KiB
- references/core-config.md10.5 KiB
- references/core-data-fetching.md11.4 KiB
- references/core-deployment.md5.1 KiB
- references/core-directory-structure.md9.8 KiB
- references/core-modules.md5.4 KiB
- references/core-routing.md6.8 KiB
- references/features-components-autoimport.md5.9 KiB
- references/features-components.md6.1 KiB
- references/features-composables.md7.2 KiB
- references/features-server.md11.1 KiB
- references/features-state.md3.9 KiB
- references/rendering-modes.md5.5 KiB
references/advanced-hooks.md
name: lifecycle-hooks description: Nuxt and Nitro hooks for extending build-time and runtime behavior
Lifecycle Hooks
Nuxt provides hooks to tap into the build process, application lifecycle, and server runtime.
Build-time Hooks (Nuxt)
Used in nuxt.config.ts or modules:
In nuxt.config.ts
// nuxt.config.ts
export default defineNuxtConfig({
hooks: {
'build:before': () => {
console.log('Build starting...')
},
'pages:extend': (pages) => {
// Add custom pages
pages.push({
name: 'custom',
path: '/custom',
file: '~/pages/custom.vue',
})
},
'components:dirs': (dirs) => {
// Add component directories
dirs.push({ path: '~/extra-components' })
},
},
})In Modules
// modules/my-module.ts
export default defineNuxtModule({
setup(options, nuxt) {
nuxt.hook('ready', async (nuxt) => {
console.log('Nuxt is ready')
})
nuxt.hook('close', async (nuxt) => {
console.log('Nuxt is closing')
})
nuxt.hook('modules:done', () => {
console.log('All modules loaded')
})
},
})Common Build Hooks
| Hook | When |
|---|---|
ready | Nuxt initialization complete |
close | Nuxt is closing |
modules:done | All modules installed |
build:before | Before build starts |
build:done | Build complete |
pages:extend | Add/modify routes (before meta scan) |
pages:resolved | After page meta is scanned (with scanPageMeta) |
components:dirs | Component dirs being resolved |
imports:extend | Auto-imports being resolved |
nitro:config | Before Nitro config finalized |
vite:extend | Vite context created |
vite:extendConfig | Before Vite config finalized |
build:manifest | Customize the manifest Nitro uses for <script>/<link> tags (entries have prefetch/preload flags) |
rsbuild:config | Rsbuild builder: before the instance is created (config has client and ssr environments); rspack:config/rspack:configResolved also fire |
rsbuild:compile / rsbuild:compiled | Before first compile / after an environment compiled |
App Hooks (Runtime)
Used in plugins and composables:
In Plugins
// plugins/lifecycle.ts
export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.hook('app:created', (vueApp) => {
console.log('Vue app created')
})
nuxtApp.hook('app:mounted', (vueApp) => {
console.log('App mounted')
})
nuxtApp.hook('page:start', () => {
console.log('Page navigation starting')
})
nuxtApp.hook('page:finish', () => {
console.log('Page navigation finished')
})
nuxtApp.hook('page:loading:start', () => {
console.log('Page loading started')
})
nuxtApp.hook('page:loading:end', () => {
console.log('Page loading ended')
})
})Common App Hooks
| Hook | When |
|---|---|
app:created | Vue app created |
app:mounted | Vue app mounted (client only) |
app:error | Fatal error occurred |
page:start | Page navigation starting |
page:finish | Page navigation finished |
page:loading:start | Loading indicator should show |
page:loading:end | Loading indicator should hide |
link:prefetch | Link is being prefetched |
Using Runtime Hooks
// composables/usePageTracking.ts
export function usePageTracking() {
const nuxtApp = useNuxtApp()
nuxtApp.hook('page:finish', () => {
trackPageView(useRoute().path)
})
}Server Hooks (Nitro)
Used in server plugins:
In Nitro v3 the plugin factory is definePlugin from nitro:
// server/plugins/hooks.ts
import { definePlugin } from 'nitro'
export default definePlugin((nitroApp) => {
// Modify HTML before sending
nitroApp.hooks.hook('render:html', (html, { event }) => {
html.head.push('<meta name="custom" content="value">')
html.bodyAppend.push('<script>console.log("injected")</script>')
})
// Before request
nitroApp.hooks.hook('request', (event) => {
console.log('Request:', event.url.pathname)
})
// Single response hook (replaces beforeResponse/afterResponse in v3)
nitroApp.hooks.hook('response', (response, { event }) => {
console.log('Sending response')
})
})Inside a Nitro plugin,
useServerHooks()fromnuxt/serverregisters renderer hooks (render:html) andNuxtServerHooks; Nitro's own hooks (request,response,error) come fromuseNitroHooks()innitro/app.
Common Nitro Hooks
| Hook | When |
|---|---|
request | Request received |
response | Before/around sending response (replaces beforeResponse/afterResponse) |
render:html | Before HTML is sent |
render:response | Before response is finalized |
error | Error occurred |
Nitro v3:
beforeResponse/afterResponseare merged intoresponse. The compatibility layer re-emits them fromresponsewhen active.
Custom Hooks
Define Custom Hook Types
// types/hooks.d.ts
import type { HookResult } from '@nuxt/schema'
declare module '#app' {
interface RuntimeNuxtHooks {
'my-app:event': (data: MyEventData) => HookResult
}
}
declare module '@nuxt/schema' {
interface NuxtHooks {
'my-module:init': () => HookResult
}
}
declare module 'nitro/types' {
interface NitroRuntimeHooks {
'my-server:event': (data: any) => void
}
}Nitro v3:
nitropackis renamed tonitro— augmentnitro/types(notnitropack/types).
Call Custom Hooks
// In a plugin
export default defineNuxtPlugin((nuxtApp) => {
// Call custom hook
nuxtApp.callHook('my-app:event', { type: 'custom' })
})
// In a module
export default defineNuxtModule({
setup(options, nuxt) {
nuxt.callHook('my-module:init')
},
})Nuxt 5:
callHookmay now returnvoid(not always aPromise), for performance. Alwaysawaitit instead of chaining.then()/.catch(). Restore the always-Promise behavior withexperimental.asyncCallHook: true.
useRuntimeHook
Call hooks at runtime from components:
<script setup lang="ts">
// Register a callback for a runtime hook
useRuntimeHook('app:error', (error) => {
console.error('App error:', error)
})
</script>Hook Examples
Page View Tracking
// plugins/analytics.client.ts
export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.hook('page:finish', () => {
const route = useRoute()
analytics.track('pageview', {
path: route.path,
title: document.title,
})
})
})Performance Monitoring
// plugins/performance.client.ts
export default defineNuxtPlugin((nuxtApp) => {
let navigationStart: number
nuxtApp.hook('page:start', () => {
navigationStart = performance.now()
})
nuxtApp.hook('page:finish', () => {
const duration = performance.now() - navigationStart
console.log(`Navigation took ${duration}ms`)
})
})Inject HTML
// server/plugins/inject.ts
import { definePlugin } from 'nitro'
export default definePlugin((nitroApp) => {
nitroApp.hooks.hook('render:html', (html) => {
html.head.push(`
<script>
window.APP_CONFIG = ${JSON.stringify(config)}
</script>
`)
})
})<!-- Source references: - https://nuxt.com/docs/guide/going-further/hooks - https://nuxt.com/docs/api/advanced/hooks - https://nuxt.com/docs/getting-started/upgrade#migration-to-nitro-v3 -->
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.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download nuxt.zip