React Doctor
Website: https://react.doctor CLI Tool: react-doctor Repository: https://github.com/millionco/react-doctor License: MIT
Description
React Doctor lets coding agents diagnose and fix React code. One command scans your codebase for security, performance, correctness, and architecture issues, then outputs a 0-100 health score with actionable diagnostics. It auto-detects your framework (Next.js, Vite, Remix, etc.), React version, and compiler setup, then runs lint checks (60+ rules) and dead code detection in parallel.
Install
Run directly with npx:
npx -y react-doctor@latest .
Install as coding agent skill:
curl -fsSL https://react.doctor/install-skill.sh | bash
Supports Cursor, Claude Code, Amp Code, Codex, Gemini CLI, OpenCode, Windsurf, and Antigravity.
Usage
Basic Scan
npx -y react-doctor@latest .
Verbose Output (with file details)
npx -y react-doctor@latest . --verbose
Score Only
npx -y react-doctor@latest . --score
Scan Specific Directory
npx -y react-doctor@latest ./src
Diff Mode (only changed files)
npx -y react-doctor@latest . --diff main
Skip Checks
# Skip linting
npx -y react-doctor@latest . --no-lint
# Skip dead code detection
npx -y react-doctor@latest . --no-dead-code
Auto-Fix with Ami
npx -y react-doctor@latest . --fix
Commands
| Option | Description |
|---|---|
-v, --version |
Display version |
--verbose |
Show file details per rule |
--score |
Output only the score |
--no-lint |
Skip linting |
--no-dead-code |
Skip dead code detection |
--diff [base] |
Scan only files changed vs base branch |
--project <name> |
Select workspace project(s) |
-y, --yes |
Skip prompts, scan all workspace projects |
--fix |
Open Ami to auto-fix all issues |
-h, --help |
Display help |
Configuration
Create react-doctor.config.json in project root:
{
"ignore": {
"rules": ["react/no-danger", "jsx-a11y/no-autofocus", "knip/exports"],
"files": ["src/generated/**"]
}
}
Or use "reactDoctor" key in package.json:
{
"reactDoctor": {
"ignore": {
"rules": ["react/no-danger"]
}
}
}
Config Options
| Key | Type | Description |
|---|---|---|
ignore.rules |
string[] | Rules to suppress (e.g., react/no-danger) |
ignore.files |
string[] | Files to exclude, supports globs |
lint |
boolean | Enable/disable lint checks |
deadCode |
boolean | Enable/disable dead code detection |
verbose |
boolean | Show file details per rule |
diff |
boolean/string | Force diff mode or pin base branch |
Health Score
| Score | Rating |
|---|---|
| 75+ | Great |
| 50-74 | Needs work |
| <50 | Critical |
Rule Categories
- State & Effects
- Performance
- Architecture
- Bundle Size
- Security
- Correctness
- Accessibility
- Framework-specific (Next.js, React Native)
GitHub Actions
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: millionco/react-doctor@main
with:
diff: main
github-token: ${{ secrets.GITHUB_TOKEN }}
Node.js API
import { diagnose } from "react-doctor/api";
const result = await diagnose("./path/to/project");
console.log(result.score); // { score: 82, label: "Good" }
console.log(result.diagnostics); // Array of Diagnostic objects
console.log(result.project); // Framework, React version, etc.
Notes
- Auto-detection: Detects framework, React version, compiler setup automatically
- 60+ rules: Covers security, performance, correctness, architecture
- Dead code detection: Finds unused files, exports, types, duplicates
- Diff mode: Scan only changed files for faster CI
- Scoring: Errors weigh more than warnings in health score
- Coding agent support: Install as skill for AI-assisted fixes
Comments (0)
Add a Comment
No comments yet. Be the first to comment!