33 React performance and composition rules across bundle optimization, re-rendering, rendering, hooks, and component patterns.
Works with
Covers 6 rule categories: bundle size optimization (barrel imports, conditional loading, preloading), re-render prevention (functional setState, derived state, memoization), rendering performance (content-visibility, hydration, transitions), client patterns (passive listeners, localStorage versioning), hooks best practices (limiting useEffect, named functions), and
AI-first code editor with Composer
Before installing skills in Cursor, ensure your development environment meets these requirements:
node --versionfrontend-react-best-practicesExecute the skills CLI command in your project's root directory to begin installation:
Fetches frontend-react-best-practices from sergiodxa/agent-skills and configures it for Cursor.
The CLI shows a list of agents. Use arrow keys and space to select Cursor:
Confirm successful installation by checking the skill directory location:
Restart Cursor to activate frontend-react-best-practices. Access via /frontend-react-best-practices in your agent's command palette.
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your environment. Always review source, verify the publisher, and test in isolation before production.
Submit your Claude Code skill and start earning
Automate repetitive workflows and reduce manual effort
Example
Generate reports, summarize documents, draft communications
Save 3-5 hours per week on routine tasks
Learn new skills, understand complex topics, get expert guidance
Example
Explain concepts, provide examples, suggest learning resources
Accelerate learning and skill development by 2x
Enhance output quality through reviews, suggestions, and refinements
Example
Review drafts, suggest improvements, catch errors
Improve work quality by 30-40% with less effort
0
total installs
0
this week
82
GitHub stars
0
upvotes
Run in your terminal
0
installs
0
this week
82
stars
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.
Reference these guidelines when:
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";
Load modules only when feature is activated.
useEffect(() => {
if (enabled && typeof window !== "undefined") {
import("./heavy-module").then((mod) => setModule(mod));
}
}, [enabled]);
Preload on hover/focus for perceived speed.
<button
onMouseEnter={() => import("./editor")}
onFocus={() => import("./editor")}
onClick={openEditor}
>
Open Editor
</button>
Use functional setState for stable callbacks.
// Bad: stale closure risk, recreates on items change
const addItem = useCallback(
(item) => {
setItems([...items, item]);
},
[items],
);
// Good: always uses latest state, stable reference
const addItem = useCallback((item) => {
setItems((curr) => [...curr, item]);
}, []);
Derive state during render, not in effects.
// Bad: extra state and effect, extra render
const [fullName, setFullName] = useState("");
useEffect(() => {
setFullName(firstName + " " + lastName);
}, [firstName, lastName]);
// Good: derived directly during render
const fullName = firstName + " " + lastName;
Pass function to useState for expensive initial values.
// Bad: runs expensiveComputation() on every render
const [data] = useState(expensiveComputation());
// Good: runs only on initial render
const [data] = useState(() => expensiveComputation());
Use primitive dependencies in effects.
// Bad: runs on any user field change
useEffect(() => {
console.log(user.id);
}, [user]);
// Good: runs only when id changes
useEffect(() => {
console.log(user.id);
}, [user.id]);
Subscribe to derived booleans, not raw values.
// Bad: re-renders on every pixel change
const width = useWindowWidth();
const isMobile = width < 768;
// Good: re-renders only when boolean changes
const isMobile = useMediaQuery("(max-width: 767px)");
Extract expensive work into memoized components.
// Good: skips computation when loading
const UserAvatar = memo(function UserAvatar({ user }) {
let id = useMemo(() => computeAvatarId(user), [user]);
return <Avatar id={id} />;
});
function Profile({ user, loading }) {
if (loading) return <Skeleton />;
return <UserAvatar user={user} />;
}
Hoist default non-primitive props to constants.
// Bad: breaks memoization (new function each render)
const Button = memo(({ onClick = () => {} }) => ...)
// Good: stable default value
const NOOP = () => {}
const Button = memo(({ onClick = NOOP }) => ...)
Don't wrap simple primitive expressions in useMemo.
// Bad: useMemo overhead > expression cost
const isLoading = useMemo(() => a.loading || b.loading, [a.loading, b.loading]);
// Good: just compute it
Prerequisites
Time Estimate
15-45 minutes depending on use case complexity
Steps
Common Pitfalls
✓ Do
✗ Don't
💡 Pro Tips
✓ Use when
Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.
✗ Avoid when
Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.
asyrafhussin/agent-skills
jwynia/agent-skills
kadajett/agent-nestjs-skills
anthropics/claude-code
github/awesome-copilot
code-yeongyu/oh-my-opencode
frontend-react-best-practices fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
frontend-react-best-practices is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
Useful defaults in frontend-react-best-practices — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
Registry listing for frontend-react-best-practices matched our evaluation — installs cleanly and behaves as described in the markdown.
Useful defaults in frontend-react-best-practices — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
frontend-react-best-practices is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
Solid pick for teams standardizing on skills: frontend-react-best-practices is focused, and the summary matches what you get after install.
frontend-react-best-practices reduced setup friction for our internal harness; good balance of opinion and flexibility.
I recommend frontend-react-best-practices for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
Keeps context tight: frontend-react-best-practices is the kind of skill you can hand to a new teammate without a long onboarding doc.
showing 1-10 of 48