next-best-practices
Skill0 starsChanged 9 months agoMITView on GitHub
Next.js best practices - file conventions, RSC boundaries, data patterns, async APIs, metadata, error handling, route handlers, image/font optimization, bundling
We split this skill into the rules it gives an agent
4 rules. 2 are common, 0 are distinctive, and 2 are very specific to this project.
2
Common
Most of the 21 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 40
Default to Node.js runtime
- Common: line 41
When Edge runtime is appropriate
- Common: line 77
When to use vs Server Actions
- Very specific: line 90
Always use next/image over <img>
“Common” is measured: kept by at least 6 in 10 of the 21 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
Apply these rules when writing or reviewing Next.js code.
File Conventions
See file-conventions.md for:
- Project structure and special files
- Route segments (dynamic, catch-all, groups)
- Parallel and intercepting routes
- Middleware rename in v16 (middleware → proxy)
RSC Boundaries
Detect invalid React Server Component patterns.
See rsc-boundaries.md for:
- Async client component detection (invalid)
- Non-serializable props detection
- Server Action exceptions
Async Patterns
Next.js 15+ async API changes.
See async-patterns.md for:
- Async
paramsandsearchParams - Async
cookies()andheaders() - Migration codemod
Runtime Selection
See runtime-selection.md for:
- Default to Node.js runtime
- When Edge runtime is appropriate
Directives
See directives.md for:
'use client','use server'(React)'use cache'(Next.js)
Functions
See functions.md for:
- Navigation hooks:
useRouter,usePathname,useSearchParams,useParams - Server functions:
cookies,headers,draftMode,after - Generate functions:
generateStaticParams,generateMetadata
Error Handling
See error-handling.md for:
error.tsx,global-error.tsx,not-found.tsxredirect,permanentRedirect,notFoundforbidden,unauthorized(auth errors)unstable_rethrowfor catch blocks
Data Patterns
See data-patterns.md for:
- Server Components vs Server Actions vs Route Handlers
- Avoiding data waterfalls (
Promise.all, Suspense, preload) - Client component data fetching
Route Handlers
See route-handlers.md for:
route.tsbasics- GET handler conflicts with
page.tsx - Environment behavior (no React DOM)
- When to use vs Server Actions
Metadata & OG Images
See metadata.md for:
- Static and dynamic metadata
generateMetadatafunction- OG image generation with
next/og - File-based metadata conventions
Image Optimization
See image.md for:
- Always use
next/imageover<img> - Remote images configuration
- Responsive
sizesattribute - Blur placeholders
- Priority loading for LCP
Font Optimization
See font.md for:
next/fontsetup- Google Fonts, local fonts
- Tailwind CSS integration
- Preloading subsets
Bundling
See bundling.md for:
- Server-incompatible packages
- CSS imports (not link tags)
- Polyfills (already included)
- ESM/CommonJS issues
- Bundle analysis
Scripts
See scripts.md for:
next/scriptvs native script tags- Inline scripts need
id - Loading strategies
- Google Analytics with
@next/third-parties
Hydration Errors
See hydration-error.md for:
- Common causes (browser APIs, dates, invalid HTML)
- Debugging with error overlay
- Fixes for each cause
Suspense Boundaries
See suspense-boundaries.md for:
- CSR bailout with
useSearchParamsandusePathname - Which hooks require Suspense boundaries
Parallel & Intercepting Routes
See parallel-routes.md for:
- Modal patterns with
@slotand(.)interceptors default.tsxfor fallbacks- Closing modals correctly with
router.back()
Self-Hosting
See self-hosting.md for:
output: 'standalone'for Docker- Cache handlers for multi-instance ISR
- What works vs needs extra setup
Debug Tricks
See debug-tricks.md for:
- MCP endpoint for AI-assisted debugging
- Rebuild specific routes with
--debug-build-paths
Other versions47 projects use a version of this.
Word for word · 26
- midudev/preguntas-entrevista-react★ 7.8k100% same
- TheEdoRan/next-safe-action★ 3.1k100% same
- compozy/compozy★ 2.8k100% same
- kokonut-labs/kokonutui★ 2.2k100% same
- vercel-labs/openreview★ 1.7k100% same
- subhadeeproy3902/mvpblocks★ 834100% same
- pedronauck/skills★ 641100% same
- robotostudio/turbo-start-sanity★ 183100% same
- happycapy-ai/Happycapy-skills★ 137100% same
- getsentry/webvitals.com★ 12100% same
16 more not listed
Edited · 15
- Kiranism/next-shadcn-dashboard-starter★ 7.1k100% same
- JimmyLv/BibiGPT-v1★ 6.2k100% same
- openstatusHQ/data-table-filters★ 2.3k100% same
- legions-developer/invoicely★ 923100% same
- notum-cz/strapi-next-monorepo-starter★ 316100% same
- ever-works/ever-works★ 181100% same
- yamcodes/arkenv★ 14796% same
- LeonardoTrapani/better-skills★ 11100% same
- PIXARTSeu/Synapse★ 993% same
- zebbern/termstack★ 495% same
5 more not listed
Wrote their own version · 6
- laguagu/claude-code-nextjs-skills★ 68same name
- kimtth/agent-skill-100-lines-or-less★ 2same name
- revealui-studio/revskills★ 2same name
- RevealUIStudio/revskills★ 2same name
- trancethehuman/template-next-agent★ 2same name
- jahongashtamc/hallwright★ 1same 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.
Used alongsideProjects 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 15 projects that use this
VercelSkillnext-upgrade
Upgrade Next.js to the latest version following official migration guides and codemods
Also in 10 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
crafter-stationSkilltech-logos
Install official tech brand logos from the Elements registry. Use when user needs logos for tech companies (Clerk, Vercel, GitHub, etc.), AI providers (OpenAI, Anthropic, Claude), social platforms, or any brand assets. Triggers on "logo", "brand", "icon for [company]", "add [company] logo", placeholder logo detection, or when building landing pages, auth UIs, or integrations showcases.
Also in 3 projects that use this
- +1 more from vercel-labs
In this repository29 other files it gives its agents.
- .agents/skills/vercel-composition-patterns/AGENTS.mdAGENTS.md
- .agents/skills/vercel-react-best-practices/AGENTS.mdAGENTS.md
- agent-browserSkill
- ai-sdkSkill
- algorithmic-artSkill
- audit-websiteSkill
- before-and-afterSkill
- core-web-vitalsSkill
- find-skillsSkill
- frontend-designSkill
- mcp-builderSkill
- pdfSkill
- performanceSkill
- prdSkill
- programmatic-seoSkill
- ralphSkill
- seo-auditSkill
- skill-creatorSkill
- theme-factorySkill
- ui-ux-pro-maxSkill
- using-git-worktreesSkill
- vercel-composition-patternsSkill
- vercel-react-best-practicesSkill
- webapp-testingSkill
- web-design-guidelinesSkill
- cold-outreachSkill
- continuous-claudemd-updatesSkill
- design-tasteSkill
- pr-review-handlerSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
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.

