Review React
React review that covers what the hooks linter and React Compiler cannot decide for you —
where state lives and what shape it has, whether an effect should exist at all, where component
and boundary lines fall, and which render costs are real. Mechanical hook rules are lint's job.
Review grading
Use only these finding priorities, in descending order:
- Critical Issues (Must Fix): a verified path causes data loss, a security failure, a materially
wrong operation, or makes a core workflow unusable without reasonable recovery.
- Improvements (Should Fix): an ordinary supported workflow demonstrably fails or repeatedly
imposes substantial friction, or a concrete design defect creates meaningful maintenance cost.
- Suggestions (Nice to Have): a worthwhile improvement with small practical impact, including
optional polish, local simplification, and rare recoverable edge cases.
Grade the demonstrated consequence, realistic reachability, and available recovery against project
priorities. A category, missing convention, hypothetical future problem, or confidence that a claim
is true does not set its priority. Do not assign automatic severity floors or ceilings. Keep
unverified claims in validation gaps, outside the graded finding count; distinguish suggestions
from defects. For plans, trace the consequence if implemented and state the assumptions.
Use the short labels Must Fix, Should Fix, and Nice to Have in summaries and ledgers.
Keep effort, verification status, user-facing change size, and tool/vendor diagnostic ratings
separate. When called by code-review, return its requested evidence and impact fields; the parent
owns scoring and final triage. Otherwise apply this rubric directly. Omit empty priority sections.
Relationship to the lint layer (read first)
Establish the baseline before deciding anything is out of scope. Three facts change what this
review is responsible for:
| Fact |
How to tell |
What it changes |
| Hooks lint rules that run |
eslint-plugin-react-hooks version and config in eslint.config.* / .eslintrc*; read the lint script too, since CLI flags can override the config |
v6+ ships compiler-backed rules (set-state-in-effect, set-state-in-render, refs, purity, immutability, static-components, preserve-manual-memoization, globals, use-memo, …) alongside rules-of-hooks and exhaustive-deps. Count only the rules the config enables. Another linter (oxlint, Biome) needs its enabled React rules checked individually |
| React Compiler on |
babel-plugin-react-compiler in package.json, and where the build enables it: babel.config.js, the Vite React plugin's babel.plugins, reactCompiler in next.config.*, experiments.reactCompiler in Expo's app.json / app.config.* |
Decides whether manual memoization is noise or necessary (checklist §4) |
| React version and renderer |
react, react-dom / react-native, and the framework (Next.js, Remix/React Router, Expo) in package.json |
Which APIs are available to recommend (useActionState, useOptimistic, useEffectEvent), and which platform section of the checklist applies |
If a rule runs, its findings are out of scope. If it does not — an old plugin version, rules
cherry-picked, or no hooks linting at all — the same issue is a review finding, and the
configuration gap goes in §P rather than being reported per occurrence.
Run on .jsx / .tsx / .js / .ts files that render components or define hooks. Complements
review-typescript (type design) and review-cleancode (smells) — don't repeat them.
Usage
review-react # Review context-related code
review-react --staged # Review staged changes
review-react --unpushed # Review files changed across all unpushed commits
review-react --changed # Review unstaged changes
review-react --all # Full codebase audit (parallel agents) + §P
review-react --multi # Also get external advisor opinions
Scope
| Flag |
Scope |
Method |
| (none) |
Context-related code |
Files from the current conversation context. If no context, ask the user to specify files or use --staged/--changed/--all. |
--staged |
Staged changes |
git diff --cached --name-only |
--unpushed |
Files changed across unpushed commits |
git diff --name-only $(git rev-list HEAD --not --remotes | tail -1)^..HEAD |
--changed |
Unstaged changes |
git diff --name-only |
--all |
Full codebase + §P project-level checks |
Glob component and hook files, parallel agents |
--multi |
Add external opinions |
Combines with any scope above; invokes second-opinion --quick |
If --unpushed cannot determine a range (nothing unpushed, no upstream, or the range walks back
to the root commit), stop and ask the user to pick another scope. Drop files that neither render
JSX nor call hooks.
Instructions
Determine scope (see table) and filter to component and hook files.
Read CLAUDE.md / AGENTS.md in the repo root for project conventions (state library,
data-fetching library, styling approach).
Establish the baseline (table above): enabled hooks rules, compiler on or off, React
version, renderer and framework. Record it; it calibrates every later step.
Review each file against the judgment categories, looking at what the diff introduces.
Load references/checklist.md, and from its §6 only the section for this renderer. Add
§P only at --all.
Parallelize if scope has more than 5 files: one sub-agent per category, then merge and
dedupe.
External opinions (if --multi): invoke second-opinion --quick with:
Read-only React review. Assume eslint-plugin-react-hooks handles rules-of-hooks, exhaustive-deps and its compiler-backed rules — do NOT repeat lint-level findings. React Compiler is {on|off}; renderer is {react-dom|react-native}. Focus on JUDGMENT: is any state derivable or duplicated? Does each effect synchronize with an external system, or is it event logic / a state-to-state sync? Are fetches race-safe? Are list keys stable? Is state owned at the right height and in the right store? Are boundaries (error, Suspense, client/server) placed well? Which render costs are real rather than hypothetical? 300 words or less.
Wait for all external results before proceeding.
Classify severity using Review grading and report.
Judgment categories
references/checklist.md carries the full catalogue:
- State modeling & placement — derived or prop-copied state, contradictory flags, state too
high or too low, server data or URL state held in components, resets done with effects.
- Effects — event logic in effects, effect chains, parent notification, race-prone
fetches, missing cleanup, hand-rolled external store subscriptions, dependency appeasement.
- Component boundaries & identity — unstable keys, context churn, drilling vs.
composition, controlled/uncontrolled mixing, boundary placement.
- Rendering cost & memoization — calibrated to the compiler: noise when it is on, only
measurable costs when it is off.
- Async UI — pending, optimistic and error states, stale closures.
- Platform — react-dom (hydration, Server/Client Components, accessible composite widgets)
or React Native (lists, JS-thread work, native subscriptions, navigation lifecycle).
State the reasoning for each finding. "This effect copies user.name into state, so editing
the profile elsewhere leaves the header stale" is a finding; "avoid useEffect" is not.
P. Project-level checks — --all only
Configuration, not code; raising it on a diff review is noise.
- Hooks linting: is
eslint-plugin-react-hooks on v6+ with its recommended preset (or the
compiler-backed rules enabled individually)? If not, enabling it replaces a large share of
manual review.
- Compiler adoption: on a React 19 project without React Compiler, note what adopting it
would remove (most manual memoization) and what it needs (code free of the violations its
lint rules report). A recommendation, not a mandate.
- Strict Mode enabled at the root, so double-invoked effects and renders surface impurity
in development.
Output Format
## React Review: {scope}
### Baseline
{One line: hooks rules enabled, compiler on/off, React version, renderer/framework.
**At `--all` only:** the §P recommendations.}
### Critical Issues (Must Fix)
- {file}:{line} — {category}: {description}
**Why it's not a lint finding:** {what judgment this needed}
**Impact:** {what the user sees}
**Fix:** {with code}
### Improvements (Should Fix)
- {file}:{line} — {category}: {description}
**Fix:** {solution}
### Suggestions (Nice to Have)
- {file}:{line} — {category}: {description} — {suggested change}
If --multi was used, append one subsection per advisor that responded (titled with the
advisor's name as reported by second-opinion), then a Cross-Model Agreement subsection.
Examples
Race-prone fetch (web):
review-react --staged
A profile page fetches in useEffect(() => { fetch(/api/users/${id}).then(setUser) }, [id]).
Switching users quickly can show the previous user's profile. Reports Should Fix for a transient wrong-profile display, escalating only if the traced path leaks protected data or performs a materially wrong operation. Proposes an ignore
flag in cleanup, or the project's query hook if it has one. Not a lint finding:
exhaustive-deps is satisfied.
Effect instead of a handler (React Native):
review-react --changed
A checkout screen sends a purchase_completed analytics event from an effect that watches
order.status. It re-fires when the screen remounts after navigating back. Reports Should Fix: move
it into the submit handler's success path.
Memoization noise under the compiler:
review-react
Baseline shows React Compiler on. A new component wraps every handler in useCallback and
the component in memo. Reports Nice to Have: remove them, since the compiler memoizes the same
values; keep only a useCallback whose identity an imperative library depends on.
Troubleshooting
Findings overlap with the linter
Cause: the baseline was skipped or assumed.
Solution: check whether the rule is enabled and runs (lint script flags included). If it
runs, drop the finding. If not, keep it and add the configuration gap to §P.
Can't tell whether the compiler is on
Cause: it is enabled in build config the scan did not reach, or only for some directories
(compilationMode: 'annotation', a sources filter, 'use no memo' opt-outs).
Solution: read the compiler options where the plugin is configured. If still unclear, say
so in the baseline and skip compiler-dependent memoization findings rather than guessing.
A pattern looks wrong but the project does it everywhere
Cause: a house convention (a global store for all state, a data layer that owns fetching).
Solution: follow CLAUDE.md / AGENTS.md. Report a convention only where it causes a concrete
bug in the scoped code, once, not per occurrence.
Notes
- Model state first, then question effects, then worry about render cost. Most effect
findings disappear once state is modeled correctly, and most render-cost findings disappear
under the compiler.
- Don't recommend a library the project doesn't use (a query cache, a state manager) when the
fix works with what is there; mention it as a suggestion at most.
- Sources: react.dev — "You Might Not Need an Effect", "Choosing the State Structure",
"Preserving and Resetting State", the React Compiler docs, and the eslint-plugin-react-hooks
README.
1---2name: review-react3description: React-specific code review for both react-dom and React Native, focused on JUDGMENT-level component design a linter can't decide — state modeling and placement, effects that shouldn't be effects, component boundaries and identity, render cost calibrated to whether React Compiler is on, and platform pitfalls (hydration and Server Component boundaries on the web; lists, JS-thread work and native subscriptions on React Native). Deliberately does NOT duplicate eslint-plugin-react-hooks, and first checks which of its rules actually run — the compiler-backed rules from v6 on cover much of what reviewers used to flag by hand. Auto-invoked by `code-review` on React projects. Triggers "review react", "react review", "review components", "review hooks", "review effects", "react native review".4argument-hint: '[--staged | --unpushed | --changed | --all | --multi]'5effort: high6metadata:7 source: https://skillmd.com/skills/nielsmadan/review-react8---910<!-- Generated from https://github.com/nielsmadan/agentic-coding — edits here are overwritten. -->1112# Review React1314React review that covers what the hooks linter and React Compiler **cannot decide for you** —15where state lives and what shape it has, whether an effect should exist at all, where component16and boundary lines fall, and which render costs are real. Mechanical hook rules are lint's job.1718## Review grading1920Use only these finding priorities, in descending order:2122- **Critical Issues (Must Fix):** a verified path causes data loss, a security failure, a materially23 wrong operation, or makes a core workflow unusable without reasonable recovery.24- **Improvements (Should Fix):** an ordinary supported workflow demonstrably fails or repeatedly25 imposes substantial friction, or a concrete design defect creates meaningful maintenance cost.26- **Suggestions (Nice to Have):** a worthwhile improvement with small practical impact, including27 optional polish, local simplification, and rare recoverable edge cases.2829Grade the demonstrated consequence, realistic reachability, and available recovery against project30priorities. A category, missing convention, hypothetical future problem, or confidence that a claim31is true does not set its priority. Do not assign automatic severity floors or ceilings. Keep32unverified claims in validation gaps, outside the graded finding count; distinguish suggestions33from defects. For plans, trace the consequence if implemented and state the assumptions.3435Use the short labels **Must Fix**, **Should Fix**, and **Nice to Have** in summaries and ledgers.36Keep effort, verification status, user-facing change size, and tool/vendor diagnostic ratings37separate. When called by `code-review`, return its requested evidence and impact fields; the parent38owns scoring and final triage. Otherwise apply this rubric directly. Omit empty priority sections.3940## Relationship to the lint layer (read first)4142Establish the baseline before deciding anything is out of scope. Three facts change what this43review is responsible for:4445| Fact | How to tell | What it changes |46|---|---|---|47| **Hooks lint rules that run** | `eslint-plugin-react-hooks` version and config in `eslint.config.*` / `.eslintrc*`; read the `lint` script too, since CLI flags can override the config | v6+ ships compiler-backed rules (`set-state-in-effect`, `set-state-in-render`, `refs`, `purity`, `immutability`, `static-components`, `preserve-manual-memoization`, `globals`, `use-memo`, …) alongside `rules-of-hooks` and `exhaustive-deps`. Count only the rules the config enables. Another linter (oxlint, Biome) needs its enabled React rules checked individually |48| **React Compiler on** | `babel-plugin-react-compiler` in `package.json`, and where the build enables it: `babel.config.js`, the Vite React plugin's `babel.plugins`, `reactCompiler` in `next.config.*`, `experiments.reactCompiler` in Expo's `app.json` / `app.config.*` | Decides whether manual memoization is noise or necessary (checklist §4) |49| **React version and renderer** | `react`, `react-dom` / `react-native`, and the framework (Next.js, Remix/React Router, Expo) in `package.json` | Which APIs are available to recommend (`useActionState`, `useOptimistic`, `useEffectEvent`), and which platform section of the checklist applies |5051If a rule runs, its findings are out of scope. If it does not — an old plugin version, rules52cherry-picked, or no hooks linting at all — the same issue is a review finding, and the53configuration gap goes in §P rather than being reported per occurrence.5455Run on `.jsx` / `.tsx` / `.js` / `.ts` files that render components or define hooks. Complements56`review-typescript` (type design) and `review-cleancode` (smells) — don't repeat them.5758## Usage5960```61review-react # Review context-related code62review-react --staged # Review staged changes63review-react --unpushed # Review files changed across all unpushed commits64review-react --changed # Review unstaged changes65review-react --all # Full codebase audit (parallel agents) + §P66review-react --multi # Also get external advisor opinions67```6869## Scope7071| Flag | Scope | Method |72|------|-------|--------|73| (none) | Context-related code | Files from the current conversation context. If no context, ask the user to specify files or use `--staged`/`--changed`/`--all`. |74| `--staged` | Staged changes | `git diff --cached --name-only` |75| `--unpushed` | Files changed across unpushed commits | `git diff --name-only $(git rev-list HEAD --not --remotes \| tail -1)^..HEAD` |76| `--changed` | Unstaged changes | `git diff --name-only` |77| `--all` | Full codebase + **§P project-level checks** | Glob component and hook files, parallel agents |78| `--multi` | Add external opinions | Combines with any scope above; invokes `second-opinion --quick` |7980If `--unpushed` cannot determine a range (nothing unpushed, no upstream, or the range walks back81to the root commit), stop and ask the user to pick another scope. Drop files that neither render82JSX nor call hooks.8384## Instructions85861. **Determine scope** (see table) and filter to component and hook files.872. **Read CLAUDE.md / AGENTS.md** in the repo root for project conventions (state library,88 data-fetching library, styling approach).893. **Establish the baseline** (table above): enabled hooks rules, compiler on or off, React90 version, renderer and framework. Record it; it calibrates every later step.914. **Review each file** against the judgment categories, looking at what the diff introduces.92 Load `references/checklist.md`, and from its §6 only the section for this renderer. Add93 **§P only at `--all`**.945. **Parallelize** if scope has more than 5 files: one sub-agent per category, then merge and95 dedupe.966. **External opinions** (if `--multi`): invoke `second-opinion --quick` with:9798 ```99 Read-only React review. Assume eslint-plugin-react-hooks handles rules-of-hooks, exhaustive-deps and its compiler-backed rules — do NOT repeat lint-level findings. React Compiler is {on|off}; renderer is {react-dom|react-native}. Focus on JUDGMENT: is any state derivable or duplicated? Does each effect synchronize with an external system, or is it event logic / a state-to-state sync? Are fetches race-safe? Are list keys stable? Is state owned at the right height and in the right store? Are boundaries (error, Suspense, client/server) placed well? Which render costs are real rather than hypothetical? 300 words or less.100 ```101102 Wait for all external results before proceeding.1037. **Classify severity** using Review grading and **report**.104105## Judgment categories106107`references/checklist.md` carries the full catalogue:1081091. **State modeling & placement** — derived or prop-copied state, contradictory flags, state too110 high or too low, server data or URL state held in components, resets done with effects.1112. **Effects** — event logic in effects, effect chains, parent notification, race-prone112 fetches, missing cleanup, hand-rolled external store subscriptions, dependency appeasement.1133. **Component boundaries & identity** — unstable keys, context churn, drilling vs.114 composition, controlled/uncontrolled mixing, boundary placement.1154. **Rendering cost & memoization** — calibrated to the compiler: noise when it is on, only116 measurable costs when it is off.1175. **Async UI** — pending, optimistic and error states, stale closures.1186. **Platform** — react-dom (hydration, Server/Client Components, accessible composite widgets)119 or React Native (lists, JS-thread work, native subscriptions, navigation lifecycle).120121State the reasoning for each finding. "This effect copies `user.name` into state, so editing122the profile elsewhere leaves the header stale" is a finding; "avoid useEffect" is not.123124## P. Project-level checks — `--all` only125126Configuration, not code; raising it on a diff review is noise.127128- **Hooks linting**: is `eslint-plugin-react-hooks` on v6+ with its `recommended` preset (or the129 compiler-backed rules enabled individually)? If not, enabling it replaces a large share of130 manual review.131- **Compiler adoption**: on a React 19 project without React Compiler, note what adopting it132 would remove (most manual memoization) and what it needs (code free of the violations its133 lint rules report). A recommendation, not a mandate.134- **Strict Mode** enabled at the root, so double-invoked effects and renders surface impurity135 in development.136137## Output Format138139```markdown140## React Review: {scope}141142### Baseline143{One line: hooks rules enabled, compiler on/off, React version, renderer/framework.144**At `--all` only:** the §P recommendations.}145146### Critical Issues (Must Fix)147- {file}:{line} — {category}: {description}148 **Why it's not a lint finding:** {what judgment this needed}149 **Impact:** {what the user sees}150 **Fix:** {with code}151152### Improvements (Should Fix)153- {file}:{line} — {category}: {description}154 **Fix:** {solution}155156### Suggestions (Nice to Have)157- {file}:{line} — {category}: {description} — {suggested change}158159```160161If `--multi` was used, append one subsection per advisor that responded (titled with the162advisor's name as reported by `second-opinion`), then a **Cross-Model Agreement** subsection.163164## Examples165166**Race-prone fetch (web):**167> review-react --staged168169A profile page fetches in `useEffect(() => { fetch(`/api/users/${id}`).then(setUser) }, [id])`.170Switching users quickly can show the previous user's profile. Reports Should Fix for a transient wrong-profile display, escalating only if the traced path leaks protected data or performs a materially wrong operation. Proposes an ignore171flag in cleanup, or the project's query hook if it has one. Not a lint finding:172`exhaustive-deps` is satisfied.173174**Effect instead of a handler (React Native):**175> review-react --changed176177A checkout screen sends a `purchase_completed` analytics event from an effect that watches178`order.status`. It re-fires when the screen remounts after navigating back. Reports Should Fix: move179it into the submit handler's success path.180181**Memoization noise under the compiler:**182> review-react183184Baseline shows React Compiler on. A new component wraps every handler in `useCallback` and185the component in `memo`. Reports Nice to Have: remove them, since the compiler memoizes the same186values; keep only a `useCallback` whose identity an imperative library depends on.187188## Troubleshooting189190### Findings overlap with the linter191**Cause:** the baseline was skipped or assumed.192**Solution:** check whether the rule is enabled and runs (`lint` script flags included). If it193runs, drop the finding. If not, keep it and add the configuration gap to §P.194195### Can't tell whether the compiler is on196**Cause:** it is enabled in build config the scan did not reach, or only for some directories197(`compilationMode: 'annotation'`, a `sources` filter, `'use no memo'` opt-outs).198**Solution:** read the compiler options where the plugin is configured. If still unclear, say199so in the baseline and skip compiler-dependent memoization findings rather than guessing.200201### A pattern looks wrong but the project does it everywhere202**Cause:** a house convention (a global store for all state, a data layer that owns fetching).203**Solution:** follow CLAUDE.md / AGENTS.md. Report a convention only where it causes a concrete204bug in the scoped code, once, not per occurrence.205206## Notes207208- Model state first, then question effects, then worry about render cost. Most effect209 findings disappear once state is modeled correctly, and most render-cost findings disappear210 under the compiler.211- Don't recommend a library the project doesn't use (a query cache, a state manager) when the212 fix works with what is there; mention it as a suggestion at most.213- Sources: react.dev — "You Might Not Need an Effect", "Choosing the State Structure",214 "Preserving and Resetting State", the React Compiler docs, and the eslint-plugin-react-hooks215 README.