react-patterns
Skill4 starsChanged 56 days agoMITView on GitHub
Provides idiomatic React 18/19 and Next.js App Router patterns covering hooks discipline, composition, state colocation, server/client boundaries, Suspense and error boundaries, forms, data fetching, list keys, effects hygiene, and measurement-first performance work. Use when writing, reviewing, or refactoring React components, custom hooks, or Next.js routes.
47 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
- satvikgbusiness-jpg/Claude-skillstheir own version, first seen Nov 29, 2026
- jayavibhavnk/claude-skillstheir own version, first seen Nov 29, 2026
- Lukk17/agent-standardstheir own version, first seen Nov 24, 2026
- ku5ic/claude-kittheir own version, first seen Nov 16, 2026
Used with
Projects with it also use typescript-strict, testing-strategy and 10 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.
MicrosoftSkilltypescript-strict
Enable TypeScript strict mode (strict, noImplicitAny, strictNullChecks, etc.) in a project and fix the resulting errors without weakening types, tests, or runtime behavior. Use when asked to "enable strict mode", "turn on TypeScript strict", "fix strict errors", or migrate a codebase to strict type checking.
Also in 3 projects that use this
BlockSkilltesting-strategy
Guidelines for writing effective tests in this project
Also in 4 projects that use this
LangChainSkilldocker-patterns
Best practices for Docker containerization and multi-stage builds
Also in 4 projects that use this
MicrosoftSkillerror-handling
统一错误处理系统。在添加 API 端点、修改错误处理、添加前端 API 调用、编写错误相关测试时使用。
Also in 5 projects that use this
Wania-KazmiSkillbackend-patterns
Backend architecture patterns, API design, database optimization, and server-side best practices. Use when building APIs, services, or server-side functionality.
Also in 5 projects that use this
LangChainSkilldatabase-migrations
Database migration patterns and schema versioning
Also in 4 projects that use this
- +2 more from microsoft
Other versions47 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 47
- naomiaro/waveform-playlist★ 1.7ksame name
- openstory-so/openstory★ 730same name
- involvex/youtube-music-cli★ 490same name
- xenitV1/Antigravity-Workflows★ 130same name
- TangleML/tangle-ui★ 104same name
- maxyeh0817/Forge★ 34same name
- Fandry96/k3-agentic-skills★ 27same name
- VoDaiLocz/kilo-kit-mcp★ 27same name
- komluk/scaffolding★ 16same name
- hybridlabor-api/aos★ 9same name
37 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 repository13 other files it gives its agents.
- assessSkill
- brainstormingSkill
- brew-ideaSkill
- compound-learningsSkill
- executing-plansSkill
- flutter-patternsSkill
- jump-startSkill
- milestone-planningSkill
- python-patternsSkill
- tdd-workflowSkill
- using-opmSkill
- verification-before-completionSkill
- writing-plansSkill
The file
We split this skill into the rules it gives an agent
4 rules. 0 are common, 0 are distinctive, and 4 are very specific to this project.
0
Common
Most of the 43 edited versions we read keep these.
0
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
- Very specific: line 11
Always-true conventions (naming, hooks rules, state location, the server/client boundary, security) live in OPM's rule react/patterns.md …
- Very specific: line 51
Read references/hooks-state-and-lists.md when writing hooks or effects, placing state, composing components, or rendering lists.
- Very specific: line 52
Read references/server-data-and-forms.md when crossing the Server/Client boundary, fetching data, adding Suspense or error boundaries, or …
- Very specific: line 53
Read references/performance-and-a11y.md when optimising renders or bundles, or checking accessibility.
“Common” is measured: kept by at least 6 in 10 of the 43 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 Patterns
React rewards code that keeps render pure, puts state where it is used, and reaches for optimisation only after measuring. This skill is the checklist for that.
Always-true conventions (naming, hooks rules, state location, the server/client boundary,
security) live in OPM's rule react/patterns.md (.claude/rules/opm/react/ once installed,
rules/react/ in the plugin). This skill keeps the patterns and worked examples.
When to use
- Writing or modifying function components, custom hooks, or component trees.
- Reviewing JSX/TSX diffs.
- Choosing where state should live or how components should compose.
- Working across Server and Client Components in the Next.js App Router.
- Diagnosing slow renders, waterfalls, or oversized bundles.
Core rules
Render is a pure function of props and state. Derive during render; do not store derived values.
// Good
function Cart({ items }: { items: CartItem[] }) {
const total = items.reduce((sum, i) => sum + i.price * i.qty, 0);
return <span>{formatMoney(total)}</span>;
}
// Bad: an extra render, a chance to desync, and hidden data flow
function Cart({ items }: { items: CartItem[] }) {
const [total, setTotal] = useState(0);
useEffect(() => setTotal(items.reduce((s, i) => s + i.price * i.qty, 0)), [items]);
return <span>{formatMoney(total)}</span>;
}Side effects live in event handlers or useEffect, never in the render body.
Compose, do not inherit. children, slot props, and compound components cover every case.
Do not define components inside components. A new component type on every render remounts its subtree and loses state.
References
- Read references/hooks-state-and-lists.md when writing hooks or effects, placing state, composing components, or rendering lists.
- Read references/server-data-and-forms.md when crossing the Server/Client boundary, fetching data, adding Suspense or error boundaries, or building forms.
- Read references/performance-and-a11y.md when optimising renders or bundles, or checking accessibility.
Review checklist
- No derived state in
useState+useEffect. - Every effect has a reason to exist and a cleanup if it subscribes.
- Keys are stable ids; conditionals use ternaries where
0could leak. - State lives at the lowest component that needs it.
"use client"is at the leaves, not the layout.- Server Actions authenticate and authorise internally.
- Independent awaits run in parallel.
- Memoisation is justified by a profile or removed.
- Forms validate on the server; errors are announced (
role="alert").
Related skills
opm:tdd-workflow- component behaviour tests with Testing Library before implementation.opm:verification-before-completion(full gate) - build,tsc --noEmit, lint, tests before claiming done.
<!-- Adapted from affaan-m/ecc (MIT) -->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.

