react-best-practices
Skill297 starsChanged 9 months agoMITView on GitHub
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.
68 other projects use a version of this, 22 of them edited.
Adopted by
Most recently taken up by
- Jancera/skillsedited, first seen Nov 16, 2026
- Binbin-miao/workbuddy-expert-teamtheir own version, first seen Nov 15, 2026
- laguagu/claude-code-nextjs-skillstheir own version, first seen Nov 14, 2026
- baekenough/oh-my-customcodetheir own version, first seen Nov 14, 2026
- vercel/vercel-plugintheir own version, first seen Nov 12, 2026
- eea/eea.agent.skillstheir own version, first seen Nov 8, 2026
Used with
Projects with it also use composition-patterns, python-best-practices 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.
eeaSkillcomposition-patterns
React composition patterns that scale. Use when refactoring components with boolean prop proliferation, building flexible component libraries, or designing reusable APIs. Triggers on tasks involving compound components, render props, context providers, or component architecture. Includes React 19 API changes.
Also in 4 projects that use this
jefflesterSkillpython-best-practices
Python development best practices including PEP 8 style guidelines, type hints, docstring conventions, and common patterns. Use when writing or modifying Python code.
Also in 3 projects that use this
MicrosoftSkillplanning-with-files
**USE THIS FOR COMPLEX TASKS.** Implements Manus-style file-based planning for multi-step tasks. Creates task_plan.md, findings.md, and progress.md in .agent_cache/<task-name>/. Use when: implementing multiple APIs, refactoring modules, research tasks, or ANY task requiring >5 tool calls.
Also in 5 projects that use this
VercelSkillvercel-deploy
Deploy applications and websites to Vercel with a claimable preview. Use when the user requests deployment actions like "deploy my app", "deploy and give me the link", "push this live", or "create a preview deployment". No authentication required - returns preview URL and claimable deployment link.
Also in 3 projects that use this
MicrosoftSkillcode-quality
Statically check changed C# against the same deterministic rules github-code-quality[bot] runs on pull requests, so a contributor can fix likely findings before opening the PR and keep the bot's inline comments to a minimum. Activate when a contributor asks to "check code quality", "run code quality on my changes", "will the code quality bot complain", "pre-check before I open the PR", "code quality check", or similar. Scoped to C#. Reads the diff and compares it against the enumerated csharp-code-quality rule set below — no CodeQL download or build required. This is a fast approximation of a dataflow engine, not a reproduction; report accordingly. Does NOT apply fixes unless explicitly asked.
Also in 5 projects that use this
JetBrainsSkillwebapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.
Also in 8 projects that use this
- +1 more from microsoft
Other versions68 projects use a version of this.
Word for word · 1
- ttmouse/skills★ 34100% same
Edited · 22
- mastra-ai/mastra★ 30k12% same
- openai/plugins★ 7.8k14% same
- involvex/youtube-music-cli★ 48215% same
- typv/nest-turbo-starter★ 22418% same
- tdimino/claude-code-minoan★ 4187% same
- georgekhananaev/claude-skills-vault★ 3113% same
- Fandry96/k3-agentic-skills★ 2715% same
- DawnMoon1542/agents-skills★ 818% same
- Jancera/skills★ 713% same
- audibleblink/skills★ 413% same
12 more not listed
Wrote their own version · 45
- ryokun6/ryos★ 1.3ksame name
- vercel/vercel-plugin★ 336same name
- AvivK5498/Beads-Kanban-UI★ 102same name
- mxyhi/token_proxy★ 94same name
- laguagu/claude-code-nextjs-skills★ 72same name
- ahonn/dotfiles★ 62same name
- baekenough/oh-my-customcode★ 42same name
- oxedom/haflow★ 34same name
- sabahattink/antigravity-fullstack-hq★ 30same name
- PracticalSwan/agent-skills★ 22same name
35 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 repository15 other files it gives its agents.
- .claude/skills/crossbeam-ops/CLAUDE.mdCLAUDE.md
- adu-city-researchSkill
- adu-corrections-interpreterSkill
- cc-guideSkill
- crossbeam-opsSkill
- demo-city-reviewSkill
- demo-contractor-correctionsSkill
- fal-aiSkill
- frontend-designSkill
- long-running-agentSkill
- nano-bananaSkill
- product-demo-videoSkill
- shadcnSkill
- skill-creatorSkill
- template-skillSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
14 rules. 0 are common, 7 are distinctive, and 7 are very specific to this project.
0
Common
Most of the 56 edited versions we read keep these.
7
Distinctive
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 42
Use Promise.all() for independent async operations
- Distinctive: line 43
Start promises early, await late
- Very specific: line 44
Use better-all for partial dependencies
- Distinctive: line 45
Use Suspense boundaries to stream content
- Distinctive: line 48
Avoid barrel file imports (import directly from source)
- Very specific: line 49
Use next/dynamic for heavy components
- Very specific: line 55
Use React.cache() for per-request deduplication
- Distinctive: line 56
Use LRU cache for cross-request caching
- Distinctive: line 62
Use SWR for automatic request deduplication
- Distinctive: line 64
Use lazy state initialization for expensive values
- Distinctive: line 65
Use derived state subscriptions
- Very specific: line 71
Use content-visibility: auto for long lists
- Very specific: line 73
Use explicit conditional rendering (?
- Very specific: line 80
Use toSorted() instead of sort() for immutability
“Common” is measured: kept by at least 6 in 10 of the 56 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
React Best Practices
Overview
Comprehensive performance optimization guide for React and Next.js applications, containing 40+ rules across 8 categories. Rules are prioritized by impact to guide automated refactoring and code generation.
When to Apply
Reference these guidelines when:
- Writing new React components or Next.js pages
- Implementing data fetching (client or server-side)
- Reviewing code for performance issues
- Refactoring existing React/Next.js code
- Optimizing bundle size or load times
Priority-Ordered Guidelines
Rules are prioritized by impact:
| Priority | Category | Impact |
| 1 | Eliminating Waterfalls | CRITICAL |
| 2 | Bundle Size Optimization | CRITICAL |
| 3 | Server-Side Performance | HIGH |
| 4 | Client-Side Data Fetching | MEDIUM-HIGH |
| 5 | Re-render Optimization | MEDIUM |
| 6 | Rendering Performance | MEDIUM |
| 7 | JavaScript Performance | LOW-MEDIUM |
| 8 | Advanced Patterns | LOW |
Quick Reference
Critical Patterns (Apply First)
Eliminate Waterfalls:
- Defer await until needed (move into branches)
- Use
Promise.all()for independent async operations - Start promises early, await late
- Use
better-allfor partial dependencies - Use Suspense boundaries to stream content
Reduce Bundle Size:
- Avoid barrel file imports (import directly from source)
- Use
next/dynamicfor heavy components - Defer non-critical third-party libraries
- Preload based on user intent
High-Impact Server Patterns
- Use
React.cache()for per-request deduplication - Use LRU cache for cross-request caching
- Minimize serialization at RSC boundaries
- Parallelize data fetching with component composition
Medium-Impact Client Patterns
- Use SWR for automatic request deduplication
- Defer state reads to usage point
- Use lazy state initialization for expensive values
- Use derived state subscriptions
- Apply
startTransitionfor non-urgent updates
Rendering Patterns
- Animate SVG wrappers, not SVG elements directly
- Use
content-visibility: autofor long lists - Prevent hydration mismatch with inline scripts
- Use explicit conditional rendering (
? :not&&)
JavaScript Patterns
- Batch DOM CSS changes via classes
- Build index maps for repeated lookups
- Cache repeated function calls
- Use
toSorted()instead ofsort()for immutability - Early length check for array comparisons
References
Full documentation with code examples is available in:
references/react-performance-guidelines.md- Complete guide with all patternsreferences/rules/- Individual rule files organized by category
To look up a specific pattern, grep the rules directory:
grep -l "suspense" references/rules/
grep -l "barrel" references/rules/
grep -l "swr" references/rules/Rule Categories in references/rules/
async-*- Waterfall elimination patternsbundle-*- Bundle size optimizationserver-*- Server-side performanceclient-*- Client-side data fetchingrerender-*- Re-render optimizationrendering-*- DOM rendering performancejs-*- JavaScript micro-optimizationsadvanced-*- Advanced patterns
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.

