nuxt4-patterns
Nuxt 4 app patterns for hydration safety, performance, route rules, lazy loading, and SSR-safe data fetching with useFetch and useAsyncData.
Security Assessment
About nuxt4-patterns
The nuxt4-patterns skill provides guidance and implementation patterns for building and debugging Nuxt 4 applications with a focus on SSR safety, hydration consistency, rendering strategies, and application performance. It helps developers avoid common issues such as hydration mismatches caused by non-deterministic rendering, browser-only APIs, or route state differences between server and client environments. The skill also outlines best practices for route-level rendering decisions, SSR-safe data fetching, and client/server execution boundaries in hybrid-rendered Nuxt applications.
The skill covers several core areas of Nuxt 4 development, including hydration safety techniques, SSR-aware data fetching with `useFetch` and `useAsyncData`, route rules configuration in `nuxt.config.ts`, and lazy loading strategies for performance optimization. It explains when to use composables such as `useFetch`, `useAsyncData`, and `$fetch`, how to structure cache-safe async handlers, and how to reduce payload size through shallow data handling and selective payload fields. It also includes route rule strategies such as prerendering, stale-while-revalidate (SWR), incremental static regeneration (ISR), and client-rendered routes with `ssr: false`. Additional performance guidance includes lazy component imports, conditional rendering, and lazy hydration patterns.
This skill is intended for frontend developers, Nuxt engineers, and teams working on SSR or hybrid-rendered Vue applications. It is especially useful when optimizing SEO-sensitive pages, debugging server/client rendering inconsistencies, configuring rendering behavior per route group, or improving application responsiveness through lazy loading and hydration control. The guidance applies to applications with marketing pages, product catalogs, dashboards, APIs, and other mixed rendering requirements.
FAQ
When should I use this skill?
Use this skill when building or debugging Nuxt 4 applications that involve SSR, hydration mismatches, route rules, lazy loading, or data fetching with `useFetch` and `useAsyncData`.
What data fetching patterns does this skill recommend?
The skill recommends `useFetch` for SSR-safe API reads and `useAsyncData` for custom async workflows or multiple async sources. It advises using `$fetch` primarily for client-triggered actions or writes rather than top-level SSR page data.
Does this skill support hybrid rendering strategies?
Yes. The skill includes guidance for route-level rendering strategies such as prerendering, SWR, ISR, and client-rendered routes using `routeRules` in `nuxt.config.ts`.
How does the skill help prevent hydration mismatches?
It provides recommendations for deterministic SSR rendering, avoiding browser-only APIs during server rendering, using `onMounted()` and `ClientOnly`, and preventing client-only route state such as URL fragments from affecting SSR-rendered markup.
Are there performance optimization recommendations included?
Yes. The skill includes patterns for lazy loading components, lazy hydration, route-based code splitting, conditional rendering with `v-if`, and reducing payload size through selective data handling.
Install nuxt4-patterns
Quick Setup:
- Copy the skill folder to
.claude/skills/ - Claude will automatically detect and use the skill
Repository
affaan-m/everything-claude-code