技能创建器
skill-creator
创建、改进和评估自定义技能,把专业流程转化为可重复使用的 AI 能力。
nextjs-data-fetching【数据与研究】Implement Fetch API, Caching, and Revalidation strategies in Next.js. Use when fetching data, configuring cache behavior, or implementing revalidation in Next.js.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
[!WARNING] Covers App Router
fetchonly. Forpages/directory: usegetServerSideProps/getStaticProps. Ignore nativefetchcaching advice below.
Fetch data directly in Server Components using async/await.
fetch(url, { cache: 'force-cache' }).fetch(url, { cache: 'no-store' }) or cookies().fetch(url, { next: { revalidate: 60 } }).export default async function Page() { const user = await db.user.findUnique({ where: { id }, select: { id: true, name: true } }); }Promise.all() to prevent waterfalls.revalidatePath('/path') - Purge cache for route.revalidateTag('key') - Purge by tag.<Suspense> to avoid blocking.useEffect for data fetching: Use SWR or React Query for client-side data.When this skill applies, preserve the following domain terminology or equivalent concrete examples in the answer when relevant: