Next.js Community Next.js 16 App Router Best Practices
Comprehensive performance optimization guide for Next.js 16 App Router applications, maintained by the Next.js Community. Contains 40 rules across 8 categories, prioritized by impact to guide automated refactoring and code generation.
When to Apply
Reference these guidelines when:
Writing new Next.js 16 App Router code
Configuring caching strategies with 'use cache' directive
Implementing server components and data fetching
Setting up routing with parallel and intercepting routes
Creating server actions for form handling and mutations
Rule Categories by Priority
Priority
Category
Impact
Prefix
1
Build & Bundle Optimization
CRITICAL
build-
2
Caching Strategy
CRITICAL
cache-
3
Server Components & Data Fetching
HIGH
server-
4
Routing & Navigation
HIGH
route-
5
Server Actions & Mutations
MEDIUM-HIGH
action-
6
Streaming & Loading States
MEDIUM
stream-
7
Metadata & SEO
MEDIUM
meta-
8
Client Components
LOW-MEDIUM
client-
Quick Reference
1. Build & Bundle Optimization (CRITICAL)
build-optimize-package-imports - Configure optimizePackageImports for Icon Libraries
build-dynamic-imports - Use Dynamic Imports for Heavy Components
build-barrel-files - Avoid Barrel File Imports in App Router
build-turbopack-config - Enable Turbopack File System Caching
build-external-packages - Configure Server External Packages for Node Dependencies
2. Caching Strategy (CRITICAL)
cache-use-cache-directive - Use the 'use cache' Directive for Explicit Caching
cache-revalidate-tag - Use revalidateTag with cacheLife Profiles
Read individual reference files for detailed explanations and code examples:
Section definitions - Category structure and impact levels
Rule template - Template for adding new rules
build-dynamic-imports - Example rule file
cache-use-cache-directive - Example rule file
Related Skills
For React 19 fundamentals, see react-19 skill
For data fetching patterns, see tanstack-query skill
For client-side forms, see react-hook-form skill
Full Compiled Document
For the complete guide with all rules expanded: AGENTS.md
1---2name: nextjs-33description: Next.js Community Next.js 16 App Router Best Practices4---5# Next.js Community Next.js 16 App Router Best Practices67Comprehensive performance optimization guide for Next.js 16 App Router applications, maintained by the Next.js Community. Contains 40 rules across 8 categories, prioritized by impact to guide automated refactoring and code generation.89## When to Apply1011Reference these guidelines when:12- Writing new Next.js 16 App Router code13- Configuring caching strategies with 'use cache' directive14- Implementing server components and data fetching15- Setting up routing with parallel and intercepting routes16- Creating server actions for form handling and mutations1718## Rule Categories by Priority1920| Priority | Category | Impact | Prefix |21|----------|----------|--------|--------|22| 1 | Build & Bundle Optimization | CRITICAL | `build-` |23| 2 | Caching Strategy | CRITICAL | `cache-` |24| 3 | Server Components & Data Fetching | HIGH | `server-` |25| 4 | Routing & Navigation | HIGH | `route-` |26| 5 | Server Actions & Mutations | MEDIUM-HIGH | `action-` |27| 6 | Streaming & Loading States | MEDIUM | `stream-` |28| 7 | Metadata & SEO | MEDIUM | `meta-` |29| 8 | Client Components | LOW-MEDIUM | `client-` |3031## Quick Reference3233### 1. Build & Bundle Optimization (CRITICAL)3435- `build-optimize-package-imports` - Configure optimizePackageImports for Icon Libraries36- `build-dynamic-imports` - Use Dynamic Imports for Heavy Components37- `build-barrel-files` - Avoid Barrel File Imports in App Router38- `build-turbopack-config` - Enable Turbopack File System Caching39- `build-external-packages` - Configure Server External Packages for Node Dependencies4041### 2. Caching Strategy (CRITICAL)4243- `cache-use-cache-directive` - Use the 'use cache' Directive for Explicit Caching44- `cache-revalidate-tag` - Use revalidateTag with cacheLife Profiles45- `cache-fetch-options` - Configure Fetch Cache Options Correctly46- `cache-revalidate-path` - Use revalidatePath for Route-Level Cache Invalidation47- `cache-react-cache` - Use React cache() for Request Deduplication48- `cache-segment-config` - Configure Route Segment Caching with Exports4950### 3. Server Components & Data Fetching (HIGH)5152- `server-parallel-fetching` - Fetch Data in Parallel in Server Components53- `server-component-streaming` - Stream Server Components for Progressive Loading54- `server-data-colocation` - Colocate Data Fetching with Components55- `server-preload-pattern` - Use Preload Pattern for Critical Data56- `server-avoid-client-fetching` - Avoid Client-Side Data Fetching for Initial Data57- `server-error-handling` - Handle Server Component Errors Gracefully5859### 4. Routing & Navigation (HIGH)6061- `route-parallel-routes` - Use Parallel Routes for Independent Content62- `route-intercepting-routes` - Use Intercepting Routes for Modal Patterns63- `route-prefetching` - Configure Link Prefetching Appropriately64- `route-proxy-ts` - Use proxy.ts for Network Boundary Logic65- `route-not-found` - Use notFound() for Missing Resources6667### 5. Server Actions & Mutations (MEDIUM-HIGH)6869- `action-server-action-forms` - Use Server Actions for Form Submissions70- `action-pending-states` - Show Pending States with useFormStatus71- `action-error-handling` - Handle Server Action Errors Gracefully72- `action-optimistic-updates` - Use Optimistic Updates for Instant Feedback73- `action-revalidation` - Revalidate Cache After Mutations7475### 6. Streaming & Loading States (MEDIUM)7677- `stream-suspense-boundaries` - Place Suspense Boundaries Strategically78- `stream-loading-tsx` - Use loading.tsx for Route-Level Loading States79- `stream-error-tsx` - Use error.tsx for Route-Level Error Boundaries80- `stream-skeleton-matching` - Match Skeleton Dimensions to Actual Content81- `stream-nested-suspense` - Nest Suspense for Progressive Disclosure8283### 7. Metadata & SEO (MEDIUM)8485- `meta-generate-metadata` - Use generateMetadata for Dynamic Metadata86- `meta-sitemap` - Generate Sitemaps Dynamically87- `meta-robots` - Configure Robots for Crawl Control88- `meta-opengraph-images` - Generate Dynamic OpenGraph Images8990### 8. Client Components (LOW-MEDIUM)9192- `client-use-client-boundary` - Minimize 'use client' Boundary Scope93- `client-children-pattern` - Pass Server Components as Children to Client Components94- `client-hydration-mismatch` - Avoid Hydration Mismatches95- `client-third-party-scripts` - Load Third-Party Scripts Efficiently9697## How to Use9899Read individual reference files for detailed explanations and code examples:100101- [Section definitions](references/_sections.md) - Category structure and impact levels102- [Rule template](assets/templates/_template.md) - Template for adding new rules103- [build-dynamic-imports](references/build-dynamic-imports.md) - Example rule file104- [cache-use-cache-directive](references/cache-use-cache-directive.md) - Example rule file105106## Related Skills107108- For React 19 fundamentals, see `react-19` skill109- For data fetching patterns, see `tanstack-query` skill110- For client-side forms, see `react-hook-form` skill111112## Full Compiled Document113114For the complete guide with all rules expanded: `AGENTS.md`
Run npx skillmds@latest add comeonoliver/nextjs-3 in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Next.js Community Next.js 16 App Router Best Practices It is listed under Web & Frontend on SkillMD.
This skill has not completed SkillMD's automated safety review yet. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
ComeOnOliver (@comeonoliver) published this skill. Their other Agent Skills are listed on their SkillMD profile.