react-patterns

react-patterns is a skill for Claude Code, Codex from halflength-ampleness75/claude-code-recipes. It costs 0 tokens per session (1,646 once invoked), scanned A, original, MIT.

A set of recommended patterns for building React interfaces with functional components, hooks, shared state, accessibility, and performance in mind. React is a JavaScript library for creating user interfaces.

In plain words
What is it for?
Use it when creating or reviewing React components, defining TypeScript properties, extracting custom hooks, organizing related files, or checking interface accessibility.
Why use it?
It provides consistent rules for component files, properties, exports, and reusable stateful logic, reducing avoidable code and maintenance problems.

Skill for Claude CodeCodex

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

Good fit Use it when creating or reviewing React components, defining TypeScript properties, extracting custom hooks, organizing related files, or checking interface accessibility.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/halflength-ampleness75/claude-code-recipes/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 halflength-ampleness75/claude-code-recipes --skill react-patterns
Clone the repo
git clone --depth 1 https://github.com/halflength-ampleness75/claude-code-recipes

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/halflength-ampleness75/claude-code-recipes/react-patterns/github.svg)](https://agentmods.dev/skills/halflength-ampleness75/claude-code-recipes/react-patterns)
Your own site
<a href="https://agentmods.dev/skills/halflength-ampleness75/claude-code-recipes/react-patterns"><img src="https://agentmods.dev/badge/skills/halflength-ampleness75/claude-code-recipes/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/halflength-ampleness75/claude-code-recipes/react-patterns"><img src="https://agentmods.dev/badge/skills/halflength-ampleness75/claude-code-recipes/react-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,646 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 original No closer match found 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.00000 $0.01646
Opus 5.5 $0.00000 $0.00658
Sonnet 5.5 $0.00000 $0.00329
Haiku 4.5 $0.00000 $0.00165

Measured 1mo ago against content hash a6b4372ef048, 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.

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

How it starts

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

React Patterns

Best practices for React development: functional components, hooks, state management, performance, and accessibility.

Component Rules

  1. Always use functional components — never class components for new code
  2. One component per file — name the file the same as the component (PascalCase)
  3. Export components as named exports — default exports only for pages/routes
  4. Colocate related files — keep Component.tsx, Component.test.tsx, and Component.module.css together
  5. Props interface above the component — name it ComponentNameProps
// Good
interface UserCardProps {
  user: User;
  onSelect: (id: string) => void;
  variant?: "compact" | "full";
}

export function UserCard({ user, onSelect, variant = "full" }: UserCardProps) {
  return ( /* ... */ );
}
// Bad — default export, inline props, class component
export default class UserCard extends React.Component<{user: any}> { /* ... */ }

Hooks Patterns

Custom Hooks

  1. Prefix with use — useAuth, useDebounce, useLocalStorage
  2. Extract shared logic into custom hooks — if two components share stateful logic, extract it
  3. Return tuples for simple hooks, objects for complex ones
// Simple: return tuple
function useToggle(initial = false): [boolean, () => void] {
  const [value, setValue] = useState(initial);
  const toggle = useCallback(() => setValue((v) => !v), []);
  return [value, toggle];
}

// Complex: return object
function useApi<T>(url: string) {
  const [data, setData] = useState<T | null>(null);
  const [error, setError] = useState<Error | null>(null);
  const [loading, setLoading] = useState(true);
  // ... fetch logic
  return { data, error, loading, refetch };
}

Hook Rules

  1. Never call hooks conditionally — all hooks must run on every render
  2. Use useCallback for functions passed to children — prevents unnecessary re-renders
  3. Use useMemo only for expensive computations — don't wrap everything
  4. Prefer useReducer over useState when state transitions are complex

Read the full file on GitHub · 199 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 · 199 lines · 0 tokens per session scan A a6b4372ef048

Subscribe to this mod's changes

react-patterns is a skill published in the GitHub repository halflength-ampleness75/claude-code-recipes (2 stars, last pushed 4d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,646 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

generic-react-ux-designer

Professional UI/UX design expertise for React applications. Covers design thinking, user psychology (Hick's/Fitts's/Jakob's Law), visual hierarchy, interaction patterns, accessibility, performance-driven design, and design critique. Use when designing features, improving UX, solving user problems, or conducting design…

travisjneuman/.claude · 69 tokens

generic-react-feature-developer

Guide feature development for React applications with architecture focus. Covers Zustand/Redux patterns, IndexedDB usage, component systems, lazy loading strategies, and seamless integration. Use when adding new features, refactoring existing code, or planning major changes.

travisjneuman/.claude · 53 tokens

generic-react-design-system

Complete design system reference for React applications. Covers colors, typography, spacing, component patterns, glassmorphism effects, GPU-accelerated animations, and WCAG AA accessibility. Use when implementing UI, choosing colors, applying spacing, creating components, or ensuring brand consistency.

travisjneuman/.claude · 59 tokens

generic-react-code-reviewer

Review React/TypeScript code for bugs, security vulnerabilities, performance issues, accessibility gaps, and CLAUDE.md workflow compliance. Enforces TypeScript strict mode, GPU-accelerated animations, WCAG AA accessibility, bundle size limits, and surgical simplicity. Use when completing features, before commits, or…

travisjneuman/.claude · 71 tokens

web-artifacts-builder

Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use for complex artifacts requiring state management, routing, or shadcn/ui components - not for simple single-file HTML/JSX artifacts.

travisjneuman/.claude · 64 tokens

react-router-v7

React Router v7 framework mode conventions for route modules, data loaders, actions, and progressive enhancement. Use when building file-based routes with loaders/actions, handling form submissions with Form/useFetcher/useSubmit, adding route ErrorBoundary components, revalidating data after mutations, or migrating…

Mindrally/skills · 70 tokens