nuxt4-patterns

Optimize Nuxt 4 SSR data fetching with useFetch and useAsyncData.

2|Updated Apr 14, 2026
One-click install
npx skills add https://github.com/klu-dev/porting-ecc-to-vscode --skill nuxt4-patterns-klu-dev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nuxt4-patterns
Source: https://github.com/klu-dev/porting-ecc-to-vscode/tree/main/.github/skills/nuxt4-patterns
Command: npx skills add https://github.com/klu-dev/porting-ecc-to-vscode --skill nuxt4-patterns-klu-dev

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill addresses common issues in Nuxt 4 app development, including hydration mismatches, route-level rendering decisions, and data fetching strategies.

Core Features & Use Cases

  • Hydration Safety: Ensures first renders are deterministic and client-server state aligns.
  • Data Fetching: Utilizes useFetch and useAsyncData for SSR-safe data handling.
  • Route Rules: Defines caching and rendering strategies with routeRules.
  • Performance Optimization: Implements lazy loading and hydration for non-critical UI elements.
  • Use Case: When developing a Nuxt 4 app with SSR and hybrid rendering, this Skill helps prevent common errors and improve app performance.

Quick Start

Activate the nuxt4-patterns skill to ensure your Nuxt 4 app's data fetching is SSR-safe and optimize your route rules for better performance.

Frequently Asked Questions about nuxt4-patterns

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

FAQPage Schema
How do I fix hydration mismatches in my Nuxt 4 SSR application?

To fix hydration mismatches in Nuxt 4, ensure first renders are deterministic and client-server state aligns properly. Implementing safe hydration patterns prevents common server-side rendering errors.

What is the best way to optimize data fetching for SSR in Nuxt 4?

Optimizing data fetching for SSR in Nuxt 4 is best achieved by utilizing useFetch and useAsyncData. These composables ensure SSR-safe data handling and prevent hydration issues during server-side rendering.

How do I configure route rules for caching in a Nuxt 4 application?

Configuring route rules for caching in Nuxt 4 involves defining rendering and caching strategies within the routeRules configuration. This approach optimizes route-level rendering decisions for hybrid rendering.

Can I use lazy loading to improve Nuxt 4 app performance?

Yes, you can use lazy loading to improve Nuxt 4 app performance. It works by implementing lazy loading and hydration specifically for non-critical UI elements, which enhances overall application speed.

Does Nuxt 4 support hybrid rendering and how do I implement it safely?

Nuxt 4 supports hybrid rendering by combining route rules with SSR-safe data fetching. Implementing it safely requires using useFetch or useAsyncData and ensuring deterministic initial renders to avoid mismatches.