react-patterns

Applies React 18/19 patterns for hooks, state management, server components, and accessible composition.

5|15|Updated Jul 8, 2026
One-click install
npx skills add https://github.com/clfigueiredo/hermes-infra-skills --skill react-patterns-clfigueiredo
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: react-patterns
Source: https://github.com/clfigueiredo/hermes-infra-skills/tree/main/.hermes/skills/curso-hermes/react-patterns
Command: npx skills add https://github.com/clfigueiredo/hermes-infra-skills --skill react-patterns-clfigueiredo

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing and reviewing React code often leads to inconsistent patterns: derived state stored in useEffect, misplaced state, missing Suspense boundaries, and inaccessible markup. This Skill provides a decision framework and idiomatic patterns for React 18/19 so components are correct, performant, and accessible by default. ## Core Features & Use Cases - Hooks Discipline & State Decisions: Enforces top-level hooks, cleanup, functional updaters, and a decision tree for choosing between useState, lifted state, Context, external stores, and server-state libraries like TanStack Query. - Server/Client Component Boundaries: Guides RSC composition, React 19 form actions with useActionState, useOptimistic updates, and Suspense plus error boundary placement. - Accessibility-First Composition: Requires semantic HTML, keyboard reachability, labeled inputs, and focus management in every component. - Use Case: When reviewing a TSX pull request, apply the state location decision tree and data fetching matrix to flag useEffect-based fetching and recommend TanStack Query or RSC fetch instead. ## Quick Start Review this React component and rewrite it following the react-patterns rules for hooks, state placement, and data fetching.

Frequently Asked Questions about react-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I choose between useState, Context, and Zustand in React?▼

Use useState for single-component state, lift state to the nearest common ancestor for shared parent-child state, and Context for low-frequency cross-tree values like theme or auth. Use an external store like Zustand only for high-frequency updates shared across the tree.

How do I fetch data in React without useEffect?▼

Use TanStack Query or SWR for client-side caching, mutations, and invalidation, or await fetch directly in React Server Components. Avoid useEffect plus fetch because it causes race conditions and provides no cache, retry, or Suspense integration.

What is the difference between Server and Client Components in React?▼

Server Components are the default, can be async, and ship no JavaScript, while Client Components opt in with the "use client" directive for interactivity. Pass serializable props or children from Server to Client, and never import a Server Component into a Client file.

When should I use React.memo for performance?▼

Use React.memo only when a component re-renders frequently, its props are usually unchanged, and its render is measurably expensive. Otherwise the equality check on every render is pure overhead.

Does this skill cover Next.js App Router specifics?▼

It covers Server/Client Component boundaries and React 19 form actions used in the App Router, but Next.js-specific concerns like Route Handlers, Middleware, and Parallel Routes are explicitly out of scope and deferred to Next.js documentation.