Back to Skills

react-patterns

verified

Expert guidance on modern React patterns including hooks, composition, state management, and concurrent features. Use when implementing React components or refactoring existing code.

View on GitHub

Marketplace

majestic-marketplace

majesticlabs-dev/majestic-marketplace

Plugin

majestic-react

Repository

majesticlabs-dev/majestic-marketplace
19stars

plugins/majestic-react/skills/react-patterns/SKILL.md

Last Verified

January 24, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/majesticlabs-dev/majestic-marketplace/blob/main/plugins/majestic-react/skills/react-patterns/SKILL.md -a claude-code --skill react-patterns

Installation paths:

Claude
.claude/skills/react-patterns/
Powered by add-skill CLI

Instructions

# React Patterns

Expert guidance for implementing modern React patterns using hooks, component composition, state management, and concurrent features.

## Core Philosophy

| Priority | Description |
|----------|-------------|
| **Component Composition** | Build complex UIs from simple, reusable pieces |
| **Separation of Concerns** | Business logic in hooks, presentation in components |
| **Explicit over Implicit** | Clear data flow and state management |
| **Performance** | Minimize re-renders, optimize heavy computations |
| **Accessibility** | Build inclusive, keyboard-navigable interfaces |

## Pattern Categories

### Component Composition Patterns

| Pattern | Use Case | Example |
|---------|----------|---------|
| Compound Components | Flexible component APIs with shared context | Accordion, Tabs, Menu |
| Render Props | Share logic between components | MouseTracker, Scroll position |
| Higher-Order Components | Wrap components to add functionality | withAuth, withLoading |

See [resources/examples.md](resources/examples.md) for full code examples.

### Custom Hooks Patterns

| Hook | Purpose |
|------|---------|
| `useApi` | Data fetching with loading/error states |
| `useForm` | Form state management with validation |
| `useDebounce` | Debounce rapidly changing values |
| `usePrevious` | Access previous value of state/prop |
| `useLocalStorage` | Persist state to localStorage |

See [resources/examples.md](resources/examples.md) for implementations.

### State Management Patterns

| Type | When to Use | Examples |
|------|-------------|----------|
| **useState** | Simple UI state | Toggles, form inputs, pagination |
| **useReducer** | Complex state logic | Multi-step forms, shopping cart |
| **Context** | Theme, auth, app-wide settings | User session, feature flags |
| **URL State** | Shareable/bookmarkable state | Filters, search params, tabs |
| **Server State** | API data (React Query/SWR) | User profiles, product catalogs |
| **Global Store** | Cross-fe

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
4216 chars