تخطَّ إلى المحتوى
مهارةمستورد

react-best-practices

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.

وصف مستورد لم يراجعه محرر بعد

جاء هذا العنصر من مستودعه الأصلي وفحصناه آلياً فقط، ولم يكتب له محرر وصفاً عربياً بعد. اقرأ محتواه بنفسك قبل أن تعتمد عليه. ولا تُفهرس هذه الصفحة في محركات البحث حتى تُراجَع.

التنزيل

الملفات: 51 · الحجم: 129 ك.ب

نزّل ملف ZIP

يحمل الملف ترخيص المصدر الأصلي.

التثبيت

بعد التنزيل، شغّل الأمر في الطرفية. يسأل unzip قبل أن يستبدل أي ملف موجود.

  • لهذا المشروع

    يوضع في: .claude/skills/react-best-practices/

    mkdir -p .claude/skills && unzip ~/Downloads/react-best-practices.zip -d .claude/skills

  • لحسابك على الجهاز كله

    يوضع في: ~/.claude/skills/react-best-practices/

    mkdir -p ~/.claude/skills && unzip ~/Downloads/react-best-practices.zip -d ~/.claude/skills

التعليمات

Vercel React Best Practices

Comprehensive 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.

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

Rule Categories by Priority

PriorityCategoryImpactPrefix
1Eliminating WaterfallsCRITICALasync-
2Bundle Size OptimizationCRITICALbundle-
3Server-Side PerformanceHIGHserver-
4Client-Side Data FetchingMEDIUM-HIGHclient-
5Re-render OptimizationMEDIUMrerender-
6Rendering PerformanceMEDIUMrendering-
7JavaScript PerformanceLOW-MEDIUMjs-
8Advanced PatternsLOWadvanced-

Quick Reference

1. Eliminating Waterfalls (CRITICAL)

  • 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)

  • 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)

  • server-cache-react - Use React.cache() for per-request deduplication
  • server-cache-lru - Use LRU cache for cross-request caching
  • 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)

  • client-swr-dedup - Use SWR for automatic request deduplication
  • client-event-listeners - Deduplicate global event listeners

5. Re-render Optimization (MEDIUM)

  • rerender-defer-reads - Don't subscribe to state only used in callbacks
  • rerender-memo - Extract expensive work into memoized components
  • rerender-dependencies - Use primitive dependencies in effects
  • rerender-derived-state - Subscribe to derived booleans, not raw values
  • rerender-functional-setstate - Use functional setState for stable callbacks
  • rerender-lazy-state-init - Pass function to useState for expensive values
  • rerender-transitions - Use startTransition for non-urgent updates

6. Rendering Performance (MEDIUM)

  • 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-activity - Use Activity component for show/hide
  • rendering-conditional-render - Use ternary, not && for conditionals

7. JavaScript Performance (LOW-MEDIUM)

  • js-batch-dom-css - Group CSS changes via classes or cssText
  • js-index-maps - Build Map for repeated lookups
  • js-cache-property-access - Cache object properties in loops
  • js-cache-function-results - Cache function results in module-level Map
  • js-cache-storage - Cache localStorage/sessionStorage reads
  • js-combine-iterations - Combine multiple filter/map into one loop
  • js-length-check-first - Check array length before expensive comparison
  • js-early-exit - Return early from functions
  • js-hoist-regexp - Hoist RegExp creation outside loops
  • js-min-max-loop - Use loop for min/max instead of sort
  • js-set-map-lookups - Use Set/Map for O(1) lookups
  • js-tosorted-immutable - Use toSorted() for immutability

8. Advanced Patterns (LOW)

  • advanced-event-handler-refs - Store event handlers in refs
  • advanced-use-latest - useLatest for stable callback refs

How to Use

Read individual rule files for detailed explanations and code examples:

rules/async-parallel.md
rules/bundle-barrel-imports.md
rules/_sections.md

Each rule file contains:

  • Brief explanation of why it matters
  • Incorrect code example with explanation
  • Correct code example with explanation
  • Additional context and references

Full Compiled Document

For the complete guide with all rules expanded: AGENTS.md

الملفات

  • مجلدrules60 ك.ب
    • _sections.md1.5 ك.ب
    • _template.md631 بايت
    • advanced-event-handler-refs.md1.4 ك.ب
    • advanced-use-latest.md1.2 ك.ب
    • async-api-routes.md1.1 ك.ب
    • async-defer-await.md2 ك.ب
    • async-dependencies.md942 بايت
    • async-parallel.md654 بايت
    • async-suspense-boundaries.md2.5 ك.ب
    • bundle-barrel-imports.md2.3 ك.ب
    • bundle-conditional.md866 بايت
    • bundle-defer-third-party.md920 بايت
    • bundle-dynamic-imports.md791 بايت
    • bundle-preload.md1.1 ك.ب
    • client-event-listeners.md1.9 ك.ب
    • client-swr-dedup.md1.1 ك.ب
    • js-batch-dom-css.md1.9 ك.ب
    • js-cache-function-results.md1.9 ك.ب
    • js-cache-property-access.md532 بايت
    • js-cache-storage.md1.6 ك.ب
    • js-combine-iterations.md753 بايت
    • js-early-exit.md1.1 ك.ب
    • js-hoist-regexp.md1 ك.ب
    • js-index-maps.md837 بايت
    • js-length-check-first.md1.7 ك.ب
    • js-min-max-loop.md2.1 ك.ب
    • js-set-map-lookups.md532 بايت
    • js-tosorted-immutable.md1.7 ك.ب
    • rendering-activity.md564 بايت
    • rendering-animate-svg-wrapper.md1.2 ك.ب
    • rendering-conditional-render.md980 بايت
    • rendering-content-visibility.md815 بايت
    • rendering-hoist-jsx.md1 ك.ب
    • rendering-hydration-no-flicker.md2.3 ك.ب
    • rendering-svg-precision.md588 بايت
    • rerender-defer-reads.md973 بايت
    • rerender-dependencies.md824 بايت
    • rerender-derived-state.md724 بايت
    • rerender-functional-setstate.md2.9 ك.ب
    • rerender-lazy-state-init.md2 ك.ب
    • rerender-memo.md1.1 ك.ب
    • rerender-transitions.md1 ك.ب
    • server-after-nonblocking.md2 ك.ب
    • server-cache-lru.md1.3 ك.ب
    • server-cache-react.md681 بايت
    • server-parallel-fetching.md1.5 ك.ب
    • server-serialization.md996 بايت
  • AGENTS.md59 ك.ب
  • LICENSE1 ك.ب
  • README.md3.3 ك.ب
  • SKILL.md5.1 ك.ب
  • metadata.json921 بايت

التعليقات (0)

لا تعليقات بعد. كن أول من يعلّق.

سجّل الدخول لتعلّق. التعليق من المستوى 1 (عضو).

أبلغ

عناصر مشابهة

  • مهارةمستورد

    3d-web-experience

    Expert in building 3D experiences for the web - Three.js, React Three Fiber, Spline, WebGL, and interactive 3D scenes. Covers product configurators, 3D portfolios, immersive websites, and bringing depth to web experiences. Use when: 3D webs

    MITالملفات: 1

  • مهارةمستورد

    accessibility

    Audit and improve web accessibility following WCAG 2.1 guidelines. Use when asked to "improve accessibility", "a11y audit", "WCAG compliance", "screen reader support", "keyboard navigation", or "make accessible".

    MITالملفات: 2

  • مهارةمستورد

    accessibility-auditor

    Web accessibility specialist for WCAG compliance, ARIA implementation, and inclusive design. Use when auditing websites for accessibility issues, implementing WCAG 2.1 AA/AAA standards, testing with screen readers, or ensuring ADA complianc

    MITالملفات: 1

  • مهارةمستورد

    accessibility-compliance

    Implement WCAG 2.2 compliant interfaces with mobile accessibility, inclusive design patterns, and assistive technology support. Use when auditing accessibility, implementing ARIA patterns, building for screen readers, or ensuring inclusive

    MITالملفات: 5

  • مهارةمستورد

    algolia-search

    Expert patterns for Algolia search implementation, indexing strategies, React InstantSearch, and relevance tuning Use when: adding search to, algolia, instantsearch, search api, search functionality.

    MITالملفات: 1

  • مهارةمستورد

    angular

    Modern Angular (v20+) expert with deep knowledge of Signals, Standalone Components, Zoneless applications, SSR/Hydration, and reactive patterns.

    MITالملفات: 3