react-effect-decision

A project rule for deciding when React code needs `useEffect`, a feature used to synchronize components with outside systems. It favors derived values, event handlers, and other React patterns when an effect is unnecessary.

In plain words
What is it for?
Use it when writing or reviewing React components involving derived state, event handling, resets, subscriptions, data fetching, or possible `useEffect` usage.
Why use it?
It helps avoid extra state synchronization and common component bugs caused by using effects for calculations, resets, or user actions.

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/waynesutton/markdown-site/react-effect-decision
Any agent
npx skills add waynesutton/markdown-site --skill react-effect-decision
Clone the repo
git clone --depth 1 https://github.com/waynesutton/markdown-site

Made for: Claude Code, Codex.

Per session 63 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,679 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. 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.00063 $0.01679
Opus 5 $0.00032 $0.00839
Sonnet 5 $0.00013 $0.00336
Haiku 4.5 $0.00006 $0.00168

Measured 2d ago against content hash 2578847aaa75, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

react-effect-decision scanned grade A with 1 finding 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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

fetch(url)
.claude/react-effect-decision/SKILL.md · 242 lines

How it starts

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

React effect decision

Default rule for this project: do not reach for direct useEffect first.

Most effect usage in React code is a sign that the component is syncing state that should be derived during render, routing an event through state, or resetting local state in a way React already models better.

This skill merges:

  • React's official decision tree from "You Might Not Need an Effect"
  • The project's stricter no direct useEffect preference

Start here

Before writing any effect, ask these in order:

  1. Can I calculate this from props or state during render
  2. Is this triggered by a user action and better placed in the event handler
  3. Am I trying to reset component state when identity changed and should use key
  4. Is this an expensive pure calculation that should use useMemo
  5. Is this an external subscription that should use useSyncExternalStore or a focused custom hook
  6. Is this real external synchronization that must happen on mount or on dependency changes

If you answer yes to any of 1 through 5, do not write a direct useEffect.

Project stance

React allows effects for real external synchronization. This project is stricter:

  • Avoid direct useEffect in components whenever a clearer pattern exists
  • Prefer derived values, event handlers, key remounts, memoization, query libraries, Convex hooks, and focused custom hooks
  • If mount only external setup is truly needed, use an explicit useMountEffect wrapper instead of sprinkling raw useEffect through feature code

Example wrapper:

import { useEffect } from "react";

export function useMountEffect(effect: () => void | (() => void)) {
  useEffect(effect, []);
}

Use that only for one time external setup like DOM focus, third party widgets, or browser API listeners that belong to the component lifecycle.

Decision guide

1. Derived state belongs in render

Bad smell:

  • useEffect(() => setX(deriveFromY(y)), [y])
  • State that only mirrors props or other state

Read the full file on GitHub · 242 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. 2d ago First seen · 242 lines · 63 tokens per session scan A 2578847aaa75

Subscribe to this mod's changes

react-effect-decision is a skill published in the GitHub repository waynesutton/markdown-site (631 stars, last pushed 3mo ago), licensed MIT. It adds 63 tokens to every session and 1,679 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). 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

shieldcn-badges

Create polished shieldcn README badges, badge groups, charts, headers, sponsors grids, and full README hero sections. Use when a user wants shadcn/ui-styled badges, Shields.io replacement, npm/GitHub/CI/status badges, download charts, README header banners, contributor/sponsor images, or README Studio guidance.…

jal-co/shieldcn · 145 tokens

infisical-sync-skill

Expert knowledge for the Infisical Sync Hand — Infisical API reference, vault operations, error patterns, security guidance.

RightNow-AI/openfang · 31 tokens

soul-grader

Use when grading, reviewing, rewriting, or approving a Hermes Agent SOUL.md. Uses the SOUL.md field-guide research artifacts as the only normative source for what makes a good SOUL.md.

cobibean/soul-grader-skill · 45 tokens

anakinscraper

Scrape any website into clean markdown or structured JSON. Anti-detect browser, smart proxy rotation, AI-powered data extraction.

Anakin-Inc/anakin · 30 tokens

mb-ads

Create and review ads, and prepare provider-safe launch plans/checks. Flexible entry points: full pipeline (copy + images), copy only, images only, creative variations (hook library), video scripts, long-form video ads/VSL-style paid creative, video repurpose, compliance review, launch-plan, instrumentation, check, or…

noontide-co/mainbranch · 136 tokens

mb-setup

Bootstrap a new business folder with Main Branch structure, or migrate an existing single-offer folder to multi-offer. Use when: (1) New user needs Claude Code environment configured (2) User says "set up", "get started", "initialize", "bootstrap", "create my repo", "new business" (3) User is new to Main Branch and…

noontide-co/mainbranch · 142 tokens