affaan-m avatar

Nuxt4 Patterns

A focused guide for keeping Nuxt 4 server and client rendering in sync. Covers the classic hydration footguns like Date.now() in templates, using the wrong route composable, and treating ssr: false as a first resort. The data fetching section is practical: when to pick useFetch over useAsyncData, how to handle lazy loads without breaking SEO, and why your async handlers need stable keys. Route rules get a clean explainer on prerender versus swr versus isr. The lazy loading advice is refreshingly pragmatic: Nuxt already code splits by route, so don't chase component splits until you need them. Use this when hydration errors are eating your day or you're setting up rendering strategy for a new app.

skills.sh installs
5.5K
GitHub stars
300.3K
last updated
Aug 21, 2026

Install

$ npx -y skills add affaan-m/ecc --skill nuxt4-patterns --agent claude-code

Installs into .claude/skills of the current project.

Files

Nuxt 4 Patterns

Use when building or debugging Nuxt 4 apps with SSR, hybrid rendering, route rules, or page-level data fetching.

When to Activate

  • Hydration mismatches between server HTML and client state
  • Route-level rendering decisions such as prerender, SWR, ISR, or client-only sections
  • Performance work around lazy loading, lazy hydration, or payload size
  • Page or component data fetching with useFetch, useAsyncData, or $fetch
  • Nuxt routing issues tied to route params, middleware, or SSR/client differences

Hydration Safety

  • Keep the first render deterministic. Do not put Date.now(), Math.random(), browser-only APIs, or storage reads directly into SSR-rendered template state.
  • Move browser-only logic behind onMounted(), import.meta.client, ClientOnly, or a .client.vue component when the server cannot produce the same markup.
  • Use Nuxt's useRoute() composable, not the one from vue-router.
  • Do not use route.fullPath to drive SSR-rendered markup. URL fragments are client-only, which can create hydration mismatches.
  • Treat ssr: false as an escape hatch for truly browser-only areas, not a default fix for mismatches.

Data Fetching

Sponsors

Details

Repository
github.com/affaan-m/ecc
Categories
Frontend Development, Debugging
First seen
Jul 14, 2026

More from affaan-m/ecc

All 263
1web-infra-dev avatarbrowser-automationweb-infra-dev/midscene-skillsVision-driven browser automation using Midscene. Operates from screenshots — no DOM or accessibility labels needed. Runs in headless Puppeteer — does NOT take o5.4Kskills.sh installs
2samber avatarcrxjssamber/cc-skillsCRXJS Chrome extension development — true HMR for popup, options, content scripts, side panels, manifest-driven builds, dynamic content script imports (`?script5.1Kskills.sh installs
3medusajs avatarstorefront-best-practicesmedusajs/medusa-agent-skillsALWAYS use this skill when working on ecommerce storefronts, online stores, shopping sites. Use for ANY storefront component including checkout pages, cart, pay5Kskills.sh installs
4composiohq avatarartifacts-buildercomposiohq/awesome-claude-skillsSuite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use for4.8Kskills.sh installs
5tw93 avataruitw93/wazaProduces distinctive, production-grade UI for pages, components, visual interfaces, typography, and screenshot-driven polish. Use when users ask in any language4.7Kskills.sh installs
6grafana avatarapp-observabilitygrafana/skillsGet RED metrics + service maps + frontend RUM + AI/LLM monitoring out of Grafana Cloud — Application Observability (`traces_spanmetrics_*` from OTel traces, p504.7Kskills.sh installs