react-doctor Scores Your AI-Generated React, Then Teaches Your Agent to Stop Writing It
AI coding agents produce React that runs but routinely ships with stale closures, wasted re-renders, and silent accessibility failures that linters miss. A tool that both audits this damage and teaches the agent to avoid it cuts review time and prevents production bugs that TypeScript and ESLint alone cannot catch.
A single `npx` command scans an entire React project—Next.js, Vite, React Native—and produces a Lighthouse-style health score with file-and-line diagnostics for cascading setState calls, derived state, closure traps, unnecessary re-renders, XSS risks, missing aria labels, and dead code. Every finding includes a fix suggestion, not just a flag.
CI integration posts scan results as PR comments and can fail the build on warnings, blocking bad React from merging. The tool also merges existing ESLint or Oxlint configs so teams layer health scoring on top of their current lint setup without replacing it.
The standout feature is `react-doctor install`, which injects its rules directly into local AI coding agents. After installation, Claude Code, Cursor, Codex, and others generate React that respects the same checks the scanner enforces—shifting the tool from post-hoc cure to upfront prevention.
Quantifying React code quality with a single numeric score changes team conversations from subjective arguments to evidence-based decisions about where to spend improvement time.
Teaching an agent to write compliant code at generation time is a more scalable strategy than reviewing and fixing its output afterward—it treats the cause, not the symptom.
The tool's value sits in a gap that ESLint and Biome explicitly do not fill: they lint patterns, but they do not assess overall codebase health or prioritize severity across categories.
AI-generated React is especially prone to closure traps and derived-state bloat because agents optimize for immediate correctness, not for render efficiency or long-term maintainability.
Acceptable false-positive rates on performance rules are a known tradeoff in static analysis; the real question is whether the time saved catching real issues outweighs the time spent dismissing false alarms.