Agent skill

react-patterns

Write React components with minimal state, proper memoization, and type-safe patterns. Use when creating components, managing state, or optimizing renders.

Stars 163
Forks 31

Install this agent skill to your Project

npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/react-patterns-casper-studios-casper-marketplace

Metadata

Additional technical details for this skill

author
BastiDood <[email protected]>

SKILL.md

React Patterns

Core React patterns for component design, state management, and optimization.

State Philosophy

Avoid state variables. Prefer derived values and props. Scope state to the smallest subtree that needs it. Use discriminated unions for complex state.

See state-management.md for:

  • Derived values over state
  • Component boundaries for state scoping
  • Context API patterns
  • Zustand for complex state
  • State machines over multiple useState

Memoization

Required for any O(n) operation. Memoize atomically to minimize dependency arrays. Use Loader/Inner pattern to narrow types before useMemo.

See memoization.md for:

  • When to useMemo
  • Atomic memoization
  • useCallback for handlers
  • Loader/Inner pattern for type narrowing

Conditional Logic

Use affirmative logic, explicit conditionals, and ternaries over &&. Early returns for guard clauses.

See conditional-logic.md for:

  • Affirmative logic
  • Explicit conditionals
  • Conditional rendering
  • Type narrowing with conditionals
  • Early returns

Expand your agent's capabilities with these related and highly-rated skills.

Didn't find tool you were looking for?

Be as detailed as possible for better results