
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-codeInstalls 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- Frontend Accessibility Best Practices896
- Frontend Tailwind Best Practices465
- Frontend React Router Best Practices402
- Frontend Js Best Practices336
- Ruby On Rails Best Practices282
- Frontend Async Best Practices225
- Frontend Internationalization Best Practices193
- Frontend Testing Best Practices2.2K
- Owasp Security Check1.7K