React Code Design Review
Review React code structure without turning team preferences into universal rules.
Operating contract
- Treat review as read-only unless the user also asks for fixes.
- Inspect the target component, its call sites, relevant hooks, tests, and nearby conventions.
- Distinguish page, feature, design-system, and reusable leaf components; the right ownership differs by role.
- Report only findings with a concrete maintenance, correctness, accessibility, or change-locality cost.
- Prefer the smallest change that restores a clear owner. Do not reward extraction by itself.
1. Establish context
Before judging structure, resolve:
- platform and rendering model: React web, React Native, server rendering, client rendering, or a mixture;
- component role and reuse surface;
- who owns data loading, mutations, state, spacing, error handling, and accessibility;
- actual call sites and whether the suspected coupling already creates repeated change;
- repository rules and established component patterns.
If the evidence is unavailable, mark the point as unverified instead of inventing a design problem.
2. Apply only relevant rules
Read references/rules.md and select only rules supported by the target code. The rule groups are:
- locality and ownership;
- UI-to-code mapping and responsibility;
- data access and side effects;
- composition and external layout;
- naming and pure logic;
- semantics and accessibility.
Rules are heuristics with exceptions. A server component may intentionally own loading for its subtree. A design-system component may intentionally own layout tokens. A small callback may be clearer as handleSubmit than a long procedural name.
3. Admit findings narrowly
A finding must contain all four elements:
- Location: exact file and symbol or tight line range.
- Evidence: current call flow, duplicated decision, leaked state, inaccessible interaction, or repeated change cost.
- Consequence: what becomes harder to understand, test, reuse, or change.
- Smallest correction: the minimum ownership or structure change that resolves the evidence.
Reject findings based only on:
- component length;
- hypothetical future reuse;
- personal folder or naming preference;
- a single prop passed one level;
- extraction that merely moves code;
- a rule whose stated exception matches the current design.
4. Prioritize
- High: correctness, inaccessible interaction, hidden cross-component state, or a structure already causing inconsistent behavior.
- Medium: concrete repeated change cost, unclear ownership, or coupling across established seams.
- Low: worthwhile cleanup with local evidence but no current behavioral risk.
Do not assign a severity when the claim is only a question or needs missing runtime evidence.
5. Report
Return:
## React code design review
### Findings
1. [High|Medium|Low] Short title
- Location: `path:line`
- Evidence: current code and call-site evidence
- Consequence: concrete cost or risk
- Smallest correction: bounded change
### Good boundaries to preserve
- Existing ownership or composition decisions that should not be disturbed
### Unverified
- Missing call-site, runtime, accessibility, or repository evidence
### Verdict
`CLEAN` or `CHANGES_RECOMMENDED`
If fixes are authorized, change only admitted findings, run focused checks, and report what each check actually proves.
1---2name: react-code-design-review3description: Review React and React Native code structure using contextual rules for ownership, data access, UI-to-code mapping, composition, naming, and accessibility. Use when a user asks to review, refactor, or design React code or a component-heavy diff. Inspect real call sites and repository conventions before reporting findings. Do not use for visual styling critique, broad application architecture, or performance review without structural evidence.4---56# React Code Design Review78Review React code structure without turning team preferences into universal rules.910## Operating contract1112- Treat review as read-only unless the user also asks for fixes.13- Inspect the target component, its call sites, relevant hooks, tests, and nearby conventions.14- Distinguish page, feature, design-system, and reusable leaf components; the right ownership differs by role.15- Report only findings with a concrete maintenance, correctness, accessibility, or change-locality cost.16- Prefer the smallest change that restores a clear owner. Do not reward extraction by itself.1718## 1. Establish context1920Before judging structure, resolve:21221. platform and rendering model: React web, React Native, server rendering, client rendering, or a mixture;232. component role and reuse surface;243. who owns data loading, mutations, state, spacing, error handling, and accessibility;254. actual call sites and whether the suspected coupling already creates repeated change;265. repository rules and established component patterns.2728If the evidence is unavailable, mark the point as unverified instead of inventing a design problem.2930## 2. Apply only relevant rules3132Read [references/rules.md](references/rules.md) and select only rules supported by the target code. The rule groups are:3334- locality and ownership;35- UI-to-code mapping and responsibility;36- data access and side effects;37- composition and external layout;38- naming and pure logic;39- semantics and accessibility.4041Rules are heuristics with exceptions. A server component may intentionally own loading for its subtree. A design-system component may intentionally own layout tokens. A small callback may be clearer as `handleSubmit` than a long procedural name.4243## 3. Admit findings narrowly4445A finding must contain all four elements:46471. **Location:** exact file and symbol or tight line range.482. **Evidence:** current call flow, duplicated decision, leaked state, inaccessible interaction, or repeated change cost.493. **Consequence:** what becomes harder to understand, test, reuse, or change.504. **Smallest correction:** the minimum ownership or structure change that resolves the evidence.5152Reject findings based only on:5354- component length;55- hypothetical future reuse;56- personal folder or naming preference;57- a single prop passed one level;58- extraction that merely moves code;59- a rule whose stated exception matches the current design.6061## 4. Prioritize6263- **High:** correctness, inaccessible interaction, hidden cross-component state, or a structure already causing inconsistent behavior.64- **Medium:** concrete repeated change cost, unclear ownership, or coupling across established seams.65- **Low:** worthwhile cleanup with local evidence but no current behavioral risk.6667Do not assign a severity when the claim is only a question or needs missing runtime evidence.6869## 5. Report7071Return:7273```markdown74## React code design review7576### Findings771. [High|Medium|Low] Short title78 - Location: `path:line`79 - Evidence: current code and call-site evidence80 - Consequence: concrete cost or risk81 - Smallest correction: bounded change8283### Good boundaries to preserve84- Existing ownership or composition decisions that should not be disturbed8586### Unverified87- Missing call-site, runtime, accessibility, or repository evidence8889### Verdict90`CLEAN` or `CHANGES_RECOMMENDED`91```9293If fixes are authorized, change only admitted findings, run focused checks, and report what each check actually proves.