react-best-practices
БесплатноБез исполняемых скриптовНе проверенReact and Next.js performance optimization guidelines from Vercel Engineering. 57 rules across 8 categories for writing, reviewing, and refactoring React code.
от bighardperson★ 71 звезда на GitHubОб этом скилле
React Best Practices
Comprehensive performance optimization guide for React and Next.js applications from Vercel Engineering. Contains 57 rules across 8 categories, prioritized by impact.
Installation
OpenClaw / Moltbot / Clawbot
npx clawhub@latest install react-best-practices
WHAT This Skill Does
Provides actionable rules for:
- Eliminating request waterfalls
- Optimizing bundle size
- Improving server-side performance
- Efficient client-side data fetching
- Minimizing re-renders
- Rendering performance optimizations
- JavaScript micro-optimizations
- Advanced patterns for edge cases
WHEN To Use
- Writing new React components or Next.js pages
- Implementing data fetching (client or server-side)
- Reviewing code for performance issues
- Refactoring React/Next.js applications
- Optimizing bundle size or load times
- Debugging slow renders or waterfalls
KEYWORDS
react performance, nextjs optimization, bundle size, waterfalls, suspense, server components, rsc, rerender, usememo, dynamic import, parallel fetching, cache, swr
Rule Categories by Priority
| Priority | Category | Impact | Rule Prefix |
|---|---|---|---|
| 1 | Eliminating Waterfalls | CRITICAL | async- |
| 2 | Bundle Size Optimization | CRITICAL | bundle- |
| 3 | Server-Side Performance | HIGH | server- |
| 4 | Client-Side Data Fetching | MEDIUM-HIGH | client- |
| 5 | Re-render Optimization | MEDIUM | rerender- |
| 6 | Rendering Performance | MEDIUM | rendering- |
| 7 | JavaScript Performance | LOW-MEDIUM | js- |
| 8 | Advanced Patterns | LOW | advanced- |
Quick Reference
1. Eliminating Waterfalls (CRITICAL)
| Rule | Description |
|---|---|
async-defer-await |
Move await into branches where actually used |
async-parallel |
Use Promise.all() for independent operations |
async-dependencies |
Use better-all for partial dependencies |
async-api-routes |
Start promises early, await late in API routes |
async-suspense-boundaries |
Use Suspense to stream content |
2. Bundle Size Optimization (CRITICAL)
| Rule | Description |
|---|---|
bundle-barrel-imports |
Import directly, avoid barrel files |
bundle-dynamic-imports |
Use next/dynamic for heavy components |
bundle-defer-third-party |
Load analytics/logging after hydration |
bundle-conditional |
Load modules only when feature is activated |
bundle-preload |
Preload on hover/focus for perceived speed |
3. Server-Side Performance (HIGH)
| Rule | Description |
|---|---|
server-auth-actions |
Authenticate server actions like API routes |
server-cache-react |
Use React.cache() for per-request dedup |
server-cache-lru |
Use LRU cache for cross-request caching |
server-dedup-props |
Avoid duplicate serialization in RSC props |
server-serialization |
Minimize data passed to client components |
server-parallel-fetching |
Restructure components to parallelize fetches |
server-after-nonblocking |
Use after() for non-blocking operations |
4. Client-Side Data Fetching (MEDIUM-HIGH)
| Rule | Description |
|---|---|
client-swr-dedup |
Use SWR for automatic request deduplication |
client-event-listeners |
Deduplicate global event listeners |
client-passive-event-listeners |
Use passive listeners for scroll |
client-localstorage-schema |
Version and minimize localStorage data |
5. Re-render Optimization (MEDIUM)
| Rule | Description |
|---|---|
rerender-defer-reads |
Don't subscribe to state only used in callbacks |
rerender-memo |
Extract expensive work into memoized components |
rerender-memo-with-default-value |
Hoist default non-primitive props |
rerender-dependencies |
Use primitive dependencies in effects |
rerender-derived-state |
Subscribe to derived booleans, not raw values |
rerender-derived-state-no-effect |
Derive state during render, not effects |
rerender-functional-setstate |
Use functional setState for stable callbacks |
rerender-lazy-state-init |
Pass function to useState for expensive values |
rerender-simple-expression-in-memo |
Avoid memo for simple primitives |
rerender-move-effect-to-event |
Put interaction logic in event handlers |
rerender-transitions |
Use startTransition for non-urgent updates |
rerender-use-ref-transient-values |
Use refs for transient frequent values |
6. Rendering Performance (MEDIUM)
| Rule | Description |
|---|---|
rendering-animate-svg-wrapper |
Animate div wrapper, not SVG element |
rendering-content-visibility |
Use content-visibility for long lists |
rendering-hoist-jsx |
Extract static JSX outside components |
rendering-svg-precision |
Reduce SVG coordinate precision |
rendering-hydration-no-flicker |
Use inline script for client-only data |
rendering-hydration-suppress-warning |
Suppress expected misma |
Установить react-best-practices в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл react-best-practices?
React and Next.js performance optimization guidelines from Vercel Engineering. 57 rules across 8 categories for writing, reviewing, and refactoring React code.
Как установить скилл react-best-practices?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл react-best-practices запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic