nextjs-best-practices

Guide Next.js App Router development with component, data fetching, and routing best practices.

Updated Feb 6, 2026
One-click install
npx skills add https://github.com/Andrejr82/Caculinha_BI --skill nextjs-best-practices-andrejr82
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nextjs-best-practices
Source: https://github.com/Andrejr82/Caculinha_BI/tree/main/.agent/skills/nextjs-best-practices
Command: npx skills add https://github.com/Andrejr82/Caculinha_BI --skill nextjs-best-practices-andrejr82

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a comprehensive guide to implementing Next.js App Router effectively, ensuring developers follow best practices for performance, maintainability, and scalability.

Core Features & Use Cases

  • Server vs. Client Components: Understand when and how to use each component type.
  • Data Fetching Strategies: Learn about default, revalidate, and no-store patterns.
  • Routing Conventions: Master file-based routing, route groups, and parallel routes.
  • API Routes: Implement efficient backend logic with Route Handlers.
  • Performance Optimization: Optimize images and bundles for faster load times.
  • Metadata Management: Configure static and dynamic metadata for SEO.
  • Caching Strategies: Understand request, data, and route-level caching.
  • Server Actions: Implement secure data mutations and form handling.
  • Anti-Patterns: Avoid common pitfalls in Next.js development.

Quick Start

Explain the difference between Server Components and Client Components in Next.js.

Frequently Asked Questions about nextjs-best-practices

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

FAQPage Schema
When should I use Server Components versus Client Components in Next.js App Router?

Server Components fetch data and render on the server, while Client Components handle interactivity. Use Server Components by default to optimize performance, only adding the client directive when you need state or browser APIs.

How do I implement data fetching strategies with Next.js App Router?

Next.js data fetching supports default caching, revalidation, and no-store patterns. Choose default for static content, revalidate for periodic updates, and no-store for dynamic data to control caching behavior.

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

Common Next.js anti-patterns include overusing Client Components, improper data fetching placement, and ignoring route-level caching. Avoid these pitfalls to ensure your web application maintains optimal performance and scalability.

Does Next.js App Router support secure data mutations without API routes?

Yes, Next.js Server Actions handle secure data mutations and form processing directly. They allow you to mutate data and revalidate the cache without creating separate API route handlers.

How do I configure dynamic metadata for SEO in Next.js?

Next.js allows configuring both static and dynamic metadata for SEO. Generate dynamic metadata functions based on route parameters to automatically inject title and meta tags into your web application.

What is the best way to optimize images and bundles in Next.js?

Optimize Next.js performance by using the built-in image component for lazy loading and responsive sizing. Bundle optimization relies on proper component splitting and managing server versus client boundaries.