Nuxt 4+ Development
Progressive guidance for Nuxt 4+ projects with latest patterns and conventions.
When to Use
Working with:
- Server routes (API endpoints, server middleware, server utils)
- File-based routing (pages, layouts, route groups)
- Nuxt middleware (route guards, navigation)
- Nuxt plugins (app extensions)
- Nuxt-specific features (auto-imports, layers, modules)
Available Guidance
Read specific files based on current work:
- references/server.md - API routes, server middleware, validation (Zod), WebSocket, SSE
- references/routing.md - File-based routing, route groups, typed router, definePage
- references/middleware-plugins.md - Route middleware, plugins, app lifecycle
- references/nuxt-composables.md - Nuxt composables (useRequestURL, useFetch, navigation)
- references/nuxt-components.md - NuxtLink, NuxtImg, NuxtTime (prefer over HTML elements)
- references/nuxt-config.md - Configuration, modules, auto-imports, layers
For Vue composables: See vue skill composables.md (VueUse, Composition API patterns)
For UI components: use nuxt-ui skill
For database/storage: use nuxthub skill
For content-driven sites: use nuxt-content skill
For creating modules: use nuxt-modules skill
For project scaffolding/CI: use personal-ts-setup skill
Usage Pattern
Progressive loading - only read what you need:
- Creating API endpoint? → references/server.md
- Setting up pages/routing? → references/routing.md
- Using composables/data fetching? → references/nuxt-composables.md
- Adding middleware/plugins? → references/middleware-plugins.md
- Configuring Nuxt? → references/nuxt-config.md
- Setting up CI/ESLint? → references/project-setup.md
DO NOT read all files at once. Load based on context:
- Working in
server/ → read server.md
- Working in
pages/ or layouts/ → read routing.md
- Using
useFetch, useRequestURL, navigation → read nuxt-composables.md
- Using
<a>, <img>, <time> elements → read nuxt-components.md
- Working in
middleware/ or plugins/ → read middleware-plugins.md
- Editing
nuxt.config.ts → read nuxt-config.md
Nuxt 4 vs Older Versions
You are working with Nuxt 4+. Key differences:
| Old (Nuxt 2/3) |
New (Nuxt 4) |
index.vue |
(descriptive-name).vue |
<Nuxt /> |
<NuxtPage /> |
context.params |
getRouterParam(event, 'name') |
window.origin |
useRequestURL().origin |
| String routes |
Typed router with route names |
| Separate layouts/ |
Parent routes with <slot> |
If you're unsure about Nuxt 4 patterns, read the relevant guidance file first.
Latest Documentation
When to fetch latest docs:
- New Nuxt 4 features not covered here
- Module-specific configuration
- Breaking changes or deprecations
- Advanced use cases
Official sources:
Token Efficiency
Main skill: ~300 tokens. Each sub-file: ~800-1500 tokens. Only load files relevant to current task.
1---2name: nuxt3description: Use when working on Nuxt 4+ projects - provides server routes, file-based routing, middleware patterns, Nuxt-specific composables, and configuration with latest docs. Covers h3 v1 helpers (validation, WebSocket, SSE) and nitropack v2 patterns.4license: MIT5---6
7# Nuxt 4+ Development
8
9Progressive guidance for Nuxt 4+ projects with latest patterns and conventions.
10
11## When to Use
12
13Working with:
14
15- Server routes (API endpoints, server middleware, server utils)
16- File-based routing (pages, layouts, route groups)
17- Nuxt middleware (route guards, navigation)
18- Nuxt plugins (app extensions)
19- Nuxt-specific features (auto-imports, layers, modules)
20
21## Available Guidance
22
23Read specific files based on current work:
24
25- **[references/server.md](references/server.md)** - API routes, server middleware, validation (Zod), WebSocket, SSE
26- **[references/routing.md](references/routing.md)** - File-based routing, route groups, typed router, definePage
27- **[references/middleware-plugins.md](references/middleware-plugins.md)** - Route middleware, plugins, app lifecycle
28- **[references/nuxt-composables.md](references/nuxt-composables.md)** - Nuxt composables (useRequestURL, useFetch, navigation)
29- **[references/nuxt-components.md](references/nuxt-components.md)** - NuxtLink, NuxtImg, NuxtTime (prefer over HTML elements)
30- **[references/nuxt-config.md](references/nuxt-config.md)** - Configuration, modules, auto-imports, layers
31
32**For Vue composables:** See `vue` skill composables.md (VueUse, Composition API patterns)
33**For UI components:** use `nuxt-ui` skill
34**For database/storage:** use `nuxthub` skill
35**For content-driven sites:** use `nuxt-content` skill
36**For creating modules:** use `nuxt-modules` skill
37**For project scaffolding/CI:** use `personal-ts-setup` skill
38
39## Usage Pattern
40
41**Progressive loading - only read what you need:**
42
43- Creating API endpoint? → [references/server.md](references/server.md)
44- Setting up pages/routing? → [references/routing.md](references/routing.md)
45- Using composables/data fetching? → [references/nuxt-composables.md](references/nuxt-composables.md)
46- Adding middleware/plugins? → [references/middleware-plugins.md](references/middleware-plugins.md)
47- Configuring Nuxt? → [references/nuxt-config.md](references/nuxt-config.md)
48- Setting up CI/ESLint? → [references/project-setup.md](references/project-setup.md)
49
50**DO NOT read all files at once.** Load based on context:
51
52- Working in `server/` → read server.md
53- Working in `pages/` or `layouts/` → read routing.md
54- Using `useFetch`, `useRequestURL`, navigation → read nuxt-composables.md
55- Using `<a>`, `<img>`, `<time>` elements → read nuxt-components.md
56- Working in `middleware/` or `plugins/` → read middleware-plugins.md
57- Editing `nuxt.config.ts` → read nuxt-config.md
58
59## Nuxt 4 vs Older Versions
60
61**You are working with Nuxt 4+.** Key differences:
62
63| Old (Nuxt 2/3) | New (Nuxt 4) |
64| ----------------- | ------------------------------- |
65| `index.vue` | `(descriptive-name).vue` |
66| `<Nuxt />` | `<NuxtPage />` |
67| `context.params` | `getRouterParam(event, 'name')` |
68| `window.origin` | `useRequestURL().origin` |
69| String routes | Typed router with route names |
70| Separate layouts/ | Parent routes with `<slot>` |
71
72**If you're unsure about Nuxt 4 patterns, read the relevant guidance file first.**
73
74## Latest Documentation
75
76**When to fetch latest docs:**
77
78- New Nuxt 4 features not covered here
79- Module-specific configuration
80- Breaking changes or deprecations
81- Advanced use cases
82
83**Official sources:**
84
85- Nuxt: https://nuxt.com/docs
86- h3 (server engine): https://v1.h3.dev/
87- Nitro: https://nitro.build/
88
89## Token Efficiency
90
91Main skill: ~300 tokens. Each sub-file: ~800-1500 tokens. Only load files relevant to current task.