react-patterns

A collection of React and TypeScript patterns for organizing components, shared logic, forms, validation, and rendering errors. React is a JavaScript library for building user interfaces, while TypeScript adds type checking.

In plain words
What is it for?
Use it to create custom hooks, compose components, separate data handling from presentation, add recovery for rendering errors, and build forms validated with React Hook Form and Zod.
Why use it?
It reduces tangled component code and repeated logic as a frontend application grows.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/bdiasti/maestro-bundle-cli/react-patterns
Any agent
npx skills add bdiasti/maestro-bundle-cli --skill react-patterns
Clone the repo
git clone --depth 1 https://github.com/bdiasti/maestro-bundle-cli

Made for: Claude Code, Codex.

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,021 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00049 $0.02021
Opus 5 $0.00024 $0.01010
Sonnet 5 $0.00010 $0.00404
Haiku 4.5 $0.00005 $0.00202

Measured 2d ago against content hash a54013d66682, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 2d 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.

templates/bundle-frontend-spa/skills/react-patterns/SKILL.md · 256 lines

How it starts

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

React Patterns

Apply proven React + TypeScript patterns for scalable, maintainable frontend code.

When to Use

  • User needs to create a custom hook for data fetching or shared logic
  • User wants to structure a feature using container/presenter pattern
  • User needs to build a form with validation (React Hook Form + Zod)
  • User wants to add error boundaries to catch rendering errors
  • User needs to compose components instead of using deep prop drilling

Available Operations

  1. Create custom hooks for data fetching with React Query
  2. Build components using composition pattern (slots, children)
  3. Implement container/presenter separation
  4. Add error boundaries with recovery
  5. Build validated forms with React Hook Form + Zod

Multi-Step Workflow

Step 1: Set Up Project Dependencies

npm install @tanstack/react-query react-hook-form @hookform/resolvers zod react-error-boundary
npm install -D @types/react @types/react-dom typescript

Step 2: Create Custom Hooks for Data Fetching

// src/hooks/useItems.ts
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
import { itemApi } from '../services/itemApi';
import { toast } from 'sonner';

export function useItems(filters?: ItemFilters) {
  return useQuery({
    queryKey: ['items', filters],
    queryFn: () => itemApi.list(filters),
    staleTime: 30_000,
  });
}

export function useItem(id: string) {
  return useQuery({
    queryKey: ['items', id],
    queryFn: () => itemApi.get(id),
    enabled: !!id,
  });
}

export function useCreateItem() {
  const queryClient = useQueryClient();
  return useMutation({
    mutationFn: itemApi.create,
    onSuccess: () => {
      queryClient.invalidateQueries({ queryKey: ['items'] });
      toast.success('Item created');
    },
    onError: (err) => toast.error(err.message),
  });
}

Step 3: Build Components with Composition

// src/components/Card.tsx
interface CardProps {
  children: React.ReactNode;
  className?: string;
}

export function Card({ children, className }: CardProps) {
  return <div className={cn('rounded-lg border bg-white shadow-sm', className)}>{children}</div>;
}

Card.Header = function CardHeader({ children }: { children: React.ReactNode }) {
  return <div className="flex items-center justify-between p-4 border-b">{children}</div>;
};

Card.Content = function CardContent({ children }: { children: React.ReactNode }) {
  return <div className="p-4">{children}</div>;
};

Card.Footer = function CardFooter({ children }: { children: React.ReactNode }) {
  return <div className="p-4 border-t bg-gray-50">{children}</div>;
};

// Usage:
<Card>
  <Card.Header>
    <h3>{item.title}</h3>
    <StatusBadge status={item.status} />
  </Card.Header>
  <Card.Content>
    <p>{item.description}</p>
  </Card.Content>
  <Card.Footer>
    <ProgressBar value={item.progress} />
  </Card.Footer>
</Card>

Read the full file on GitHub · 256 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 2d ago First seen · 256 lines · 49 tokens per session scan A a54013d66682

Subscribe to this mod's changes

react-patterns is a skill published in the GitHub repository bdiasti/maestro-bundle-cli (21 stars, last pushed 5mo ago), licensed MIT. It adds 49 tokens to every session and 2,021 once invoked, about $0.0002 per session on Opus 5. 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-30.

Related

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.

obra/superpowers · 37 tokens

chat-pet-sprite-creation

Use when creating or changing VS Code chat pet sprite art, sprite sheets, state animations, eye treatments, Stable/Insiders variants, or pet transitions under src/vs/workbench/contrib/chat/browser/widget/media/chatPet.

microsoft/vscode · 53 tokens

cpu-profile-analysis

Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…

microsoft/vscode · 71 tokens

babysit-pr

Babysit a GitHub pull request after creation by continuously polling review comments, CI checks/workflow runs, and mergeability state until the PR is merged/closed or user help is required. Diagnose failures, retry likely flaky failures up to 3 times, auto-fix/push branch-related issues when appropriate, and keep…

openai/codex · 114 tokens

imagegen

Generate or edit raster images when the task benefits from AI-created bitmap visuals such as photos, illustrations, textures, sprites, mockups, or transparent-background cutouts. Use when Codex should create a brand-new image, transform an existing image, or derive visual variants from references, and the output…

openai/codex · 113 tokens