react-patterns
Skill15 starsChanged 2 months agoMITView on GitHub
React + TypeScript component and hook standards. TRIGGER when: creating components, custom hooks, or reviewing React code. SKIP: visual styling and theme tokens (use mui-styling); global store design (use state-management).
29 other projects use a version of this.
Adopted by
Most recently taken up by
- ku5ic/claude-kittheir own version, first seen Oct 6, 2026
- Lukk17/agent-standardstheir own version, first seen Oct 5, 2026
- lintangknitto/agent-skillstheir own version, first seen Sep 23, 2026
- templetongroup/radianttheir own version, first seen Sep 17, 2026
- SkotAlexsander/skillstheir own version, first seen Sep 16, 2026
- MortuisVMain/ai-agent-superpowerstheir own version, first seen Sep 15, 2026
Used with
Projects with it also use typescript-strict, fastapi-patterns and 6 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.
kevinaimonsterSkilltypescript-strict
TypeScript strict mode and advanced type system assistant. Helps write strictly-typed TypeScript code with generics, type guards, utility types, conditional types, mapped types, and template literal types. Trigger when user says 'TypeScript types' 'type gymnastics' 'TypeScript generics' 'strict TypeScript' 'type guard' 'TS类型' 'TypeScript严格模式' '类型体操' '泛型怎么写' 'TS type help'. Keywords: TypeScript, strict mode, generics, type guard, utility types, conditional types, mapped types, template literal types, infer, extends, keyof, typeof, type narrowing, discriminated unions, type assertion, type predicate, type gymnastics, TS, 类型体操, 泛型, 类型守卫, 严格类型
Also in 3 projects that use this
hieutrtrSkillfastapi-patterns
FastAPI framework mechanics and advanced patterns. Use when configuring middleware, creating dependency injection chains, implementing WebSocket endpoints, customizing OpenAPI documentation, setting up CORS, building authentication dependencies (JWT validation, role-based access), implementing background tasks, or managing application lifespan (startup/shutdown). Does NOT cover basic endpoint CRUD or repository/service patterns (use python-backend-expert) or testing (use pytest-patterns).
Also in 3 projects that use this
LangChainSkilldocker-patterns
Best practices for Docker containerization and multi-stage builds
Also in 4 projects that use this
rohitg00Skilldjango-patterns
Django architecture patterns including DRF, ORM optimization, signals, middleware, and project structure
Also in 3 projects that use this
rohitg00Skillspringboot-patterns
Spring Boot patterns including JPA repositories, REST controllers, layered services, and configuration
Also in 3 projects that use this
Svenja-devSkille2e-testing
Also in 4 projects that use this
Other versions29 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 29
- rohitg00/awesome-claude-code-toolkit★ 2.7ksame name
- nth5693/gemini-kit★ 373same name
- jh941213/my-cc-harness★ 126same name
- templetongroup/radiant★ 113same name
- maxyeh0817/Forge★ 34same name
- Fandry96/k3-agentic-skills★ 27same name
- VoDaiLocz/kilo-kit-mcp★ 27same name
- benshapyro/cadre-devkit-claude★ 9same name
- xfstudio/skills★ 9same name
- jdanigo/hydraia★ 8same name
19 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 repository38 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- agent-commsSkill
- agent-memorySkill
- api-designSkill
- context-engineeringSkill
- database-optimizationSkill
- distillSkill
- docker-templatesSkill
- error-handlingSkill
- github-actions-templateSkill
- git-operationsSkill
- logging-standardsSkill
- mcp-toolsSkill
- memorySkill
- monitoring-observabilitySkill
- mui-stylingSkill
- pattern-recognitionSkill
- planning-methodologySkill
- python-patternsSkill
- quality-validationSkill
- research-methodologySkill
- security-review-checklistsSkill
- semantic-memory-mcpSkill
- semantic-memory-storeSkill
- skill-authoringSkill
- sofa-searchSkill
- spec-designSkill
- spec-developSkill
- spec-researchSkill
- spec-reviewSkill
- spec-workflowSkill
- state-managementSkill
- systematic-debuggingSkill
- testing-strategySkill
- ui-ux-pro-maxSkill
- verification-before-completionSkill
- watch-patternsSkill
- worktree-managementSkill
The file
Files
React Patterns Skill
React + TypeScript standards and best practices.
When to Apply
- Creating new React components
- Implementing custom hooks
- State management decisions
- Performance optimization
- Code review for React code
Component Standards
Component Structure Rules
| Rule | Description |
| Functional only | Use function components, no class components |
| TypeScript props | Define Props interface for all components |
| Single responsibility | One component = one purpose |
| Max 200 lines | Split larger components into sub-components |
Component Organization
| Section | Order |
| 1. Imports | Types first, then libraries, then local |
| 2. Props interface | Define before component |
| 3. Hooks | All hooks at top of function |
| 4. Handlers | Event handlers after hooks |
| 5. Effects | useEffect after handlers |
| 6. Return | JSX at the end |
Hook Standards
Built-in Hooks Usage
| Hook | Use When | Avoid When |
useState | Local component state | Shared state (use Zustand) |
useEffect | Side effects, subscriptions | Derived state (use useMemo) |
useMemo | Expensive calculations | Simple values |
useCallback | Callbacks passed to children | Inline handlers |
useRef | DOM refs, mutable values | State that triggers renders |
Custom Hook Guidelines
| Guideline | Description |
Prefix with use | useFeatureName, useDataFetching |
| Return object | { data, loading, error } |
| Single responsibility | One hook = one purpose |
| Reusable | Extract when logic repeats 2+ times |
TypeScript Requirements
Type Import Rules
| Rule | Example |
Use import type | import type { Props } from './types' |
Use export type | export type { ButtonProps } |
| Centralize types | All types in types/index.ts |
No any | Use unknown or proper types |
Props Typing Standards
| Standard | Description |
| Interface for props | interface Props { ... } |
Optional with ? | title?: string |
| Children explicit | children: React.ReactNode |
| Events typed | onClick: (e: React.MouseEvent) => void |
Performance Standards
Memoization Guidelines
| Technique | When to Use |
useMemo | Expensive calculations, derived data |
useCallback | Functions passed as props to memoized children |
React.memo | Components with same props render same output |
Re-render Prevention
| Cause | Solution |
| New object in props | Memoize with useMemo |
| New function in props | Memoize with useCallback |
| Context changes | Split contexts by update frequency |
| Parent re-renders | Use React.memo on child |
Effect Guidelines
useEffect Rules
| Rule | Description |
| Cleanup required | Return cleanup function for subscriptions |
| Dependency array | Include all referenced values |
| Avoid objects in deps | Use primitive values or useMemo |
| No async directly | Define async function inside effect |
Common Effect Patterns
| Pattern | Use Case |
| Data fetching | Fetch on mount or dependency change |
| Subscription | Event listeners, WebSocket |
| DOM measurement | Read layout after render |
| Sync external | Sync state with external system |
Event Handling Standards
Event Handler Naming
| Pattern | Example |
| Action verb | handleClick, handleSubmit |
| Specific action | handleDeleteItem, handleToggleMenu |
| Props callback | onAction, onChange |
Event Types
| Event | Type |
| Click | React.MouseEvent<HTMLButtonElement> |
| Change | React.ChangeEvent<HTMLInputElement> |
| Submit | React.FormEvent<HTMLFormElement> |
| Keyboard | React.KeyboardEvent |
File Organization
Directory Structure
src/
├── components/
│ ├── common/ # Shared/reusable components
│ ├── [feature]/ # Feature-specific components
│ └── layout/ # Layout components
├── hooks/
│ └── use[Name].ts # Custom hooks
├── pages/
│ └── [Page].tsx # Route pages
├── services/
│ └── [name]Service.ts # API services
├── stores/
│ └── [name]Store.ts # Zustand stores
└── types/
└── index.ts # All type definitionsAnti-Patterns to Avoid
| Anti-Pattern | Problem | Solution |
| useEffect for derived state | Extra renders | Use useMemo |
| Missing dependencies | Stale closures, bugs | Add all deps |
| Index as key | Bugs on reorder | Use unique id |
| Prop drilling > 2 levels | Hard to maintain | Use Context/Zustand |
| Inline object props | New reference each render | Memoize or extract |
| State for constants | Unnecessary complexity | Define outside component |
Code Review Checklist
Component Review
- Single responsibility principle followed
- Props interface defined with TypeScript
- No prop drilling beyond 2 levels
- Hooks at top level only
- Cleanup in useEffect where needed
Performance Review
- Expensive calculations memoized
- Callbacks memoized when passed to children
- No new objects/arrays created in render
- Keys are unique and stable
TypeScript Review
import typeused for type imports- No
anytypes - Props properly typed
- Event handlers typed
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.

