{"id":"42a514b5-08e2-43ec-9bb5-676a6346cb3b","shortId":"DgQarK","kind":"skill","title":"react-best-practices","tagline":"Comprehensive performance optimization guide for React and Next.js applications, maintained by Vercel. Use when writing new React components or Next.js pages, implementing data fetching (client or server-side), or reviewing code for performance issues.","description":"# Vercel React Best Practices\n\nComprehensive performance optimization guide for React and Next.js applications, maintained by Vercel. Contains 45 rules across 8 categories, prioritized by impact to guide automated refactoring and code generation.\n\n## When to Use\nReference these guidelines when:\n- Writing new React components or Next.js pages\n- Implementing data fetching (client or server-side)\n- Reviewing code for performance issues\n- Refactoring existing React/Next.js code\n- Optimizing bundle size or load times\n\n## Rule Categories by Priority\n\n| Priority | Category | Impact | Prefix |\n|----------|----------|--------|--------|\n| 1 | Eliminating Waterfalls | CRITICAL | `async-` |\n| 2 | Bundle Size Optimization | CRITICAL | `bundle-` |\n| 3 | Server-Side Performance | HIGH | `server-` |\n| 4 | Client-Side Data Fetching | MEDIUM-HIGH | `client-` |\n| 5 | Re-render Optimization | MEDIUM | `rerender-` |\n| 6 | Rendering Performance | MEDIUM | `rendering-` |\n| 7 | JavaScript Performance | LOW-MEDIUM | `js-` |\n| 8 | Advanced Patterns | LOW | `advanced-` |\n\n## Quick Reference\n\n### 1. Eliminating Waterfalls (CRITICAL)\n\n- `async-defer-await` - Move await into branches where actually used\n- `async-parallel` - Use Promise.all() for independent operations\n- `async-dependencies` - Use better-all for partial dependencies\n- `async-api-routes` - Start promises early, await late in API routes\n- `async-suspense-boundaries` - Use Suspense to stream content\n\n### 2. Bundle Size Optimization (CRITICAL)\n\n- `bundle-barrel-imports` - Import directly, avoid barrel files\n- `bundle-dynamic-imports` - Use next/dynamic for heavy components\n- `bundle-defer-third-party` - Load analytics/logging after hydration\n- `bundle-conditional` - Load modules only when feature is activated\n- `bundle-preload` - Preload on hover/focus for perceived speed\n\n### 3. Server-Side Performance (HIGH)\n\n- `server-cache-react` - Use React.cache() for per-request deduplication\n- `server-cache-lru` - Use LRU cache for cross-request caching\n- `server-serialization` - Minimize data passed to client components\n- `server-parallel-fetching` - Restructure components to parallelize fetches\n- `server-after-nonblocking` - Use after() for non-blocking operations\n\n### 4. Client-Side Data Fetching (MEDIUM-HIGH)\n\n- `client-swr-dedup` - Use SWR for automatic request deduplication\n- `client-event-listeners` - Deduplicate global event listeners\n\n### 5. Re-render Optimization (MEDIUM)\n\n- `rerender-defer-reads` - Don't subscribe to state only used in callbacks\n- `rerender-memo` - Extract expensive work into memoized components\n- `rerender-dependencies` - Use primitive dependencies in effects\n- `rerender-derived-state` - Subscribe to derived booleans, not raw values\n- `rerender-functional-setstate` - Use functional setState for stable callbacks\n- `rerender-lazy-state-init` - Pass function to useState for expensive values\n- `rerender-transitions` - Use startTransition for non-urgent updates\n\n### 6. Rendering Performance (MEDIUM)\n\n- `rendering-animate-svg-wrapper` - Animate div wrapper, not SVG element\n- `rendering-content-visibility` - Use content-visibility for long lists\n- `rendering-hoist-jsx` - Extract static JSX outside components\n- `rendering-svg-precision` - Reduce SVG coordinate precision\n- `rendering-hydration-no-flicker` - Use inline script for client-only data\n- `rendering-activity` - Use Activity component for show/hide\n- `rendering-conditional-render` - Use ternary, not && for conditionals\n\n### 7. JavaScript Performance (LOW-MEDIUM)\n\n- `js-batch-dom-css` - Group CSS changes via classes or cssText\n- `js-index-maps` - Build Map for repeated lookups\n- `js-cache-property-access` - Cache object properties in loops\n- `js-cache-function-results` - Cache function results in module-level Map\n- `js-cache-storage` - Cache localStorage/sessionStorage reads\n- `js-combine-iterations` - Combine multiple filter/map into one loop\n- `js-length-check-first` - Check array length before expensive comparison\n- `js-early-exit` - Return early from functions\n- `js-hoist-regexp` - Hoist RegExp creation outside loops\n- `js-min-max-loop` - Use loop for min/max instead of sort\n- `js-set-map-lookups` - Use Set/Map for O(1) lookups\n- `js-tosorted-immutable` - Use toSorted() for immutability\n\n### 8. Advanced Patterns (LOW)\n\n- `advanced-event-handler-refs` - Store event handlers in refs\n- `advanced-use-latest` - useLatest for stable callback refs\n\n## How to Use\n\nRead individual rule files for detailed explanations and code examples:\n\n```\nrules/async-parallel.md\nrules/bundle-barrel-imports.md\nrules/_sections.md\n```\n\nEach rule file contains:\n- Brief explanation of why it matters\n- Incorrect code example with explanation\n- Correct code example with explanation\n- Additional context and references\n\n## Full Compiled Document\n\nFor the complete guide with all rules expanded: `AGENTS.md`\n\n## When to Use\nThis skill is applicable to execute the workflow or actions described in the overview.\n\n## Limitations\n- Use this skill only when the task clearly matches the scope described above.\n- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.\n- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.","tags":["react","best","practices","antigravity","awesome","skills","sickn33","agent-skills","agentic-skills","ai-agent-skills","ai-agents","ai-coding"],"capabilities":["skill","source-sickn33","skill-react-best-practices","topic-agent-skills","topic-agentic-skills","topic-ai-agent-skills","topic-ai-agents","topic-ai-coding","topic-ai-workflows","topic-antigravity","topic-antigravity-skills","topic-claude-code","topic-claude-code-skills","topic-codex-cli","topic-codex-skills"],"categories":["antigravity-awesome-skills"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/sickn33/antigravity-awesome-skills/react-best-practices","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add sickn33/antigravity-awesome-skills","source_repo":"https://github.com/sickn33/antigravity-awesome-skills","install_from":"skills.sh"}},"qualityScore":"0.700","qualityRationale":"deterministic score 0.70 from registry signals: · indexed on github topic:agent-skills · 34616 github stars · SKILL.md body (5,289 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-04-23T00:51:27.929Z","embedding":null,"createdAt":"2026-04-18T21:43:16.518Z","updatedAt":"2026-04-23T00:51:27.929Z","lastSeenAt":"2026-04-23T00:51:27.929Z","tsv":"'1':117,171,629 '2':122,225 '3':128,276 '4':135,334 '45':57 '5':145,361 '6':152,440 '7':157,513 '8':60,164,639 'access':544 'across':59 'action':726 'activ':266,498,500 'actual':184 'addit':698 'advanc':165,168,640,644,654 'advanced-event-handler-ref':643 'advanced-use-latest':653 'agents.md':713 'analytics/logging':254 'anim':446,449 'api':206,214 'applic':13,52,720 'array':586 'ask':764 'async':121,176,187,195,205,217 'async-api-rout':204 'async-defer-await':175 'async-depend':194 'async-parallel':186 'async-suspense-boundari':216 'autom':67 'automat':350 'avoid':236 'await':178,180,211 'barrel':232,237 'batch':521 'best':3,42 'better':199 'better-al':198 'block':332 'boolean':404 'boundari':219,772 'branch':182 'brief':682 'build':535 'bundl':104,123,127,226,231,240,249,258,268 'bundle-barrel-import':230 'bundle-condit':257 'bundle-defer-third-parti':248 'bundle-dynamic-import':239 'bundle-preload':267 'cach':284,295,299,304,542,545,552,555,565,567 'callback':379,417,660 'categori':61,110,114 'chang':526 'check':583,585 'clarif':766 'class':528 'clear':739 'client':29,89,137,144,312,336,344,354,493 'client-event-listen':353 'client-on':492 'client-sid':136,335 'client-swr-dedup':343 'code':36,70,95,102,673,689,694 'combin':572,574 'comparison':590 'compil':703 'complet':707 'compon':22,82,247,313,319,388,474,501 'comprehens':5,44 'condit':259,506,512 'contain':56,681 'content':224,457,461 'content-vis':460 'context':699 'coordin':481 'correct':693 'creation':605 'criteria':775 'critic':120,126,174,229 'cross':302 'cross-request':301 'css':523,525 'csstext':530 'data':27,87,139,309,338,495 'dedup':346 'dedupl':292,352,357 'defer':177,250,369 'depend':196,203,391,394 'deriv':399,403 'describ':727,743 'detail':670 'direct':235 'div':450 'document':704 'dom':522 'dynam':241 'earli':210,593,596 'effect':396 'element':454 'elimin':118,172 'environ':755 'environment-specif':754 'event':355,359,645,649 'exampl':674,690,695 'execut':722 'exist':100 'exit':594 'expand':712 'expens':384,428,589 'expert':760 'explan':671,683,692,697 'extract':383,470 'featur':264 'fetch':28,88,140,317,322,339 'file':238,668,680 'filter/map':576 'first':584 'flicker':487 'full':702 'function':410,413,424,553,556,598 'generat':71 'global':358 'group':524 'guid':8,47,66,708 'guidelin':77 'handler':646,650 'heavi':246 'high':133,143,281,342 'hoist':468,601,603 'hover/focus':272 'hydrat':256,485 'immut':634,638 'impact':64,115 'implement':26,86 'import':233,234,242 'incorrect':688 'independ':192 'index':533 'individu':666 'init':422 'inlin':489 'input':769 'instead':617 'issu':39,98 'iter':573 'javascript':158,514 'js':163,520,532,541,551,564,571,581,592,600,609,621,632 'js-batch-dom-css':519 'js-cache-function-result':550 'js-cache-property-access':540 'js-cache-storag':563 'js-combine-iter':570 'js-early-exit':591 'js-hoist-regexp':599 'js-index-map':531 'js-length-check-first':580 'js-min-max-loop':608 'js-set-map-lookup':620 'js-tosorted-immut':631 'jsx':469,472 'late':212 'latest':656 'lazi':420 'length':582,587 'level':561 'limit':731 'list':465 'listen':356,360 'load':107,253,260 'localstorage/sessionstorage':568 'long':464 'lookup':539,624,630 'loop':549,579,607,612,614 'low':161,167,517,642 'low-medium':160,516 'lru':296,298 'maintain':14,53 'map':534,536,562,623 'match':740 'matter':687 'max':611 'medium':142,150,155,162,341,366,443,518 'medium-high':141,340 'memo':382 'memoiz':387 'min':610 'min/max':616 'minim':308 'miss':777 'modul':261,560 'module-level':559 'move':179 'multipl':575 'new':20,80 'next.js':12,24,51,84 'next/dynamic':244 'non':331,437 'non-block':330 'non-urg':436 'nonblock':326 'o':628 'object':546 'one':578 'oper':193,333 'optim':7,46,103,125,149,228,365 'output':749 'outsid':473,606 'overview':730 'page':25,85 'parallel':188,316,321 'parti':252 'partial':202 'pass':310,423 'pattern':166,641 'per':290 'per-request':289 'perceiv':274 'perform':6,38,45,97,132,154,159,280,442,515 'permiss':770 'practic':4,43 'precis':478,482 'prefix':116 'preload':269,270 'primit':393 'priorit':62 'prioriti':112,113 'promis':209 'promise.all':190 'properti':543,547 'quick':169 'raw':406 're':147,363 're-rend':146,362 'react':2,10,21,41,49,81,285 'react-best-practic':1 'react.cache':287 'react/next.js':101 'read':370,569,665 'reduc':479 'ref':647,652,661 'refactor':68,99 'refer':75,170,701 'regexp':602,604 'render':148,153,156,364,441,445,456,467,476,484,497,505,507 'rendering-act':496 'rendering-animate-svg-wrapp':444 'rendering-conditional-rend':504 'rendering-content-vis':455 'rendering-hoist-jsx':466 'rendering-hydration-no-flick':483 'rendering-svg-precis':475 'repeat':538 'request':291,303,351 'requir':768 'rerend':151,368,381,390,398,409,419,431 'rerender-defer-read':367 'rerender-depend':389 'rerender-derived-st':397 'rerender-functional-setst':408 'rerender-lazy-state-init':418 'rerender-memo':380 'rerender-transit':430 'restructur':318 'result':554,557 'return':595 'review':35,94,761 'rout':207,215 'rule':58,109,667,679,711 'rules/_sections.md':677 'rules/async-parallel.md':675 'rules/bundle-barrel-imports.md':676 'safeti':771 'scope':742 'script':490 'serial':307 'server':32,92,130,134,278,283,294,306,315,324 'server-after-nonblock':323 'server-cache-lru':293 'server-cache-react':282 'server-parallel-fetch':314 'server-seri':305 'server-sid':31,91,129,277 'set':622 'set/map':626 'setstat':411,414 'show/hide':503 'side':33,93,131,138,279,337 'size':105,124,227 'skill':718,734 'skill-react-best-practices' 'sort':619 'source-sickn33' 'specif':756 'speed':275 'stabl':416,659 'start':208 'starttransit':434 'state':375,400,421 'static':471 'stop':762 'storag':566 'store':648 'stream':223 'subscrib':373,401 'substitut':752 'success':774 'suspens':218,221 'svg':447,453,477,480 'swr':345,348 'task':738 'ternari':509 'test':758 'third':251 'time':108 'topic-agent-skills' 'topic-agentic-skills' 'topic-ai-agent-skills' 'topic-ai-agents' 'topic-ai-coding' 'topic-ai-workflows' 'topic-antigravity' 'topic-antigravity-skills' 'topic-claude-code' 'topic-claude-code-skills' 'topic-codex-cli' 'topic-codex-skills' 'tosort':633,636 'transit':432 'treat':747 'updat':439 'urgent':438 'use':17,74,185,189,197,220,243,286,297,327,347,377,392,412,433,459,488,499,508,613,625,635,655,664,716,732 'uselatest':657 'usest':426 'valid':757 'valu':407,429 'vercel':16,40,55 'via':527 'visibl':458,462 'waterfal':119,173 'work':385 'workflow':724 'wrapper':448,451 'write':19,79","prices":[{"id":"7070c8f5-9f93-4680-92dd-1d105c5215d1","listingId":"42a514b5-08e2-43ec-9bb5-676a6346cb3b","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"sickn33","category":"antigravity-awesome-skills","install_from":"skills.sh"},"createdAt":"2026-04-18T21:43:16.518Z"}],"sources":[{"listingId":"42a514b5-08e2-43ec-9bb5-676a6346cb3b","source":"github","sourceId":"sickn33/antigravity-awesome-skills/react-best-practices","sourceUrl":"https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/react-best-practices","isPrimary":false,"firstSeenAt":"2026-04-18T21:43:16.518Z","lastSeenAt":"2026-04-23T00:51:27.929Z"}],"details":{"listingId":"42a514b5-08e2-43ec-9bb5-676a6346cb3b","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"sickn33","slug":"react-best-practices","github":{"repo":"sickn33/antigravity-awesome-skills","stars":34616,"topics":["agent-skills","agentic-skills","ai-agent-skills","ai-agents","ai-coding","ai-workflows","antigravity","antigravity-skills","claude-code","claude-code-skills","codex-cli","codex-skills","cursor","cursor-skills","developer-tools","gemini-cli","gemini-skills","kiro","mcp","skill-library"],"license":"mit","html_url":"https://github.com/sickn33/antigravity-awesome-skills","pushed_at":"2026-04-22T06:40:00Z","description":"Installable GitHub library of 1,400+ agentic skills for Claude Code, Cursor, Codex CLI, Gemini CLI, Antigravity, and more. Includes installer CLI, bundles, workflows, and official/community skill collections.","skill_md_sha":"4654be3c6805bc8245ef41d9c1696bb7b096cd2d","skill_md_path":"skills/react-best-practices/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/react-best-practices"},"layout":"multi","source":"github","category":"antigravity-awesome-skills","frontmatter":{"name":"react-best-practices","description":"Comprehensive performance optimization guide for React and Next.js applications, maintained by Vercel. Use when writing new React components or Next.js pages, implementing data fetching (client or server-side), or reviewing code for performance issues."},"skills_sh_url":"https://skills.sh/sickn33/antigravity-awesome-skills/react-best-practices"},"updatedAt":"2026-04-23T00:51:27.929Z"}}