react
Skill1 starsChanged 4 months agoMITView on GitHub
Write idiomatic, correct, and performant React — Rules of Hooks and dependency arrays, recognizing when an effect is the wrong tool, stable list keys, composition and state placement, controlled vs uncontrolled inputs, memoization judgment (useMemo/useCallback/React.memo only where a measured re-render cost justifies it), and avoiding data-fetching waterfalls or misplaced client-only code in SSR-capable setups. Use when package.json lists react, react-dom, or next as a dependency, when authoring or reviewing .jsx/.tsx component code, or when asked directly (Thai or English) to เขียนหรือตรวจโค้ด React ให้ถูกต้องและมีประสิทธิภาพ. Not a replacement for frontend-dev's framework-agnostic UI work or html-css's semantic/accessibility foundation — this is the React-specific expertise layer built on top of both.
30 other projects use a version of this.
Adopted by
Most recently taken up by
- lobehub/lobehubtheir own version, first seen Oct 1, 2026
- compozy/compozytheir own version, first seen Oct 1, 2026
- vercel-labs/json-rendertheir own version, first seen Sep 23, 2026
- dafaalz/agent-skillstheir own version, first seen Sep 22, 2026
- AvilaCarlosDev/openclaw-skillstheir own version, first seen Sep 19, 2026
- danielteles/awesome-agent-skillstheir own version, first seen Sep 2, 2026
Used with
Projects with it also use app-renderer-systems, refactoring-analysis and 8 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.
pedronauckSkillapp-renderer-systems
Create, extend, or debug frontend domain modules organized under systems/. Covers adapters, Query hooks, local state, and public exports; excludes generic components and backend implementation.
Also in 3 projects that use this
pedronauckSkillrefactoring-analysis
Audit code quality and architectural health or plan refactoring using Fowler code smells and techniques; write prioritized findings to docs/_refacs/. Excludes formatting, performance, and security audits.
Also in 3 projects that use this
akornmeierSkilltailwindcss
Guide for implementing Tailwind CSS - a utility-first CSS framework for rapid UI development. Use when styling applications with responsive design, dark mode, custom themes, or building design systems with Tailwind's utility classes.
Also in 6 projects that use this
MindrallySkillprisma
Expert in Prisma ORM with type-safe database operations and schema design
Also in 4 projects that use this
joabgonzalezSkillexpress
Express.js routing, middleware, and error handling. Trigger: When building REST APIs or server logic with Express.
Also in 3 projects that use this
barisariburnuSkilltanstack
Expert assistance for TanStack Router, Query (v5), and Table (v8). Use when users need help with file-based routing, type-safe navigation, data loading, search params, queries, mutations, optimistic updates, infinite queries, table state management, or debugging TanStack libraries.
Also in 3 projects that use this
- +1 more from pedronauck
Other versions30 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 30
- lobehub/lobehub★ 83ksame name
- vercel-labs/json-render★ 18ksame name
- compozy/compozy★ 2.8ksame name
- openops-cloud/openops★ 1.1ksame name
- pedronauck/skills★ 633same name
- Mindrally/skills★ 266same name
- magnus919/agent-skills★ 109same name
- dylantarre/design-system-skills★ 50same name
- nimadorostkar/Claude-Skills-collection★ 28same name
- sordi-ai/skill-everything★ 20same name
20 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 repository20 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- agent-flowSkill
- dev-testingSkill
- dry-and-corSkill
- electronSkill
- firebaseSkill
- flutterSkill
- google-authSkill
- html-cssSkill
- mysqlSkill
- nodejsSkill
- postgresSkill
- sqliteSkill
- stack-briefingSkill
- supabaseSkill
- tailwindSkill
- tursoSkill
- typescriptSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
16 rules. 0 are common, 2 are distinctive, and 14 are very specific to this project.
0
Common
Most of the 23 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
14
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 17
Check package.json for react, react-dom, or next, or the presence of .jsx/.tsx files, or a direct request for React code.
- Very specific: line 20
If the task is markup semantics or accessibility rather than component behavior, that's html-css directly — it applies whether or not JSX …
- Very specific: line 32
Don't silence exhaustive-deps to quiet the warning.
- Very specific: line 34
Use a functional updater (setX(prev => ...)) when next state depends on previous state, to avoid stale closures in async or rapid handlers.
- Very specific: line 39
Before writing useEffect, ask: is this actually derived state?
- Distinctive: line 55
If nothing external is involved, the effect is almost always removable.
- Very specific: line 64
Don't use key as a shortcut to force a remount unless a full remount is genuinely intended (e.g.
- Very specific: line 71
Prefer composition (children, render props, slot props) over deep prop drilling or reaching for context early — context is for values …
- Very specific: line 86
Default to no memoization — useMemo/useCallback/React.memo cost their own comparison and allocation.
- Distinctive: line 122
Don't call hooks conditionally, in a loop, or after an early return.
- Very specific: line 123
Don't add a useEffect to compute a value that's already derivable during render.
- Very specific: line 125
Don't use the array index as key on a list that can reorder, filter, or splice.
- Very specific: line 127
Don't leave an input half-controlled (value with no onChange, or a value that toggles to undefined).
- Very specific: line 129
Don't add useMemo/useCallback/React.memo by default — unjustified memoization is often slower than the render it's avoiding.
- Very specific: line 131
Don't fetch a child's data inside a useEffect that only fires after a parent fetch resolves — coordinate the fetch instead.
- Very specific: line 133
Don't mark a component client-only just because it sits inside a React tree, and don't skip html-css's semantic/accessibility rules just …
“Common” is measured: kept by at least 6 in 10 of the 23 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
frontend-dev's React-specific expertise layer: that agent is
framework-agnostic and matches whatever's already in the project — this
skill is the actual React knowledge it draws on when the framework happens
to be React. skills/html-css/SKILL.md still applies underneath JSX —
semantics, labels, landmarks, and keyboard/contrast rules don't stop
mattering because the markup is generated by a component.
Step 1 — Confirm this is React work
Check package.json for react, react-dom, or next, or the presence of
.jsx/.tsx files, or a direct request for React code. If none of that
holds, stop — use frontend-dev for whatever framework is actually there.
If the task is markup semantics or accessibility rather than component
behavior, that's html-css directly — it applies whether or not JSX is
involved.
Step 2 — Rules of Hooks and dependency arrays
- Hooks are called only at the top level of a function component or a
custom hook (named
useXxx) — never insideif/for/switch, never after an earlyreturn, never in a nested callback. Call order must be identical every render; that's the whole mechanism hooks rely on. - The dependency array lists every reactive value the effect body reads —
a missing dependency isn't an optimization, it's a stale-closure bug.
Don't silence
exhaustive-depsto quiet the warning; fix the actual cause. - Use a functional updater (
setX(prev => ...)) when next state depends on previous state, to avoid stale closures in async or rapid handlers.
Step 3 — Effects: when they're the wrong tool
Before writing useEffect, ask: is this actually derived state? If a value
can be computed straight from existing props/state, compute it during
render (or wrap in useMemo if expensive) — don't useEffect + setState
to mirror one value into another.
// Wrong: effect just to derive a value
const [fullName, setFullName] = useState('');
useEffect(() => setFullName(`${first} ${last}`), [first, last]);
// Right: derived during render, no effect needed
const fullName = `${first} ${last}`;Effects are for synchronizing with something outside React — a subscription, a DOM API, a timer, a third-party widget, a network request. If nothing external is involved, the effect is almost always removable.
Step 4 — Keys and list correctness
- Keys are a stable, unique id from the data, on the outermost element the mapped callback returns — never array index once a list can reorder, filter, or insert/remove; index keys reattach state (inputs, toggles, animations) to the wrong row after the list changes shape. Index-as-key is fine only for a genuinely static list.
- Don't use
keyas a shortcut to force a remount unless a full remount is genuinely intended (e.g. resetting a form per entity id).
Step 5 — Composition, state placement, controlled inputs
- Colocate state with the component that owns it; lift only once a sibling genuinely needs it, not pre-emptively "just in case."
- Prefer composition (
children, render props, slot props) over deep prop drilling or reaching for context early — context is for values genuinely global to a subtree (theme, auth, locale), not a shortcut around passing two props. - Context re-renders every consumer on every value change regardless of
which slice it reads — split into narrower contexts or memoize the
provided value; wrapping consumers in
memodoesn't help, it guards against prop changes, not context changes. - Controlled (
value+onChange) vs uncontrolled (ref+defaultValue) — pick one per input and stay consistent; avaluethat flips between a real value andundefinedacross renders breaks the contract and React warns about it.
Step 6 — Memoization judgment
- Default to no memoization —
useMemo/useCallback/React.memocost their own comparison and allocation; add them only where a value must stay referentially stable (a dependency elsewhere, a prop into a memoized child) or a measured re-render is actually expensive. - Confirm with the React DevTools Profiler (or equivalent) that a
component re-renders often with unchanged props and that its render is
expensive before wrapping it in
memo— not on habit. - Splitting a component so expensive work lives in a smaller subtree is often simpler and cheaper than memoizing the whole thing.
Step 7 — Data fetching and client/server boundaries
- A child that only starts fetching after its parent's fetch resolves is a
waterfall — fix with
Promise.all/parallel queries or a fetch at a shared ancestor, not inside each leaf's own effect. Watch for the hidden case: a list renders, then each item fetches its own detail data in auseEffect— an N+1 waterfall. - On SSR/RSC setups (server components, loaders, a
getServerSideProps-style function), fetch there instead of in a client effect — one server round trip beats N client ones. - Code touching
window,document,localStorage, or other browser-only APIs must not execute during server render — guard it with the framework's client-boundary mechanism, not a crash-and-catch. Mark a component client-only because it needs a browser API or interactivity, not just because it sits inside a React tree.
Step 8 — Self-check before reporting done
Confirm no hook is called conditionally or after an early return, and every
dependency array is complete. Confirm list keys are stable ids, not
indexes, on anything that can reorder, and any memoization added is
justified by a measured re-render cost, not habit. Confirm the JSX still
holds up against html-css's structure/accessibility checks.
What not to do
- Don't call hooks conditionally, in a loop, or after an early return.
- Don't add a
useEffectto compute a value that's already derivable during render. - Don't use the array index as
keyon a list that can reorder, filter, or splice. - Don't leave an input half-controlled (
valuewith noonChange, or avaluethat toggles toundefined). - Don't add
useMemo/useCallback/React.memoby default — unjustified memoization is often slower than the render it's avoiding. - Don't fetch a child's data inside a
useEffectthat only fires after a parent fetch resolves — coordinate the fetch instead. - Don't mark a component client-only just because it sits inside a React
tree, and don't skip
html-css's semantic/accessibility rules just because the markup is now JSX.
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.

