nextjs-best-practices

Guides Next.js App Router development with Server Components, data fetching, and routing patterns.

1|Updated Aug 17, 2025
One-click install
npx skills add https://github.com/ratnesh-maurya/mdconverter --skill nextjs-best-practices-ratnesh-maurya
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nextjs-best-practices
Source: https://github.com/ratnesh-maurya/mdconverter/tree/main/.claude/skills/nextjs-best-practices
Command: npx skills add https://github.com/ratnesh-maurya/mdconverter --skill nextjs-best-practices-ratnesh-maurya

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Developers building Next.js applications often struggle with deciding between Server and Client Components, choosing the right data fetching strategy, and structuring routes correctly, leading to bloated client bundles and poor performance. ## Core Features & Use Cases - Component Architecture Guidance: Decision trees and tables for choosing Server vs Client Components based on interactivity and data needs. - Data Fetching & Caching Patterns: Reference tables covering static rendering, ISR revalidation, no-store dynamic fetching, and cache layer control. - Routing & Project Structure: Conventions for page.tsx, layout.tsx, loading.tsx, error.tsx, route groups, parallel routes, and API route handlers. - Use Case: When building a dashboard page, consult this Skill to structure a Server Component parent that fetches data directly, with Client Component children only for interactive widgets, plus proper loading and error boundaries. ## Quick Start Review my Next.js page component and tell me whether it should be a Server or Client Component with the right data fetching pattern.

Frequently Asked Questions about nextjs-best-practices

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

FAQPage Schema
How do I decide between Server and Client Components in Next.js?

Use Server Components by default for data fetching, layouts, and static content. Add 'use client' only when you need useState, useEffect, or event handlers. For mixed needs, split into a Server parent with Client children.

What data fetching strategy should I use in Next.js App Router?

Default fetch is cached at build time for static content. Use the revalidate option for ISR time-based refresh, or no-store for dynamic per-request data. Fetch in Server Components rather than client-side.

How do Next.js route groups and parallel routes work?

Route groups using (name) organize files without affecting the URL path. Parallel routes using @slot render multiple pages in the same layout, while intercepting routes with (.) enable modal overlays.

When should I use Server Actions in Next.js?

Use Server Actions for form submissions, data mutations, and revalidation triggers. Mark functions with 'use server', validate all inputs with tools like Zod, return typed responses, and handle errors gracefully.

What are common Next.js App Router anti-patterns to avoid?

Avoid adding 'use client' everywhere, fetching data in client components, skipping loading.tsx and error.tsx boundaries, and shipping large client bundles. Start with Server Components and use dynamic imports for heavy components.