npx skills add ...
npx skills add giuseppe-trisciuoglio/developer-kit --skill nextjs-data-fetching
Provides Next.js App Router data fetching patterns including SWR and React Query integration, parallel data fetching, Incremental Static Regeneration (ISR), revalidation strategies, and error boundaries. Use when implementing data fetching in Next.js applications, choosing between server and client fetching, setting up caching strategies, or handling loading and error states.
npx skills add giuseppe-trisciuoglio/developer-kit --skill nextjs-data-fetching
Provides patterns for data fetching in Next.js App Router: server-side fetching, SWR/React Query integration, ISR, revalidation, error boundaries, and loading states.
Fetch directly in async Server Components:
Use Promise.all() for independent requests:
Tag data for selective revalidation:
Install: npm install swr
Install: npm install @tanstack/react-query
See react-query.md for mutations, optimistic updates, infinite queries, and advanced patterns.
Wrap client-side data fetching in Error Boundaries to handle failures gracefully:
See error-boundaries.md for full ErrorBoundary implementations (basic, with reset callback) and usage examples with data fetching.
Use Server Actions for mutations with cache revalidation:
See server-actions.md for complete examples including form validation with useActionState, error handling, and cache invalidation.
Promise.all() for independent requests to reduce latencycache: 'no-store'loading.tsx or Suspense boundariesuseState, useEffect) or client data fetching libraries'use client' directivefetch API in Next.js extends standard Web fetch with Next.js-specific caching options'use server' and can only be called from Client Components or form actionsforce-cache for user-specific or personalized dataInput: Create a blog page that fetches posts and updates every hour.
Output: Page statically generated at build time, revalidated every hour.
Input: Build a dashboard showing user profile, stats, and recent activity in parallel.
Output: All three requests execute concurrently, minimizing total load time.