nextjs-app-router
Skill3 starsChanged 8 months agoMITView on GitHub
Use when building or reviewing Next.js App Router applications. Covers Server vs Client Components, data fetching, Server Functions, Route Handlers, Cache Components, revalidation, routing, metadata, proxy.ts, error handling, streaming, and migration from the Pages Router. Verified against the official Next.js 16 App Router documentation.
9 other projects use a version of this.
Adopted by
Most recently taken up by
- SkillMedev/full-stack-web-devtheir own version, first seen Oct 5, 2026
- sabahattink/antigravity-fullstack-hqtheir own version, first seen Sep 20, 2026
- jawwad-ali/claude-code-skillstheir own version, first seen Sep 5, 2026
- dennisrongo/claude-skillstheir own version, first seen Aug 16, 2026
- amirrezaalasti/codescribetheir own version, first seen Aug 3, 2026
- FilippoDeSilva/skillstheir own version, first seen Jun 26, 2026
Other versions9 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 9
- sabahattink/antigravity-fullstack-hq★ 30same name
- jawwad-ali/claude-code-skills★ 4same name
- VersoXBT/claude-initial-setup★ 4same name
- amirrezaalasti/codescribe★ 2same name
- desilokesh1/antigravity-fullstack-hq★ 2same name
- FilippoDeSilva/skills★ 2same name
- dennisrongo/claude-skills★ 1same name
- SkillMedev/full-stack-web-dev★ 1same name
- ThuPhuong1010/claude-factory★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository6 other files it gives its agents.
- api-securitySkill
- product-marketingSkill
- react-performanceSkill
- seoSkill
- ux-copySkill
- wcag-accessibilitySkill
The file
Files
Next.js App Router
Production guidance for Next.js 16 App Router applications. Server-first: keep rendering, data access, and secrets on the server; add 'use client' only for interactivity.
Architecture Overview
Request → proxy.ts → Route (layout/page) → Server Components → DB/API
│ │
│ ▼
│ RSC Payload + HTML
│ │
▼ ▼
Route Handlers Streaming + Suspense
│
▼
Client Components (hydrate)Quick Reference
| Need help with... | Resource |
| Server vs Client Components | server-components.md |
Data fetching, Suspense, use() | data-fetching.md |
| Cache Components, revalidation | caching.md |
| Layouts, navigation, dynamic routes | routing.md |
proxy.ts, auth gates | proxy.md |
error.tsx, loading.tsx, notFound() | error-handling.md |
| Metadata, App Router ownership | metadata-and-seo.md |
next/image, next/font | assets.md |
| Pages Router migration | migration.md |
| Next.js 15 → 16 upgrade | version-changes.md |
Decision Matrix: "What Do I Use?"
| Need | Solution | Resource |
| Read database / API | Server Component | server-components, data-fetching |
| User interaction / state | Client Component | server-components |
| Form mutation | Server Action | data-fetching |
| HTTP endpoint / webhook | Route Handler | data-fetching |
| Cache expensive data | 'use cache' + cacheLife | caching |
| Invalidate after user edit | updateTag() | caching |
| Invalidate from webhook | revalidateTag(tag, 'max') | caching |
| Auth redirect before render | proxy.ts | proxy |
| Loading UI | loading.tsx or <Suspense> | error-handling, data-fetching |
| Uncaught error | error.tsx | error-handling |
| Missing resource | notFound() | error-handling |
| SEO metadata | metadata / generateMetadata | metadata-and-seo |
| Optimize images/fonts | next/image, next/font | assets |
Component Decision Tree
Need useState, useEffect, onClick, or browser APIs?
├── YES → Client Component ('use client' at leaf)
└── NO → Server Component (default — no directive)
Need to mutate data?
├── HTML form / button → Server Action
└── External HTTP API → Route HandlerData & Caching
| Scenario | Pattern |
| Independent fetches | Promise.all() in Server Component |
| Slow section | <Suspense> + streaming |
| User-specific data | 'use cache: private' (or Suspense — no shared 'use cache') |
| Shared catalog | 'use cache' + cacheTag |
| After mutation | updateTag() (actions) or revalidateTag (webhooks) |
Routing Conventions
| File | Purpose |
page.tsx | Route UI |
layout.tsx | Shared chrome (persists on navigation) |
loading.tsx | Suspense fallback |
error.tsx | Error boundary (Client Component) |
not-found.tsx | 404 UI |
route.ts | HTTP handler |
proxy.ts | Pre-render interception (root or src/) |
Code Review Checklist
Components & Data
- Server Components by default;
'use client'only at leaves - Data fetched in Server Components, not via client
useEffect - Parallel fetching with
Promise.all()where independent params/searchParams/cookies()/headers()awaited- No secrets or DB clients in Client Components
Mutations & Cache
- Server Actions authenticate and authorize
updateTagorrevalidateTagafter mutations- No
cookies()inside shared'use cache'scopes (use'use cache: private'for per-user)
Routing & UX
- Nested layouts; no duplicated page wrappers
loading.tsx/error.tsxon slow or critical routesnotFound()for missing resources
Security
proxy.tsgates auth; Server Actions re-verify- Input validated in Server Actions and Route Handlers
Performance & SEO
next/imageandnext/fontused- Metadata on every public page
- Suspense for slow streaming sections
Anti-Patterns
'use client'on entire pages or layouts- Client Component fetching data the server could fetch
- Route Handlers for internal reads (use Server Components)
- Sequential awaits for independent requests
middleware.tsinstead ofproxy.ts(Next.js 16)- Sync
paramsorcookies()(removed) revalidateTag(tag)without second argument- Auth only in proxy — not in Server Actions
Resource Map
| Resource | Owns |
| server-components.md | RSC, Client boundaries, composition, context, server-only |
| data-fetching.md | fetch, ORM, parallel fetch, Suspense, use(), Route Handlers |
| caching.md | 'use cache', cacheLife, cacheTag, revalidation, PPR |
| routing.md | Layouts, pages, parallel/intercepting routes, Link |
| proxy.md | proxy.ts, matcher, redirects, auth gates |
| error-handling.md | loading, error, not-found boundaries |
| metadata-and-seo.md | Metadata API ownership; SEO depth → seo skill |
| assets.md | next/image, next/font |
| migration.md | Pages Router → App Router |
| version-changes.md | Next.js 15 → 16 breaking changes |
References
Verified against Next.js 16 App Router documentation.
- Project Structure
- Server and Client Components
- Fetching Data
- Caching
- Route Handlers
- Proxy
- Upgrading to Version 16
Last verified: July 2026
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

