nuxt

Provide Nuxt 4+ guidance for server routes, routing, middleware, and composables.

697|35|Updated Dec 11, 2025
One-click install
npx skills add https://github.com/onmax/nuxt-skills --skill nuxt-onmax
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nuxt
Source: https://github.com/onmax/nuxt-skills/tree/main/skills/nuxt
Command: npx skills add https://github.com/onmax/nuxt-skills --skill nuxt-onmax

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Nuxt 4+ development can be complex with rapidly evolving patterns and conventions. This Skill provides up-to-date guidance, best practices, and common pitfalls to help developers build robust applications efficiently, reducing time spent on documentation lookup and debugging.

Core Features & Use Cases

  • Progressive Guidance: Access specific, up-to-date documentation on server routes, file-based routing, middleware, plugins, and Nuxt-specific composables.
  • Best Practices & Conventions: Learn and apply the latest Nuxt 4+ patterns, avoiding outdated approaches and common mistakes.
  • Use Case: When implementing a new API endpoint, quickly get guidance on defineEventHandler and getRouterParam with code examples, ensuring you follow the latest Nuxt 4+ server patterns.

Quick Start

I am working on a Nuxt 4+ project. I need to create a new API endpoint in the server/api/ directory. Provide me with the best practices and code examples for defining a GET endpoint with a dynamic parameter.

Frequently Asked Questions about nuxt

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create API endpoints in Nuxt 4+ with server routes?

Server routes in Nuxt 4+ use the `server/api/` directory with `defineEventHandler` to define endpoints. Each file automatically becomes a route; use `getRouterParam` to access dynamic parameters and follow the latest Nuxt 4+ patterns for type-safe, SSR-compatible handlers.

What's the best way to set up file-based routing in Nuxt 4+?

File-based routing in Nuxt 4+ uses directory structure in `pages/` to automatically generate routes. Nuxt processes files and nested folders into a route tree; use dynamic segments with brackets (e.g., `[id].vue`) for parameters, leveraging auto-imports and latest conventions for cleaner code.

How do I implement middleware and plugins in Nuxt 4+?

Middleware in Nuxt 4+ lives in the `middleware/` directory and runs before route rendering; plugins in `plugins/` initialize app-wide utilities. Define middleware with `defineRouteMiddleware`, use plugins with `defineNuxtPlugin`, and apply them via `middleware` metadata or auto-registration following current best practices.

Can I use WebSocket and Server-Sent Events in Nuxt 4+ server routes?

Nuxt 4+ server routes support both WebSocket and SSE through Nitro handlers. Define WebSocket handlers with `websocket` event support and SSE with response streaming; both integrate with the Nitro backend configuration, enabling real-time communication patterns in Nuxt applications.

What are Nuxt-specific composables and how do I use them?

Nuxt-specific composables like `useRouter`, `useRoute`, `useState`, and `useFetch` provide framework-integrated utilities for navigation, state, and data fetching. Auto-imported by default, they ensure type-safe, SSR-compatible reactive behavior aligned with Nuxt 4+ patterns and conventions.

How do I configure Nuxt 4+ and Nitro settings correctly?

Configure Nuxt 4+ via `nuxt.config.ts` and Nitro via `nitro.config.ts` or nested `nitro` options. Set up server routes, middleware, plugins, auto-imports, and deployment targets; latest patterns include type-safe schemas and environment-specific configurations for production-ready applications.