skillfed

nextjs

Master Next.js 16 App Router development with 45 rules spanning build optimization, caching strategy, server components, routing, and mutations. This skill guides you through critical patterns like explicit `'use cache'` directives, `revalidateTag` with cache profiles, and parallel data fetching, plus a category-major review algorithm for auditing single files or entire codebases. Uncover codebase-level issues—duplicated fetchers, dead routes, and `'use client'` propagation—that single-file rules miss.

nextjs helps you write optimized Next.js 16 App Router code with proper caching, server components, and routing patterns.

AI-generated summary based on this skill's SKILL.md

182 14 MIT updated by pproenca

Install

pproenca/dot-skills/nextjs · repository language: Shell

git clone https://github.com/pproenca/dot-skills
cp -r dot-skills/skills/.curated/nextjs ~/.claude/skills/nextjs
npx skillfed install pproenca/dot-skills/nextjs

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

What are the next.js 16 app router best practices?

nextjs guides you through 45 rules for App Router mastery, covering build optimization, caching strategy, server components, routing patterns, and mutations. Key practices include using explicit `'use cache'` directives for deterministic caching, leveraging `revalidateTag` with cache profiles for granular invalidation, and structuring parallel data fetches to avoid waterfall requests. The skill emphasizes server components as the default, strategic `'use client'` boundaries, and proper `generateMetadata` for SEO—all validated against real-world performance patterns.

How does nextjs caching strategy use cache directive work?

nextjs teaches explicit `'use cache'` directives as the foundation of Next.js 16 caching. This directive marks server functions and components for deterministic caching, replacing implicit behavior from earlier versions. Combined with `revalidateTag` and cache profiles, it gives you fine-grained control over what gets cached, when it expires, and how to invalidate it. The skill covers when to apply `'use cache'`, how to pair it with `cacheLife` settings, and patterns for handling dynamic data without cache collisions.

What does nextjs offer for app router codebase audit and refactor?

nextjs includes a category-major review algorithm that audits single files or entire codebases for performance and hygiene issues. Beyond file-level rules, it uncovers codebase-level problems: duplicated data fetchers across routes, dead code and unconsolidated routes, and `'use client'` propagation that bloats your client bundle. The audit identifies consolidation opportunities, suggests route merging, and flags unnecessary client boundaries—helping you transform scattered code into a lean, maintainable architecture.

How do I migrate from next.js 15 to 16 with updated patterns?

nextjs covers migration from Next.js 15 to 16, focusing on implicit-to-explicit caching changes. In version 16, caching is no longer implicit; you must use `'use cache'` directives and `revalidateTag` with cache profiles to achieve the behavior you had before. The skill guides you through updating data fetching patterns, adjusting middleware (replacing `proxy.ts`), and refactoring routes to leverage new App Router capabilities. It ensures your codebase aligns with version 16's performance model and best practices.

How can nextjs help optimize next.js bundle size and performance?

nextjs addresses bundle optimization through multiple strategies: dynamic imports for code splitting, `optimizePackageImports` configuration to reduce dependency bloat, and strategic `'use client'` boundaries to keep server logic out of the client bundle. The skill also covers barrel file optimization to avoid importing unused exports, streaming with Suspense for faster perceived performance, and turbopack persistent caching config for faster builds. Together, these reduce bundle size, improve load times, and enhance overall application performance.

What server components and data fetching patterns does nextjs teach?

nextjs emphasizes server components as the default, with patterns for parallel data fetching, proper error handling, and streaming with Suspense. It covers server actions for mutations and forms, distinguishing server vs. client data fetching to avoid unnecessary client-side logic. The skill teaches how to structure `generateMetadata` for SEO, use parallel routes and intercepting routes for advanced layouts, and leverage `'use cache'` with server functions to optimize data access. These patterns eliminate waterfalls, reduce client overhead, and improve Core Web Vitals.

SKILL.md

rendered from the published skill — quoted content, verbatim

Next.js 16 App Router Best Practices

Comprehensive Next.js 16 App Router guide for AI agents. Contains 45 rules across 9 categories, prioritized by impact from critical (build optimization, caching strategy) through to cross-cutting codebase hygiene (dedup, dead routes, boundary coherence). Reflects Next.js 16 changes: 'use cache' directive replacing implicit caching, revalidateTag(tag, cacheLife) requirement, proxy.ts replacing middleware.ts, Turbopack persistent caching, App Router conventions.

Rule files describe **pattern

(truncated - see the full file via the links below)

Read as markdown · JSON record · Browse the source repository

File tree — 15 files
skills/.curated/nextjs/AGENTS.md
skills/.curated/nextjs/README.md
skills/.curated/nextjs/SKILL.md
skills/.curated/nextjs/assets/templates/_template.md
skills/.curated/nextjs/metadata.json
skills/.curated/nextjs/references/_review-algorithm.md
skills/.curated/nextjs/references/_sections.md
skills/.curated/nextjs/references/action-error-handling.md
skills/.curated/nextjs/references/action-optimistic-updates.md
skills/.curated/nextjs/references/action-pending-states.md
skills/.curated/nextjs/references/action-revalidation.md
skills/.curated/nextjs/references/action-server-action-forms.md
skills/.curated/nextjs/references/build-barrel-files.md
skills/.curated/nextjs/references/build-dynamic-imports.md
skills/.curated/nextjs/references/build-external-packages.md

Related skills

Tags

performance-tuning caching-strategies bundle-optimization code-refactoring server-rendering routing-patterns form-handling codebase-audit migration-guide fullstack-framework