next-best-practices
Skill2 starsChanged 52 days agoMITView on GitHub
Next.js 15+ App Router best practices for pages, layouts, routes, server components, server actions, caching, API routes, and streaming. Use when building or reviewing Next.js code, implementing RSC patterns, PPR, metadata, error boundaries, or proxy.ts. Covers React 19 conventions, data fetching, ISR, and common mistakes.
50 other projects use a version of this.
Adopted by
Most recently taken up by
- figueroaignacio/ignaciofigueroa.devtheir own version, first seen Nov 8, 2026
- ftzi/livespectheir own version, first seen Nov 8, 2026
- ever-co/ever-workstheir own version, first seen Nov 8, 2026
- compozy/compozytheir own version, first seen Nov 7, 2026
- ever-works/ever-workstheir own version, first seen Nov 5, 2026
- jahongashtamc/hallwrighttheir own version, first seen Nov 1, 2026
Used with
Projects with it also use next-cache-components, next-upgrade and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
VercelSkillnext-cache-components
Next.js 16 Cache Components - PPR, use cache directive, cacheLife, cacheTag, updateTag
Also in 17 projects that use this
VercelSkillnext-upgrade
Upgrade Next.js to the latest version following official migration guides and codemods
Also in 12 projects that use this
pedronauckSkillapp-renderer-systems
Create, extend, or debug frontend domain modules organized under systems/. Covers adapters, Query hooks, local state, and public exports; excludes generic components and backend implementation.
Also in 3 projects that use this
pedronauckSkillrefactoring-analysis
Audit code quality and architectural health or plan refactoring using Fowler code smells and techniques; write prioritized findings to docs/_refacs/. Excludes formatting, performance, and security audits.
Also in 3 projects that use this
jander99Skilltypescript-advanced
Design, implement, refactor, and debug advanced TypeScript patterns including generics, utility types, mapped types, conditional types, type guards, discriminated unions, and strict mode configuration. Use when writing type-safe code, fixing type errors, or improving type inference.
Also in 3 projects that use this
midudevSkilltailwind-css-patterns
Provides comprehensive Tailwind CSS utility-first styling patterns including responsive design, layout utilities, flexbox, grid, spacing, typography, colors, and modern CSS best practices. Use when styling React/Vue/Svelte components, building responsive layouts, implementing design systems, or optimizing CSS workflow.
Also in 5 projects that use this
Other versions50 projects use a version of this.
Word for word · 1
- revealui-studio/revskills★ 2100% same
Edited · 0
None found.
Wrote their own version · 49
- midudev/preguntas-entrevista-react★ 7.8ksame name
- Kiranism/next-shadcn-dashboard-starter★ 7.2ksame name
- JimmyLv/BibiGPT-v1★ 6.3ksame name
- TheEdoRan/next-safe-action★ 3.1ksame name
- compozy/compozy★ 2.9ksame name
- kokonut-labs/kokonutui★ 2.3ksame name
- openstatusHQ/data-table-filters★ 2.3ksame name
- vercel-labs/openreview★ 1.7ksame name
- legions-developer/invoicely★ 923same name
- subhadeeproy3902/mvpblocks★ 834same name
39 more not listed
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 repository29 other files it gives its agents.
- skills/revealui-design/CLAUDE.mdCLAUDE.md
- drizzle-dbSkill
- electric-syncSkill
- exhaustive-auditSkill
- grok-bot-checkpointSkill
- knowledge-graphSkill
- mcp-serverSkill
- multi-agent-memorySkill
- redundancy-scanSkill
- revealui-checkpointSkill
- revealui-cleanupSkill
- coordinateSkill
- revealui-designSkill
- revealui-design-statusSkill
- revealui-doctorSkill
- revealui-opsSkill
- revealui-pickupSkill
- revealui-recoverSkill
- revealui-rollupSkill
- revealui-skills-testSkill
- revealui-snapshotSkill
- revealui-sync-ltsSkill
- revealui-sync-rulesSkill
- revealui-trackerSkill
- revvault-resolveSkill
- security-hardeningSkill
- tailwind-v4Skill
- vitest-testingSkill
- yjs-collaborationSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
16 rules. 0 are common, 6 are distinctive, and 10 are very specific to this project.
0
Common
Most of the 49 edited versions we read keep these.
6
Distinctive
This author's own choices. Worth a look.
10
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 16
All components are Server Components by default — no 'use client' needed
- Very specific: line 17
Only add 'use client' when you need: hooks, event handlers, browser APIs, or Context
- Distinctive: line 18
Prefer server components for data fetching — no useEffect, no loading states
- Very specific: line 34
Use fetch() with Next.js caching extensions
- Very specific: line 58
Use <Suspense> boundaries to mark dynamic regions
- Distinctive: line 59
No code changes needed — just wrap dynamic content in Suspense
- Distinctive: line 89
Always validate input (use Zod)
- Distinctive: line 90
Always revalidate affected paths after mutations
- Very specific: line 110
Don't use 'use client' on pages that don't need interactivity
- Distinctive: line 111
Don't fetch data in client components when server components work
- Very specific: line 112
Don't use useEffect for data fetching — use server components or server actions
- Very specific: line 113
Don't put middleware.ts at the root — use proxy.ts in Next.js 16+
- Very specific: line 114
Don't use router.push() for mutations — use server actions + revalidatePath()
- Distinctive: line 115
Don't wrap entire pages in Suspense — wrap individual dynamic sections
- Very specific: line 120
Use use() instead of useContext() for reading context
- Very specific: line 121
Use ternary {condition ? <A/> : null} instead of {condition && <A/>}
“Common” is measured: kept by at least 6 in 10 of the 49 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Next.js Best Practices (App Router, v15+)
Server Components (default)
- All components are Server Components by default — no
'use client'needed - Only add
'use client'when you need: hooks, event handlers, browser APIs, or Context - Prefer server components for data fetching — no useEffect, no loading states
- Pass server data to client components as props (serializable only)
Route Conventions
page.tsx— route pagelayout.tsx— shared layout (wraps children, persists across navigations)loading.tsx— streaming fallback (instant loading UI)error.tsx— error boundary ('use client'required)not-found.tsx— 404 pageproxy.ts— request proxy/middleware (NOTmiddleware.tsin v16+)route.ts— API route handler
Data Fetching
- Fetch in server components directly (no
getServerSideProps) - Use
fetch()with Next.js caching extensions - Deduplicate requests — React auto-deduplicates identical fetches per render
- For mutations: server actions (
'use server')
Caching Strategy
// Static (build time)
export const dynamic = 'force-static';
// Dynamic (every request)
export const dynamic = 'force-dynamic';
// ISR (revalidate every N seconds)
export const revalidate = 3600;
// On-demand revalidation
import { revalidatePath, revalidateTag } from 'next/cache';Partial Prerendering (PPR)
- Enable in
next.config.ts:experimental: { ppr: true } - Static shell renders instantly, dynamic parts stream in
- Use
<Suspense>boundaries to mark dynamic regions - No code changes needed — just wrap dynamic content in Suspense
Metadata
// Static
export const metadata: Metadata = {
title: 'Page Title',
description: 'Page description',
};
// Dynamic
export async function generateMetadata({ params }: Props): Promise<Metadata> {
const data = await fetchData(params.id);
return { title: data.title };
}Server Actions
'use server';
export async function createItem(formData: FormData) {
const name = formData.get('name') as string;
// Validate, write to DB, revalidate
revalidatePath('/items');
}- Always validate input (use Zod)
- Always revalidate affected paths after mutations
- Return errors as values, not thrown exceptions
Image Optimization
import Image from 'next/image';
<Image
src="/hero.jpg"
alt="Description"
width={1200}
height={630}
priority // above the fold
placeholder="blur"
/>Common Mistakes to Avoid
- Don't use
'use client'on pages that don't need interactivity - Don't fetch data in client components when server components work
- Don't use
useEffectfor data fetching — use server components or server actions - Don't put
middleware.tsat the root — useproxy.tsin Next.js 16+ - Don't use
router.push()for mutations — use server actions +revalidatePath() - Don't wrap entire pages in Suspense — wrap individual dynamic sections
React 19 Conventions
- No
useCallback,useMemo, orReact.memo— React Compiler handles memoization - Use
use()instead ofuseContext()for reading context - Use ternary
{condition ? <A/> : null}instead of{condition && <A/>} refis a regular prop now — noforwardRefneeded
Skill by RevealUI Studio — the agentic business runtime.
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.

