sergiodxa avatar

Frontend React Best Practices

This is a comprehensive ruleset covering 33 React patterns you'll actually hit in production work. It's organized into six categories, with the bundle optimization section being especially practical. The barrel import rule alone (showing how `import { Check } from "lucide-react"` can cost you 200-800ms) is worth the price of admission. The re-render section is solid on functional setState and derived state patterns, though some rules like "don't useMemo simple expressions" feel obvious once you've been burned. The hydration and SSR guidance is specific enough to be useful. Good reference for code reviews or when you're chasing down why your component tree is re-rendering on every mouse move.

skills.sh installs
1.2K
GitHub stars
92
last updated
Aug 21, 2026

Install

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

Installs into .claude/skills of the current project.

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

Sponsors

Details

Repository
github.com/sergiodxa/agent-skills
Categories
Frontend Development, Documentation, Code Review & Quality, AI & Agent Building, Debugging
First seen
Apr 16, 2026

More from sergiodxa/agent-skills

All 10
1bobmatnyc avatartailwind-cssbobmatnyc/claude-mpm-skillsTailwind CSS utility-first framework for rapid UI development with responsive design and dark mode1.2Kskills.sh installs
2onewave-ai avatarresponsive-layout-builderonewave-ai/claude-skillsBuild responsive layouts with CSS Grid, Flexbox, and container queries. Use when creating responsive designs, fixing layout issues, or building mobile-first lay370skills.sh installs
3oguzhan18 avatarangular-tailwindoguzhan18/angular-ecosystem-skillsALWAYS use when working with Angular and Tailwind CSS, Tailwind configuration, utility-first CSS, or styling Angular applications with Tailwind.245skills.sh installs
4am-will avatarFrontend Responsive Design Standardsam-will/codex-skillsBuild responsive, mobile-first layouts using fluid containers, flexible units, media queries, and touch-friendly design that works across all screen sizes. Use 0skills.sh installs
5analogjs avatarangular-componentanalogjs/angular-skillsCreate modern Angular standalone components following v20+ best practices. Use for building UI components with signal-based inputs/outputs, OnPush change detect11.7Kskills.sh installs
6nank1ro avatarshadcn-ui-flutternank1ro/flutter-shadcn-uiA comprehensive Flutter UI library inspired by shadcn/ui. Provides high-quality, customizable, and accessible components including Buttons, Cards, Forms, and mo720skills.sh installs