react-patterns

react-patterns is a skill for Claude Code, Codex from ronmkr/PromptBook. It costs 49 tokens per session (2,720 once invoked), scanned A, a copy of react-patterns, Apache-2.0.

A guide to common React patterns for building web interfaces from reusable components. React is a JavaScript library for creating interactive user interfaces.

In plain words
What is it for?
Use it when writing or reviewing React components and hooks, designing forms and state, fetching data, or working with Next.js server and client components.
Why use it?
It helps prevent confusing state, unnecessary updates, incorrect data loading, inaccessible controls, and misuse of server and browser code.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when writing or reviewing React components and hooks, designing forms and state, fetching data, or working with Next.js server and client components.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/ronmkr/promptbook/react-patterns
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add ronmkr/PromptBook --skill react-patterns
Clone the repo
git clone --depth 1 https://github.com/ronmkr/PromptBook

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for react-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/ronmkr/promptbook/react-patterns/github.svg)](https://agentmods.dev/skills/ronmkr/promptbook/react-patterns)
Your own site
<a href="https://agentmods.dev/skills/ronmkr/promptbook/react-patterns"><img src="https://agentmods.dev/badge/skills/ronmkr/promptbook/react-patterns/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for react-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/ronmkr/promptbook/react-patterns"><img src="https://agentmods.dev/badge/skills/ronmkr/promptbook/react-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 49 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,720 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin 94% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00049 $0.02720
Opus 5.5 $0.00020 $0.01088
Sonnet 5.5 $0.00010 $0.00544
Haiku 4.5 $0.00005 $0.00272

Measured 1mo ago against content hash 718eb1607500, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

react-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

94% identical to react-patterns — 4 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

skills/patterns/react-patterns/SKILL.md · 342 lines

How it starts

The opening of the file, as written. The whole thing — 342 lines — stays where its author put it; the contents beside it link to each section on GitHub.

React Patterns

Idiomatic React 18/19 patterns for building robust, accessible, performant component trees.

When to Activate

  • Writing or modifying React function components, custom hooks, or component trees
  • Reviewing JSX/TSX files
  • Designing state shape or component composition
  • Migrating class components or older forwardRef/useEffect-heavy code
  • Choosing between local state, lifted state, context, and external stores
  • Working with Server Components / Client Components (Next.js App Router, RSC)
  • Implementing forms with React 19 actions or controlled inputs
  • Wiring data fetching with TanStack Query / SWR / RSC

Core Principles

1. Render is a Pure Function of Props and State

// Good: derive during render
function Cart({ items }: { items: CartItem[] }) {
  const total = items.reduce((sum, i) => sum + i.price * i.qty, 0);
  return <span>{formatMoney(total)}</span>;
}

// Bad: derived state stored separately
function Cart({ items }: { items: CartItem[] }) {
  const [total, setTotal] = useState(0);
  useEffect(() => {
    setTotal(items.reduce((sum, i) => sum + i.price * i.qty, 0));
  }, [items]);
  return <span>{formatMoney(total)}</span>;
}

Derived state in useEffect adds a render cycle, can desync, and obscures the data flow.

2. Side Effects Outside Render

Effects, mutations, network calls, and subscriptions live in event handlers or useEffect — never in the render body.

3. Composition Over Inheritance

React has no inheritance model for components. Compose with children, render props, or component props.

Hooks Discipline

See rules/react/hooks.md for the full ruleset. Highlights:

  • Top-level only, never conditional
  • Cleanup every subscription, interval, listener
  • Functional updater (setX(prev => prev + 1)) when new state depends on old
  • Default position: do not memoize — add useMemo/useCallback only when a profiler or a dependency chain proves it matters
  • Extract a custom hook only when the same hook sequence appears in 2+ components

Read the full file on GitHub · 342 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 342 lines · 49 tokens per session scan A 718eb1607500

Subscribe to this mod's changes

react-patterns is a skill published in the GitHub repository ronmkr/PromptBook (2 stars, last pushed 4mo ago), licensed Apache-2.0. It adds 49 tokens to every session and 2,720 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. It is 94% identical to react-patterns, differing in 4 lines, and is treated as a copy.

Related

Other skills, from other repositories

frontend-component-patterns

Patrones de componentes para React, Vue y Svelte: composición sobre herencia, estado local vs global, props vs slots, controlled vs uncontrolled, listas con keys estables, memoización dirigida, manejo de async/loading/error. Cargá al diseñar o refactorizar componentes.

contactandrewchl-wq/turtle-mcp · 63 tokens

blossom-carousel

Carrusel nativo con scroll horizontal + snap, sin JS pesado, gratis en táctil. Componentes para React, Vue y Svelte. Útil para landings, galerías y agencias. Cargá al construir un slider/carousel/galería horizontal.

contactandrewchl-wq/turtle-mcp · 59 tokens

react-test-engineer

Expert guidance for testing React applications using React Testing Library and Vitest. Focuses on user-centric testing, accessibility, and best practices for unit and integration tests to ensure robust and maintainable code.

GrishaAngelovGH/gemini-cli-agent-skills · 44 tokens

browser-use

Automates browser interactions for web testing, form filling, screenshots, and data extraction. Use when the user needs to navigate websites, interact with web pages, fill forms, take screenshots, or extract information from web pages.

twaldin/flt · 47 tokens

pi-autoresearch-loop

Skill "pi-autoresearch-loop" from twaldin/flt, covering pi-autoresearch — autonomous experiment loop, installation, quick start, core concepts and two-file persistence model.

twaldin/flt · 0 tokens

grill

Rigorous requirements gathering through Socratic questioning. Use when the user says "/grill", "grill me", "ask me questions until we understand", or wants to be interrogated about implementation details before writing code. Forces deep thinking about edge cases, behavior, and design decisions before any code is…

twaldin/flt · 66 tokens