Next.js data fetching - Server actions, caching, revalidation
npx playbooks add skill pluginagentmarketplace/custom-plugin-nextjs --skill data-fetching
Modern data fetching in Next.js with server actions, caching strategies, and revalidation.
// Server Action
'use server'
export async function createPost(formData: FormData) {
const title = formData.get('title')
await db.posts.create({ title })
revalidatePath('/posts')
}
// Data fetching with caching
async function getData() {
const res = await fetch('https://api.example.com/data', {
next: { revalidate: 3600 } // Revalidate every hour
})
return res.json()
}
cache: 'force-cache' - Default, cachedcache: 'no-store' - No cachingnext: { revalidate: N } - Revalidate after N secondsWeekly roundup of top Claude Code skills, MCP servers, and AI coding tips.