nextjs-data-fetching

Fetch, cache, and revalidate data for Next.js routes.

9|1|Updated Jun 16, 2026
One-click install
npx skills add https://github.com/AratKruglik/antigravity-sdlc --skill nextjs-data-fetching-aratkruglik
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nextjs-data-fetching
Source: https://github.com/AratKruglik/antigravity-sdlc/tree/main/plugins/nextjs-plugin/skills/nextjs-data-fetching
Command: npx skills add https://github.com/AratKruglik/antigravity-sdlc --skill nextjs-data-fetching-aratkruglik

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Fetch, cache, and revalidate data for Next.js routes.

Core Features & Use Cases

  • Rendering modes: SSG, ISR, SSR, and RSC with appropriate fetch options.
  • Native fetch extensions and utilities: unstable_cache, generateStaticParams, and Route Handlers for both pages and API endpoints.
  • Use cases include building fast, data-driven pages and APIs with correct caching and revalidation strategies.

Quick Start

Fetch data in a Next.js page and apply a revalidation strategy to keep content fresh.

Frequently Asked Questions about nextjs-data-fetching

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

FAQPage Schema
How do I configure data fetching and caching for Next.js route handlers?

Next.js route handlers support data fetching and caching through native fetch extensions and route exports. Applying correct fetch options and revalidation strategies ensures data consistency and high performance for API endpoints.

What is the best way to revalidate cached data when using Next.js SSG and ISR?

To revalidate cached data in SSG and ISR, apply specific fetch options and route exports to enforce revalidation strategies. This keeps static and incrementally generated pages fresh without rebuilding the entire application.

When should I use unstable_cache versus native fetch extensions in Next.js?

Use unstable_cache when you need to cache data outside of the standard fetch extension lifecycle. Native fetch extensions handle standard route-level caching, while unstable_cache provides flexibility for third-party APIs or database queries.

Does this approach to data fetching work with React Server Components (RSC)?

Yes, the data fetching approach fully supports React Server Components (RSC). It applies appropriate rendering modes and fetch options to ensure RSC routes correctly fetch, cache, and revalidate data for optimal server-side rendering.

How do I use generateStaticParams to pre-render dynamic routes with cached data?

Use generateStaticParams to define dynamic route segments at build time. By combining it with correct fetch options and caching strategies, you can statically generate pages with pre-fetched, cached data for fast loading.

Why are my Next.js fetch requests not caching data correctly?

Incorrect fetch caching usually occurs when fetch options lack explicit caching or revalidation configurations. Enforcing correct route exports and revalidation strategies ensures that Next.js routes fetch, cache, and revalidate data properly.