Skip to content
Skill

React patterns

Guides an agent on when React effects, dependencies and refs are appropriate

React patterns is an open-source agent skill for developer tools. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

Scripts
None
Platforms
Claude Code, Codex, Cursor
GitHub stars
7
Last commit
License
MIT
Listing updated

Similar skills

About React patterns

This skill steers an AI coding agent toward disciplined React code, centred on the idea that an effect exists only to synchronise React with something outside React. Before writing or reviewing effects, refs or DOM access, the agent is pushed to derive values during render, reset state through keys, and move user-driven logic into event handlers. It also covers effect cleanup and idempotent setup, dependency arrays that must match what the effect reads, and data fetching that avoids races and unnecessary refetches.

The guidance is delivered as a written checklist and code patterns inside a single SKILL.md file, with no scripts or bundled tools. The agent applies it as review criteria: each effect should map to an external system, every async effect should guard against stale responses, and ref.current should only be touched in handlers or effects. Examples are written in TSX and reference hooks such as useEffect, useLayoutEffect, useRef and useMemo, plus React Query and framework loaders as preferred alternatives to hand-rolled fetching.

The skill expects a React codebase and an agent that loads skills from a SKILL.md folder. It does not set a tool allowlist, and the lint rules it mentions (eslint-plugin-react-hooks, REACT_EFFECT_RULES) apply only when the project uses them.

When your agent uses it

Effect, dependency, and ref discipline for React. Invoke before writing or reviewing any useEffect, useLayoutEffect, useRef, or DOM access, and when a component has state that could be derived instead. Catches the failure modes that cause stale UI, double-fetch, and render loops.

From the skill's SKILL.md. Your agent reads this description to decide when to load the skill.

What it can access

From a static check of its 1 file (6 KB) on GitHub on 3 December 2026. Nothing was run. Read the files before you install a skill: it can tell your agent to run anything its tools allow.

Check another skill before you install it.

Install

This skill ships in the ai-essentials plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

/plugin marketplace add tonyghiani/ai-essentials
/plugin install ai-essentials@ai-essentials

Or copy only this skill to ~/.claude/skills/react-patterns:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/tonyghiani/ai-essentials.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/react-patterns &&
cp -R "$tmp/skills/react-patterns" ~/.claude/skills/react-patterns &&
rm -rf "$tmp"

For one project only, put the folder in .claude/skills/react-patterns inside it instead.

Claude Code docs on skills

Copy the skill folder to ~/.agents/skills/react-patterns to use it in every repository:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/tonyghiani/ai-essentials.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/react-patterns &&
cp -R "$tmp/skills/react-patterns" ~/.agents/skills/react-patterns &&
rm -rf "$tmp"

For one repository only, put the folder in .agents/skills/react-patterns inside it instead.

Codex docs on skills

Copy the skill folder to ~/.cursor/skills/react-patterns to use it in every project:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/tonyghiani/ai-essentials.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/react-patterns &&
cp -R "$tmp/skills/react-patterns" ~/.cursor/skills/react-patterns &&
rm -rf "$tmp"

For one project only, put the folder in .cursor/skills/react-patterns inside it instead.

Cursor docs on skills

Run in a terminal (add --scope workspace to install it for the current workspace only):

gemini skills install https://github.com/tonyghiani/ai-essentials.git --path skills/react-patterns

Or copy the folder to ~/.gemini/skills/react-patterns yourself.

Gemini CLI docs on skills

For GitHub Copilot in VS Code, copy the skill folder to ~/.copilot/skills/react-patterns:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/tonyghiani/ai-essentials.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/react-patterns &&
cp -R "$tmp/skills/react-patterns" ~/.copilot/skills/react-patterns &&
rm -rf "$tmp"

For one project only, put the folder in .github/skills/react-patterns inside it instead.

VS Code docs on skills

Get the folder:

git clone --depth 1 https://github.com/tonyghiani/ai-essentials.git

Then copy ai-essentials/skills/react-patterns into your agent's skills folder as react-patterns. Agents that support SKILL.md read one folder per skill.

The SKILL.md format

What it does

Effect necessity check
Helps the agent decide whether an effect is needed at all or whether logic belongs in render or an event handler.
Cleanup and idempotency rules
Requires teardown that fully undoes setup and setup that stays safe under Strict Mode double-mounting.
Dependency array discipline
Covers including every reactive value, avoiding suppressed lint warnings, and shrinking dependency lists.
Data fetching guidance
Favours framework or library fetching APIs and covers race handling and a loading, error and value contract.
Ref and DOM safety
Explains when to use refs versus state and which DOM operations are safe on React-owned nodes.
Review checklist
Provides six questions the agent can run through when reviewing effects, state, dependencies and refs.

Good for

  • Review a React component for unnecessary useEffect calls
  • Refactor derived state into computed values during render
  • Fix stale data or race conditions in a fetch effect
  • Add a subscription or event listener with proper cleanup
  • Replace a list of refs with a single Map-based ref
  • Audit dependency arrays for suppressed hook lint warnings

React patterns FAQ

When does React patterns trigger?

It is meant to be invoked before writing or reviewing useEffect, useLayoutEffect, useRef or DOM access, and when a component has state that could be derived instead.

Does React patterns run any scripts or need extra tools?

No scripts are included and the folder contains a single file. The skill does not set an allowed tools list.

Which AI clients does React patterns support?

It is a plain SKILL.md folder, so it follows the shared agent skills format and is not tied to a specific client.

What kind of code does React patterns expect?

Its examples are written in TSX for React components and hooks, so it is aimed at React projects.

How do I install React patterns in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/react-patterns to use it in all your projects, or to .claude/skills/react-patterns in one project. Or install the ai-essentials plugin, which includes it: /plugin marketplace add tonyghiani/ai-essentials, then /plugin install ai-essentials@ai-essentials.

Does React patterns run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

Which AI agents can use React patterns?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

What are the best alternatives to React patterns?

The closest alternatives to React patterns are Frontend react, Frontend patterns, React19 source patterns, Marco code style and Coding standards.

Where this comes from

  • Description: from the skill's own SKILL.md.

More from tonyghiani/ai-essentials

  1. Lets an agent read your GitHub queue at day's end and draft a morning triage report

    • Open source
    • 7 GitHub stars
    • Developer tools
  2. Finds untranslated UI strings and i18n patterns that break translation in code

    • Open source
    • 7 GitHub stars
    • Developer tools
  3. Writes pull request descriptions from a fixed summary, screenshots and testing template

    • Open source
    • 7 GitHub stars
    • Developer tools
  4. Guides an agent through resolving merge conflicts by intent, then verifying and pushing

    • Open source
    • 7 GitHub stars
    • Developer tools
  5. Triages PR review comments, then implements, replies to and resolves them

    • Open source
    • 7 GitHub stars
    • Developer tools
  6. Guides the agent through a test-first loop: failing test, then minimal implementation

    • Open source
    • 7 GitHub stars
    • Developer tools