next-best-practices
Skill67 starsChanged 2 months agoMITView on GitHub
Next.js App Router best practices covering file conventions, RSC boundaries, async APIs, data patterns, hydration errors, metadata, route handlers, image/font optimization, and bundling. Use when writing or reviewing Next.js code to prevent hydration errors, RSC violations, data waterfalls, and configuration mistakes.
25 other projects use a version of this.
Adopted by
Most recently taken up by
- r2hu1/openbotstheir own version, first seen Oct 4, 2026
- STIFLEUR390/kwiktalk-docstheir own version, first seen Oct 3, 2026
- hahuyhungdev/ai-coding-configtheir own version, first seen Oct 2, 2026
- compozy/compozytheir own version, first seen Oct 1, 2026
- dorian-akhs/skillstheir own version, first seen Sep 1, 2026
- theDRElabs/opencode-configtheir own version, first seen Aug 26, 2026
Used with
Projects with it also use next-cache-components, next-upgrade and 9 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 7 projects that use this
VercelSkillnext-upgrade
Upgrade Next.js to the latest version following official migration guides and codemods
Also in 5 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
barisariburnuSkilltanstack
Expert assistance for TanStack Router, Query (v5), and Table (v8). Use when users need help with file-based routing, type-safe navigation, data loading, search params, queries, mutations, optimistic updates, infinite queries, table state management, or debugging TanStack libraries.
Also in 3 projects that use this
rohitg00Skilltypescript-advanced
Advanced TypeScript patterns including generics, conditional types, mapped types, template literals, and type guards
Also in 3 projects that use this
- +1 more from pedronauck
- +2 more from vercel-labs
Other versions25 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 25
- compozy/compozy★ 2.8ksame name
- vercel-labs/openreview★ 1.7ksame name
- pedronauck/skills★ 633same name
- ever-works/ever-works★ 157same name
- getsentry/webvitals.com★ 12same name
- autohandai/community-skills★ 11same name
- LeonardoTrapani/better-skills★ 11same name
- vercel-labs/workflow-workshop★ 6same name
- Lukasbrujula/claude-code-framework★ 4same name
- r2hu1/openbots★ 4same name
15 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 repository30 other files it gives its agents.
- AGENTS.mdAGENTS.md
- skills/ai-sdk-6/references/agents.mdAGENTS.md
- skills/ai-sdk-7/references/agents.mdAGENTS.md
- skills/openai-agents-sdk/references/agents.mdAGENTS.md
- skills/react-best-practices/AGENTS.mdAGENTS.md
- skills/vercel-react-view-transitions/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- ai-appSkill
- ai-elementsSkill
- ai-sdk-6Skill
- ai-sdk-7Skill
- ai-sdkSkill
- cache-componentsSkill
- chrome-devtoolsSkill
- frontend-designSkill
- goSkill
- handoffSkill
- hetzner-cloudSkill
- iconsSkill
- nextjs-chatbotSkill
- nextjs-seoSkill
- nextjs-shadcnSkill
- openai-agents-sdkSkill
- postgres-semantic-searchSkill
- react-best-practicesSkill
- shadcnSkill
- skill-creatorSkill
- supabase-postgres-best-practicesSkill
- vercel-react-view-transitionsSkill
- web-design-guidelinesSkill
The file
We split this skill into the rules it gives an agent
4 rules. 0 are common, 1 is distinctive, and 3 are very specific to this project.
0
Common
Most of the 25 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 8
Read the installed next version and relevant node_modules/next/dist/docs/ pages before changing framework behavior.
- Very specific: line 35
Every parallel-route slot needs default.tsx, or the build fails.
- Distinctive: line 75
Keep the project's router, caching mode, runtime and package manager unless migration is requested.
- Very specific: line 93
Use cache-components when that mode is enabled and relevant to the task.
“Common” is measured: kept by at least 6 in 10 of the 25 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 review and implementation
Read the installed next version and relevant node_modules/next/dist/docs/
pages before changing framework behavior. Those docs and project configuration
take precedence; use a matching online version/source tag when local docs are
unavailable. The original Next-skills upstream is archived.
Docs are bundled from 16.2; in a monorepo, read the app's own next package.
The nextjs.org links in these files have local equivalents with numbered
folders, so search by file name (find node_modules/next/dist/docs -name proxy.md).
01-app/02-guides/upgrading/version-16.md lists the breaking changes.
Per-error pages (/docs/messages/*) are only online; the dev/build output
carries the error's fix options.
Exact exports are also in node_modules/next/{server,navigation,headers,cache}.d.ts.
Next.js 16 changes older examples miss
- Sync request access is removed:
cookies(),headers(),draftMode(),params(including image-metadata routes),searchParamsand sitemapidare promises.next typegengenerates globalPageProps<'/route'>,LayoutPropsandRouteContexttypes. middleware.tsis deprecated:proxy.tsexportingproxy(or default) runs on Node.js only and rejects aruntimeoption; code that needs Edge stays inmiddleware.ts. Codemod:npx @next/codemod@latest middleware-to-proxy ..- Turbopack is the default for
devandbuild; a customwebpackconfig fails the build unless--webpackkeeps it or explicit--turbopackignores it.next lintis removed andnext buildno longer lints.serverRuntimeConfig/publicRuntimeConfigare removed. - Every parallel-route slot needs
default.tsx, or the build fails. next/image:priorityis deprecated forpreload;qualitiesdefaults to[75](otherqualityvalues are coerced); localsrcwith a query string needsimages.localPatterns;images.domainsis deprecated forremotePatterns.revalidateTag(tag)is deprecated; pass a profile such as'max'or{ expire: 0 }for immediate expiry.updateTagandrefreshare Server Action-only. Caching details:cache-components.
The params and proxy shapes, checked against next 16.3.8 (next typegen,
tsc --noEmit, next build):
// app/blog/[slug]/page.tsx; PageProps is global after `next typegen` (or dev/build)
export async function generateStaticParams() {
return [{ slug: 'hello' }] // cacheComponents: needed for this top-level await; never []
}
export default async function Page({ params }: PageProps<'/blog/[slug]'>) {
const { slug } = await params // a Promise; sync access was removed in 16
return <h1>{slug}</h1>
}
// proxy.ts, replacing middleware.ts: Node.js runtime, no `runtime` export
import { NextResponse, type NextRequest } from 'next/server'
export function proxy(request: NextRequest) {
// Optimistic check only: authorize again where the data is read.
if (request.cookies.has('session')) return NextResponse.next()
return NextResponse.redirect(new URL('/login', request.url))
}
export const config = { matcher: ['/dashboard/:path*'] }The upgrade codemod does not migrate synchronous request-API access; run
next-async-request-api separately when migrating that code. Use the project's
package runner and review the resulting types and runtime behavior.
Review the actual failure or feature, rather than applying every optimization. Keep the project's router, caching mode, runtime and package manager unless migration is requested.
Read for the affected area
| Area | Local reference |
| Route files, groups, proxy | File conventions |
| Server/client imports and props | RSC boundaries, directives |
| Params and request APIs | Async APIs, functions |
| Reads, mutations and APIs | Data patterns, Route Handlers |
| Rendering and failures | Suspense, hydration, errors |
| Metadata and public discovery | Metadata; nextjs-seo for an SEO audit |
| Assets and loading | Images, fonts, scripts |
| Package/runtime behavior | Bundling, runtime |
| Navigation slots/modals | Parallel routes |
| Deployment/debugging | Self-hosting, diagnostics |
Use cache-components when that mode is enabled and relevant to the task.
Tag invalidation can also operate on fetch caches outside that mode.
Validate with the project's lint/typecheck scripts and a production build,
then exercise the changed route under next start. A dev render can
hide prerender/Suspense issues; a build cannot prove authorization, hydration,
freshness or cross-instance behavior. Report what was actually exercised.
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.

