RE

react-best-practices

Provides 29 actionable rules for optimizing React performance, focusing on bundle size and re-render efficiency.

Install

mkdir -p .claude/skills/react-best-practices && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/1543" && unzip -o skill.zip -d .claude/skills/react-best-practices && rm skill.zip

Installs to .claude/skills/react-best-practices

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Client-side React performance optimization patterns.
52 charsno explicit “when” trigger
Intermediate

Key capabilities

  • Optimize React bundle size by importing from source files
  • Implement code splitting for heavy React components using `React.lazy`
  • Memoize expensive computations to prevent re-renders
  • Minimize hook dependency arrays to reduce re-renders
  • Use `useTransition` for non-urgent React updates
  • Batch DOM reads and writes to avoid layout thrashing

How it works

The skill provides rules categorized into bundle optimization, re-render prevention, rendering, async operations, JavaScript, and browser interactions. It details specific patterns like `React.lazy` for code splitting and `setState(prev => ...)` for functional state updates.

Inputs & outputs

You give it
React component code or a description of a performance issue
You get back
Optimized React code following best practices for performance

When to use react-best-practices

  • Optimize React bundle size
  • Debug component re-render performance
  • Implement React.lazy code splitting
  • Memoize expensive computations

About this skill

React Best Practices

Client-side React optimization patterns for Cloud UI. 29 rules organized by category and impact.

Activation Conditions

  • Performance optimization tasks
  • Component re-render issues
  • Bundle size concerns
  • useEffect/useMemo patterns

Rules by Category

Bundle Optimization (CRITICAL)

RuleKey Point
bundle-barrel-importsImport from source files, not barrel index.ts
bundle-code-splittingReact.lazy + Suspense for heavy components, conditional loads, deferred 3rd-party
bundle-preloadPreload critical resources

Re-render Prevention (HIGH)

RuleKey Point
rerender-memoMemoize expensive computations
rerender-dependenciesMinimize hook dependency arrays
rerender-derived-stateCompute during render, not in effects
rerender-functional-setstatesetState(prev => ...) to avoid stale closures
rerender-lazy-state-inituseState(() => expensive()) not useState(expensive())
rerender-simple-expression-in-memoDon't memoize trivial expressions
rerender-transitionsuseTransition for non-urgent updates
rerender-defer-readsRead URL params / storage inside callbacks, not at render

Rendering (MEDIUM)

RuleKey Point
rendering-conditional-renderShort-circuit with && / ternary, avoid render in effects
rendering-hoist-jsxMove static JSX outside components
rendering-content-visibilityCSS content-visibility: auto for off-screen
rendering-activityReact <Activity> for hidden UI
rendering-animate-svg-wrapperWrap animated SVGs to isolate re-renders
rendering-svg-precisionLimit SVG coordinate precision

Async (MEDIUM)

RuleKey Point
async-suspense-boundariesGranular <Suspense> boundaries
async-defer-awaitDon't await non-blocking work
async-dependenciesLoad deps in parallel, not sequentially

JavaScript (MEDIUM)

RuleKey Point
js-caching-patternsModule-level Map caches for repeated calls + storage reads
js-batch-dom-cssBatch DOM reads/writes to avoid layout thrashing
js-index-mapsPre-index arrays into Maps for O(1) lookups
js-length-check-firstCheck .length before expensive operations
js-tosorted-immutableUse .toSorted() / .toReversed() for immutable transforms

RegExp hoisting is enforced by Biome (useTopLevelRegex).

Browser (MEDIUM)

RuleKey Point
client-event-listenersClean up event listeners in useEffect return
client-passive-event-listeners{ passive: true } for scroll/touch handlers

Advanced (LOW)

RuleKey Point
advanced-event-handler-refsStable callback refs to avoid child re-renders
advanced-use-latestuseLatest pattern for always-current values in callbacks

When not to use it

  • When memoizing trivial expressions
  • When awaiting non-blocking work unnecessarily
  • When loading dependencies sequentially instead of in parallel

Limitations

  • The skill advises against memoizing trivial expressions
  • The skill advises against awaiting non-blocking work
  • The skill advises against loading dependencies sequentially

How it compares

This skill offers a categorized list of specific, actionable rules for React performance optimization, providing a direct solution compared to general programming advice.

Compared to similar skills

react-best-practices side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
react-best-practices (this skill)223moNo flagsIntermediate
react-component-performance25moNo flagsAdvanced
feature-flags66moReviewIntermediate
senior-qa62moReviewIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

More by redpanda-data

View all by redpanda-data

code-standards

redpanda-data

TypeScript, React, and JavaScript best practices enforced by Ultracite/Biome.

27

bloblang-authoring

redpanda-data

This skill should be used when users need to create or debug Bloblang transformation scripts. Trigger when users ask about transforming data, mapping fields, parsing JSON/CSV/XML, converting timestamps, filtering arrays, or mention "bloblang", "blobl", "mapping processor", or describe any data transformation need like "convert this to that" or "transform my JSON".

12

component-search

redpanda-data

This skill should be used when users need to discover Redpanda Connect components for their streaming pipelines. Trigger when users ask about finding inputs, outputs, processors, or other components, or when they mention specific technologies like "kafka consumer", "postgres output", "http server", or ask "which component should I use for X".

12

e2e-tester

redpanda-data

Write and run Playwright E2E tests for Redpanda Console using testcontainers. Analyzes test failures, adds missing testids, and improves test stability. Use when user requests E2E tests, Playwright tests, integration tests, test failures, missing testids, or mentions 'test workflow', 'browser testing', 'end-to-end', or 'testcontainers'.

13

form-refactorer

redpanda-data

Refactor legacy forms to use modern Redpanda UI Registry Field components with react-hook-form and Zod validation. Use when user requests: (1) Form refactoring or modernization, (2) Converting Chakra UI or @redpanda-data/ui forms, (3) Updating forms to use Field components, (4) Migrating from legacy form patterns, (5) Implementing forms with react-hook-form and Zod validation.

13

pipeline-assistant

redpanda-data

This skill should be used when users need to create or fix Redpanda Connect pipeline configurations. Trigger when users mention "config", "pipeline", "YAML", "create a config", "fix my config", "validate my pipeline", or describe a streaming pipeline need like "read from Kafka and write to S3".

13

You might also like

react-component-performance

Dimillian

Analyze and optimize React component performance issues (slow renders, re-render thrash, laggy lists, expensive computations). Use when asked to profile or improve a React component, reduce re-renders, or speed up UI updates in React apps.

25

feature-flags

facebook

Use when feature flag tests fail, flags need updating, understanding @gate pragmas, debugging channel-specific test failures, or adding new flags to React.

642

senior-qa

alirezarezvani

This skill should be used when the user asks to "generate tests", "write unit tests", "analyze test coverage", "scaffold E2E tests", "set up Playwright", "configure Jest", "implement testing patterns", or "improve test quality". Use for React/Next.js testing with Jest, React Testing Library, and Playwright.

628

harden

Aixbox

Improve interface resilience through better error handling, i18n support, text overflow handling, and edge case management. Makes interfaces robust and production-ready. Use when the user asks to harden, make production-ready, handle edge cases, add error states, or fix overflow and i18n issues.

00

benchmark-guardian

siliconjungle

Use for JS/TS performance-sensitive changes, benchmark additions, benchmark regressions, benchmark result JSON, or any claim that code is faster, smaller, cheaper, or not slower.

00

accessibility-compliance

wshobson

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 user experiences.

45132

Search skills

Search the agent skills registry