Skip to content
sergiodxa avatar

Frontend React Best Practices

React performance rules and composition patterns covering re-renders, bundle size, and hydration pitfalls.

CCM score
59 of 100
skills.sh installs
1.2K
GitHub stars
92
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers 33 rules across six categories: bundle size, re-render optimization, rendering performance, and related React patterns
  • Includes code examples contrasting bad and good patterns for barrel imports, lazy setState, memoization, and startTransition
  • Enforces direct source imports, derived state computed during render, and event-handler logic instead of effects
  • Designed for reviewing and refactoring React components where render cost and bundle weight matter

Install

$ npx -y skills add sergiodxa/agent-skills --skill frontend-react-best-practices -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

React Best Practices

Performance optimization and composition patterns for React components. Contains 33 rules across 6 categories focused on reducing re-renders, optimizing bundles, component composition, and avoiding common React pitfalls.

When to Apply

Reference these guidelines when:

  • Writing new React components
  • Reviewing code for performance issues
  • Refactoring existing React code
  • Optimizing bundle size
  • Working with hooks and state

Rules Summary

Bundle Size Optimization (CRITICAL)

bundle-barrel-imports - @rules/bundle-barrel-imports.md

Import directly from source, avoid barrel files.

// Bad: loads entire library (200-800ms)
import { Check, X } from "lucide-react";

// Good: loads only what you need
import Check from "lucide-react/dist/esm/icons/check";
import X from "lucide-react/dist/esm/icons/x";
bundle-conditional - @rules/bundle-conditional.md

Load modules only when feature is activated.

useEffect(() => {
  if (enabled && typeof window !== "undefined") {
    import("./heavy-module").then((mod) => setModule(mod));
  }
}, [enabled]);
bundle-preload - @rules/bundle-preload.md

Details

Repository
github.com/sergiodxa/agent-skills
Categories
Frontend & UI Code, Code Review & Quality
First seen
Apr 16, 2026

More from sergiodxa/agent-skills

All 10

Similar to Frontend React Best Practices

More Frontend & UI Code