nextjs-best-practices

Guides Next.js App Router development with component and data fetching best practices.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

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

Core Features & Use Cases

  • Component Strategy: Guides decisions on Server vs. Client Components.
  • Data Fetching: Details caching strategies and data flow patterns.
  • Routing: Explains file conventions and advanced routing techniques.
  • Performance: Offers tips on image and bundle optimization.
  • Use Case: When building a new Next.js application or refactoring an existing one, use this Skill to ensure you are following modern best practices for component architecture, data fetching, and routing.

Quick Start

Review the decision tree for Server vs. Client Components to determine the correct component type for a new feature.

Frequently Asked Questions about nextjs-best-practices

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

FAQPage Schema
What's the best way to choose between Server and Client Components in Next.js App Router?

Choosing between Server and Client Components in Next.js App Router involves using a decision tree based on data fetching needs and interactivity. Server Components handle data fetching and caching by default, while Client Components are reserved for interactive UI elements requiring browser APIs.

How do I implement data fetching and caching strategies in Next.js App Router?

Data fetching and caching in Next.js App Router utilizes built-in caching mechanisms to optimize performance. Modern Next.js 16 features like the 'use cache' directive and Server Actions streamline data flow patterns, ensuring efficient data retrieval and reduced server load.

Does Next.js App Router support advanced routing patterns and API route best practices?

Next.js App Router supports advanced routing patterns through specific file conventions. It provides clear guidelines for API route best practices, allowing developers to structure endpoints efficiently while maintaining strict separation between server-side and client-side logic.

What performance optimization techniques should I use for Next.js applications?

Performance optimization for Next.js applications focuses on image and bundle optimization techniques. Implementing proper component strategies, leveraging caching mechanisms, and adhering to App Router principles ensures applications remain efficient and performant during rendering.

When should I use the 'use cache' directive and Server Actions in Next.js 16?

The 'use cache' directive and Server Actions in Next.js 16 are used to modernize data fetching and mutation workflows. They provide granular caching control and secure server-side execution, replacing older API patterns to ensure maintainable and performant application architecture.