One-click install
npx skills add https://github.com/lchenrique/politron-ide --skill nextjs-best-practices-lchenrique
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nextjs-best-practices
Source: https://github.com/lchenrique/politron-ide/tree/main/.agent/skills/nextjs-best-practices
Command: npx skills add https://github.com/lchenrique/politron-ide --skill nextjs-best-practices-lchenrique

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Developers often struggle to architect Next.js apps using the App Router, balancing server and client components, data fetching, and robust routing conventions.

Core Features & Use Cases

  • Understanding Server vs Client Components and how to structure a scalable UI.
  • Data fetching strategies (Server Components, ISR, and no-store) for performant apps.
  • Routing principles and file conventions (page.tsx, layout.tsx, loading.tsx, error.tsx, not-found.tsx) for reliable navigation and UI.

Quick Start

Create a new Next.js project (npx create-next-app@latest my-app), then reorganize the app using the App Router (app/ with server components) and apply recommended data-fetching and routing patterns.

Frequently Asked Questions about nextjs-best-practices

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

FAQPage Schema
How do I structure Next.js App Router server and client components for a scalable UI?

Structure Next.js App Router components by defaulting to server components for data fetching and marking client components only when interactivity is needed. This approach enforces scalable UI boundaries and optimizes performance.

What is the best way to fetch data in Next.js server components?

Fetch data in Next.js server components directly within the component using async/await. Apply revalidation strategies like ISR or no-store caching to control how fresh your fetched data remains across the application.

What file conventions do I need for reliable Next.js App Router routing?

Next.js App Router routing requires specific file conventions including page.tsx for routes, layout.tsx for shared UI, loading.tsx for fallbacks, error.tsx for error boundaries, and not-found.tsx for 404 handling.

When should I use server actions in my Next.js application?

Use Next.js server actions when you need to handle form submissions and data mutations directly on the server. This pattern eliminates manual API endpoint creation and aligns with App Router performance best practices.

Does this Next.js best practices guidance apply to existing Pages Router projects?

This guidance targets the Next.js App Router architecture, focusing on server components and new file conventions. Developers using the legacy Pages Router will need to migrate their structure to apply these specific routing and data patterns.