Use when next.js data fetching patterns including SSG, SSR, and ISR. Use when building data-driven Next.js applications.
View on GitHubTheBushidoCollective/han
jutsu-nextjs
January 24, 2026
Select agents to install to:
npx add-skill https://github.com/TheBushidoCollective/han/blob/main/jutsu/jutsu-nextjs/skills/nextjs-data-fetching/SKILL.md -a claude-code --skill nextjs-data-fetchingInstallation paths:
.claude/skills/nextjs-data-fetching/# Next.js Data Fetching
Master data fetching in Next.js with static generation, server-side
rendering, and incremental static regeneration.
## Fetch with Caching Strategies
```typescript
// Default: 'force-cache' (similar to SSG)
export default async function Page() {
const data = await fetch('https://api.example.com/data');
const json = await data.json();
return <div>{json.title}</div>;
}
// No caching: 'no-store' (similar to SSR)
export default async function DynamicPage() {
const data = await fetch('https://api.example.com/data', {
cache: 'no-store'
});
const json = await data.json();
return <div>{json.title}</div>;
}
// Revalidate every 60 seconds (ISR)
export default async function RevalidatedPage() {
const data = await fetch('https://api.example.com/data', {
next: { revalidate: 60 }
});
const json = await data.json();
return <div>{json.title}</div>;
}
// Per-route caching config
export const revalidate = 3600; // Revalidate every hour
export default async function Page() {
const data = await fetch('https://api.example.com/data');
return <div>{data.title}</div>;
}
// Dynamic rendering
export const dynamic = 'force-dynamic'; // Equivalent to cache: 'no-store'
export const dynamic = 'force-static'; // Equivalent to cache: 'force-cache'
export const dynamic = 'error'; // Error if dynamic functions used
export const dynamic = 'auto'; // Default behavior
```
## Static Generation with generateStaticParams
```typescript
// app/posts/[id]/page.tsx
interface Post {
id: string;
title: string;
content: string;
}
// Generate static paths at build time
export async function generateStaticParams() {
const posts = await fetch('https://api.example.com/posts').then(r => r.json());
return posts.map((post: Post) => ({
id: post.id.toString()
}));
}
export default async function Post({ params }: { params: { id: string } }) {
const post = await fetch(`https://api.example.com/posts/${params.id}`, {