react-best-practices
Skill2 starsChanged 4 months agoMITView on GitHub
Build React UIs with clear composition, correct state placement, disciplined effects, and basic accessibility. Use when writing React components, hooks, fixing re-renders or effect bugs, or when the user mentions React, JSX, or client UI state.
71 other projects use a version of this.
Adopted by
Most recently taken up by
- gromov0737/skillstheir own version, first seen Nov 29, 2026
- hybridlabor-api/aostheir own version, first seen Nov 29, 2026
- marcioaltoe/skillstheir own version, first seen Nov 29, 2026
- laguagu/claude-code-nextjs-skillstheir own version, first seen Nov 25, 2026
- drinkspiller/skillstheir own version, first seen Nov 23, 2026
- baekenough/oh-my-customcodetheir own version, first seen Nov 23, 2026
Used with
Projects with it also use react-native-skills, composition-patterns and 9 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
eeaSkillreact-native-skills
React Native and Expo best practices for building performant mobile apps. Use when building React Native components, optimizing list performance, implementing animations, or working with native modules. Triggers on tasks involving React Native, Expo, mobile performance, or native platform APIs.
Also in 4 projects that use this
eeaSkillcomposition-patterns
React composition patterns that scale. Use when refactoring components with boolean prop proliferation, building flexible component libraries, or designing reusable APIs. Triggers on tasks involving compound components, render props, context providers, or component architecture. Includes React 19 API changes.
Also in 4 projects that use this
mcollinaSkillfastify-best-practices
Guides development of Fastify Node.js backend servers and REST APIs using TypeScript or JavaScript. Use when building, configuring, or debugging a Fastify application — including defining routes, implementing plugins, setting up JSON Schema validation, handling errors, optimising performance, managing authentication, configuring CORS and security headers, integrating databases, working with WebSockets, and deploying to production. Covers the full Fastify request lifecycle (hooks, serialization, logging with Pino) and TypeScript integration via strip types. Trigger terms: Fastify, Node.js server, REST API, API routes, backend framework, fastify.config, server.ts, app.ts.
Also in 3 projects that use this
KadajettSkillnestjs-best-practices
NestJS best practices and architecture patterns for building production-ready applications. This skill should be used when writing, reviewing, or refactoring NestJS code to ensure proper patterns for modules, dependency injection, security, and performance.
Also in 3 projects that use this
MicrosoftSkillplanning-with-files
**USE THIS FOR COMPLEX TASKS.** Implements Manus-style file-based planning for multi-step tasks. Creates task_plan.md, findings.md, and progress.md in .agent_cache/<task-name>/. Use when: implementing multiple APIs, refactoring modules, research tasks, or ANY task requiring >5 tool calls.
Also in 5 projects that use this
VercelSkillvercel-deploy
Deploy applications and websites to Vercel with a claimable preview. Use when the user requests deployment actions like "deploy my app", "deploy and give me the link", "push this live", or "create a preview deployment". No authentication required - returns preview URL and claimable deployment link.
Also in 3 projects that use this
Other versions71 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 71
- mastra-ai/mastra★ 30ksame name
- openai/plugins★ 8.4ksame name
- ryokun6/ryos★ 1.3ksame name
- involvex/youtube-music-cli★ 490same name
- vercel/vercel-plugin★ 353same name
- mikeOnBreeze/cc-crossbeam★ 297same name
- typv/nest-turbo-starter★ 224same name
- AvivK5498/Beads-Kanban-UI★ 102same name
- laguagu/claude-code-nextjs-skills★ 74same name
- ahonn/dotfiles★ 65same name
61 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository24 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- code-reviewSkill
- debuggingSkill
- javascript-best-practicesSkill
- nextjs-app-routerSkill
- nextjs-data-fetchingSkill
- python-best-practicesSkill
- python-testingSkill
- tagged-code-commentsSkill
- typescript-best-practicesSkill
- create-skillSkill
- revise-skillSkill
- academic-paperSkill
- latex-scientific-writingSkill
- paper-abstractSkill
- paper-conclusionSkill
- paper-discussionSkill
- paper-introductionSkill
- paper-literature-reviewSkill
- paper-methodsSkill
- paper-peer-reviewSkill
- paper-related-workSkill
- paper-resultsSkill
The file
We split this skill into the rules it gives an agent
7 rules. 0 are common, 3 are distinctive, and 4 are very specific to this project.
0
Common
Most of the 59 edited versions we read keep these.
3
Distinctive
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 21
Prefer deriving state over syncing with effects
- Distinctive: line 27
State placement: Keep state as local as possible.
- Very specific: line 28
Effects are escape hatches: Use useEffect for synchronizing with external systems (DOM, network subscriptions), not for computing …
- Distinctive: line 29
Lists need stable keys: Use stable IDs, not array indexes, when order can change.
- Very specific: line 31
Performance: Do not add useMemo/useCallback by default.
- Very specific: line 32
Accessibility baseline: Use button/link correctly.
- Very specific: line 33
Tag unfinished or risky work: Use the global tagged-code-comments convention (🔴 FIXME(P0):, 🟠 TODO(P1):, {/* 🟡 UX(P2): … */}).
“Common” is measured: kept by at least 6 in 10 of the 59 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
React Best Practices
Defaults
- Function components + hooks
- Colocate state with the nearest common consumer
- Prefer deriving state over syncing with effects
- Accessibility: semantic HTML first; labels for inputs; keyboard reachability
Instructions
- Composition over configuration. Split UI into small components with clear props. Prefer children/slots over boolean prop sprawl (
isHeader && …). - State placement. Keep state as local as possible. Lift only when siblings must share. Prefer URL/search params for shareable UI state when the app already does.
- Effects are escape hatches. Use
useEffectfor synchronizing with external systems (DOM, network subscriptions), not for computing renderable values. Prefer event handlers for user-driven updates. - Lists need stable keys. Use stable IDs, not array indexes, when order can change.
- Controlled vs uncontrolled. Pick one per input; do not flip-flop. For forms, follow the project's form library if present.
- Performance. Do not add
useMemo/useCallbackby default. Add them when profiling or when referential stability is required by a child/effect dep. Follow React Compiler guidance if the project uses it. - Accessibility baseline. Use button/link correctly; associate
<label htmlFor>; manage focus for dialogs; do not rely on color alone. - Tag unfinished or risky work. Use the global
tagged-code-commentsconvention (🔴 FIXME(P0):,🟠 TODO(P1):,{/* 🟡 UX(P2): … */}). Never leave silent stubs. End with an Open follow-ups table so the developer must check P0/P1 before ship.
Effect anti-pattern
// Bad: syncing derived state
const [fullName, setFullName] = useState("");
useEffect(() => {
setFullName(first + " " + last);
}, [first, last]);
// Good: derive during render
const fullName = `${first} ${last}`;Component sketch
type UserCardProps = {
name: string;
onSelect: (id: string) => void;
id: string;
};
export function UserCard({ id, name, onSelect }: UserCardProps) {
return (
<button type="button" onClick={() => onSelect(id)}>
{name}
</button>
);
}Anti-patterns
- Prop drilling deep trees when context or composition would clarify
- Effects that set state solely to mirror props
key={index}on reorderable lists- Div soup for interactive elements (
div onClickinstead ofbutton)
Additional resources
- references/checklist.md
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

