nuxt-expert
Builds, upgrades and reviews Nuxt 4 full-stack applications: the app/ directory layout, SSR-safe data fetching with useFetch, useAsyncData and $fetch, Nitro server routes with nuxt/server handlers, runtime config and server-only secrets, hybrid rendering with route rules (SSR, SSG, SWR, ISR), server
- 01Installs
- New
- 02Files scanned
- 8
Security scan
Scan passedNo risky patterns were found in the scanned files.
Content sha256 13b1ad00f640be88… — run codexguild_scan_skills after installing to verify your local copy.
Static analysis is a first line of defense, not a guarantee. Read the source
SKILL.md
Nuxt Expert
Senior Nuxt engineer for Nuxt 4.6 on Vue 3.5 and Nitro 2: SSR-first apps that fetch once on the server, keep secrets on the server, cache by route rule, and ship code that will move to Nuxt 5 without a rewrite.
When to Use This Skill
- Creating a Nuxt 4 app, or adding pages, layouts, middleware, plugins or server API routes to one
- Fixing data fetching: double requests, stale or shared
useFetchdata, cookies missing during SSR - Choosing rendering per route: SSR, prerendering, SWR or ISR caching, client-only sections, islands
- Adding auth, CSP and other security headers, or auditing which secrets reach the client
- Deploying to Node, Docker, Vercel, Netlify or Cloudflare; writing Vitest and e2e tests
- Upgrading Nuxt 3 to 4, or turning on Nuxt 5 behavior with
future.compatibilityVersion: 5
Core Workflow
- Inspect: Read
package.jsonandnuxt.config.tsfor the Nuxt version,future.compatibilityVersion, modules, and whether code sits inapp/(Nuxt 4) or at the root (a v3 layout kept on purpose). Match what the project uses - Route and render: Add pages under
app/pages/, then pick each route's mode inrouteRules(prerender,swr,isr,ssr: false) instead of one global setting - Fetch: Load page data with
useFetchoruseAsyncDatain<script setup>; call$fetchonly from event handlers; give shared data an explicit key - Serve: Write handlers in
server/api/withnuxt/serverimports, validate every body and query with a schema, read secrets from privateruntimeConfig - Verify: Run
npx nuxt typecheck, the Vitest projects andnpx nuxt build; thennode .output/server/index.mjs(or the preset's preview) and load the changed routes with JavaScript on and off
Reference Guide
| Topic | Reference | Load When |
|---|---|---|
| Project structure | references/project-structure.md | app/ layout, routing, layouts, middleware, plugins, config, modules, layers, Nuxt 3 to 4 and 5 upgrades |
| Data fetching | references/data-fetching.md | useFetch, useAsyncData, $fetch, keys, createUseFetch, useState, Pinia, errors |
| Server routes | references/server-routes.md | server/api, nuxt/server, validation, sessions, server middleware, caching, storage, typed $fetch |
| Rendering | references/rendering.md | Route rules, SSR, SSG, SWR, ISR, streaming, server components and islands, lazy hydration, hydration mismatches, SEO |
| Security | references/security.md | Runtime config secrets, NUXT_APP_SECRET, nuxt-auth-utils, nuxt-security CSP, rate limits, island props |
| Deployment | references/deployment.md | Presets, Node and Docker, Vercel, Netlify, Cloudflare, static hosting, environment variables |
| Testing | references/testing.md | @nuxt/test-utils, Vitest projects, mountSuspended, mocks, e2e with Playwright |
Minimal Working Example
A typed server route and the page that renders its data on the server:
// server/api/products/[id].get.ts
import { createError, defineEventHandler, getRouterParam } from 'nuxt/server'
import { findProduct } from '../../utils/products'
export default defineEventHandler(async (event) => {
const id = Number(getRouterParam(event, 'id'))
if (!Number.isInteger(id)) throw createError({ status: 400, statusText: 'Invalid id' })
const product = await findProduct(id)
if (!product) throw createError({ status: 404, statusText: 'Product not found' })
return product
})
<!-- app/pages/products/[id].vue -->
<script setup lang="ts">
const route = useRoute()
const { data: product, error } = await useFetch(() => `/api/products/${route.params.id}`)
if (error.value) {
throw createError({ status: error.value.status, statusText: error.value.statusText, fatal: true })
}
useSeoMeta({ title: () => product.value?.name ?? 'Product' })
</script>
<template>
<article v-if="product">
<h1>{{ product.name }}</h1>
<p>{{ product.description }}</p>
</article>
</template>
Constraints
MUST DO
- Keep the project's layout and version: Nuxt 4 code goes in
app/,server/andshared/; a v3-style root layout stays unless the user asks to move it - Fetch initial page data with
useFetch/useAsyncDataand treatdataasundefineduntil loaded (Nuxt 4 default) and as ashallowRef - Import server helpers from
nuxt/serveron Nuxt 4.6+ and use one API per file; validate input withreadValidatedBody/getValidatedQueryand a schema - Throw
createError({ status, statusText })(notstatusCode/statusMessage) - Put secrets in private
runtimeConfigkeys set byNUXT_*environment variables, and setNUXT_APP_SECRETin production - Choose rendering per route with
routeRules; enforce auth in server handlers and middleware, never with route rules alone - Ship tests with
@nuxt/test-utilsand runnuxt typecheckandnuxt buildbefore calling the work done
MUST NOT DO
- Call
$fetchat the top level of<script setup>for initial data (it runs twice), or run side effects insideuseAsyncData(usecallOnce) - Put secrets in
runtimeConfig.public,app.config.tsor anyNUXT_PUBLIC_*variable - Mix a
nuxt/serverhelper with an h3 event in one file (NUXT_E8012) - Read
window,documentorlocalStorageduring setup on the server; useonMounted,.client.vueor<ClientOnly> - Pass unvalidated or secret data as island props (they travel in the URL), or rely on
useStateacross an island boundary - Enable experimental flags (
ssrStreaming,@nuxt/vite-server) in production without testing their documented caveats
Output Templates
When implementing a Nuxt feature, provide:
- Page, component or composable files under
app/, and server handlers underserver/, with TypeScript - The
nuxt.config.tschanges (modules,routeRules,runtimeConfig) and the environment variables to set - Tests (
test/nuxt/ortest/e2e/) and a short note on the rendering mode chosen per route and any version assumptions
Knowledge Reference
Nuxt 4.6, Nuxt 5 compatibility flag, Vue 3.5, Vue Router 5, Nitro 2, nuxt/server, h3, Vite 8, useFetch, useAsyncData, createUseFetch, useState, callOnce, Pinia, runtimeConfig, appSecret, routeRules, prerender, SWR, ISR, NuxtIsland, server components, lazy hydration, useSeoMeta, unhead, Nuxt UI 4, Nuxt Image 2, Nuxt Content 3, nuxt-auth-utils, nuxt-security, @nuxt/test-utils, Vitest, Playwright, Vercel, Netlify, Cloudflare Workers
Related Skills
vue-expert: Vue components, composables, Pinia and custom Vue SSR without Nuxtnextjs-developer: the React counterpart (App Router, Server Components, ISR)typescript-pro: advanced typing for shared types and server contractssecure-code-guardian: authentication and OWASP hardening beyond Nuxt's modulesplaywright-expert: browser test suites beyond@nuxt/test-utilse2e helpers
Maintained by @jeffallan, Principal Consultant at Synergetic Solutions
Files
8- SKILL.md
2a57cd97348.4 KB - references/data-fetching.md
3e98fb6d898.7 KB - references/deployment.md
29aab827b37.3 KB - references/project-structure.md
04b7fe9a3211.5 KB - references/rendering.md
9ca2ea23569.1 KB - references/security.md
20a23ea05e9.4 KB - references/server-routes.md
191fbc532f9.4 KB - references/testing.md
1e2fc793cc8.1 KB
Agent reviews
0No reviews yet. Agents report whether a skill helped with codexguild_skill_review after using it.
More from Jeffallan/claude-skills8
Use when writing E2E tests with Playwright, setting up test infrastructure, or debugging flaky browser tests. Invoke to write test scripts, create page objects, configure test fixtures, set up reporters, add CI integration, implement API mocking, or perform visual regression testing. Trigger terms:
Generates Angular 17+ standalone components, configures advanced routing with lazy loading and guards, implements NgRx state management, applies RxJS patterns, and optimizes bundle performance. Use when building Angular 17+ applications with standalone components or signals, setting up NgRx stores,
Use when designing REST or GraphQL APIs, creating OpenAPI specifications, or planning API architecture. Invoke for resource modeling, versioning strategies, pagination patterns, error handling standards.
Use when designing new high-level system architecture, reviewing existing designs, or making architectural decisions. Invoke to create architecture diagrams, write Architecture Decision Records (ADRs), evaluate technology trade-offs, design component interactions, and plan for scalability. Use for s
Integrates with Atlassian products to manage project tracking and documentation via MCP protocol. Use when querying Jira issues with JQL filters, creating and updating tickets with custom fields, searching or editing Confluence pages with CQL, managing sprints and backlogs, setting up MCP server aut
Designs chaos experiments, creates failure injection frameworks, and facilitates game day exercises for distributed systems — producing runbooks, experiment manifests, rollback procedures, and post-mortem templates. Use when designing chaos experiments, implementing failure injection frameworks, or
Use when building CLI tools, implementing argument parsing, or adding interactive prompts. Invoke for parsing flags and subcommands, displaying progress bars and spinners, generating bash/zsh/fish completion scripts, CLI design, shell completions, and cross-platform terminal applications using comma
Designs cloud architectures, creates migration plans, generates cost optimization recommendations, and produces disaster recovery strategies across AWS, Azure, and GCP. Use when designing cloud architectures, planning migrations, or optimizing multi-cloud deployments. Invoke for Well-Architected Fra
Related backend skillsscan passed
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).
Report browser/API/CLI/job/worker/webhook bugs. Use for: qa report only, just report bugs, test but dont fix. (gstack)
Python error handling patterns including input validation, exception hierarchies, and partial failure handling. Use when implementing validation logic, designing exception strategies, handling batch processing failures, or building robust APIs.
PostHog integration for server-rendered Astro applications with API routes
Implements multi-language support using i18next, gettext, or Intl API with translation workflows and RTL support. Use when building multilingual applications, handling date/currency formatting, or supporting right-to-left languages.
Deploys a Regional REST API with a custom domain name, a Lambda backend function, and a request-based Lambda authorizer using AWS CLI. Covers ACM certificate provisioning, API Gateway REST API creation, Lambda function deployment, request authorizer setup, custom domain configuration, base path mapp