Nuxt
Installation
SKILL.md
Nuxt 3 Patterns
Data Fetching
useFetchdeduplicates and caches requests during SSR — use it in components, not$fetchwhich fetches twice (server + client)$fetchis for event handlers and server routes only — in<script setup>it causes hydration mismatchesuseFetchruns on server during SSR — checkprocess.serverif you need client-only data- Add
keyoption touseFetchwhen URL params change but path stays same — without it, cache returns stale data useLazyFetchdoesn't block navigation — use for non-critical data, but handle the pending state
Hydration Traps
Date.now()orMath.random()in templates cause hydration mismatches — compute once in setup or use<ClientOnly>- Browser-only APIs (localStorage, window) crash SSR — wrap in
onMountedorprocess.clientcheck - Conditional rendering based on client-only state mismatches — use
<ClientOnly>component with fallback v-ifwith async data shows flash of wrong content — usev-showor skeleton states instead