nextjs-best-practices

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

Updated Mar 12, 2026
One-click install
npx skills add https://github.com/MuhamadAnang/wareflow-project --skill nextjs-best-practices-muhamadanang
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nextjs-best-practices
Source: https://github.com/MuhamadAnang/wareflow-project/tree/main/.agents/skills/nextjs-best-practices
Command: npx skills add https://github.com/MuhamadAnang/wareflow-project --skill nextjs-best-practices-muhamadanang

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides clear, actionable guidelines and best practices for developing efficient and maintainable applications using the Next.js App Router.

Core Features & Use Cases

  • Component Strategy: Understand when to use Server vs. Client Components.
  • Data Fetching: Learn optimal patterns for fetching data efficiently.
  • Routing: Grasp Next.js routing conventions and advanced patterns.
  • Performance: Implement techniques for optimizing application speed and bundle size.
  • Use Case: Ensure your Next.js project adheres to modern standards by reviewing and applying these principles to improve performance and developer experience.

Quick Start

Review the decision tree for Server vs Client Components to determine the correct component type for your use case.

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 vs Client Components in Next.js App Router?

Use Server Components for data fetching and static rendering by default, and Client Components only when you need interactivity, state, or browser APIs. Reviewing the component decision tree ensures optimal Next.js App Router performance.

What is the best way to fetch data efficiently in Next.js App Router?

The best way to fetch data in Next.js App Router is directly inside Server Components to leverage async/await syntax. This pattern minimizes client-side JavaScript and utilizes the framework's built-in caching mechanisms for efficient data retrieval.

How do I optimize performance and bundle size in Next.js applications?

Optimize Next.js performance by strategically using Server Components, implementing proper caching strategies, and following routing anti-patterns to avoid unnecessary client-side code. These techniques reduce bundle size and improve application speed.

Does Next.js App Router support API routes and server actions?

Yes, Next.js App Router supports API routes and server actions for backend logic execution. Server actions allow you to mutate data and handle form submissions directly on the server without creating separate API endpoints.

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

Common Next.js App Router anti-patterns include unnecessary Client Component usage, improper data fetching locations, and ignoring caching directives. Avoiding these ensures maintainable and robust applications with efficient data fetching and routing.