Installation for Agents
Install React Doctor as a skill for your coding agent:- Cursor (Cursor Agent)
- Claude Code (Anthropic)
- OpenCode (open-source)
- Amp Code
- Codex
- Gemini CLI
- Windsurf
- Antigravity
The skill teaches agents about 47+ React best practice rules so they avoid common issues while coding.
What the Skill Does
After installation, your coding agent:- Learns React best practices - Understands all React Doctor rules
- Runs checks automatically - Scans code after making changes
- Suggests fixes - Recommends solutions based on diagnostics
- Validates improvements - Re-runs scans to verify fixes worked
Agent Workflow
Coding agents use React Doctor in a verify-fix-verify loop:1
Make changes
Agent modifies your React code (new feature, bug fix, refactor)
2
Run scan
Agent executes
npx react-doctor . --verbose --diff to check changes3
Review diagnostics
Agent reads errors and warnings, prioritizes critical issues
4
Apply fixes
Agent resolves issues one by one, starting with errors
5
Verify improvements
Agent re-runs React Doctor to confirm the score improved
Manual Agent Commands
You can also ask your coding agent to run React Doctor manually:Full Scan
Scan Only Changes
Get Score Only
Automated Environment Detection
React Doctor automatically detects when it’s running inside a coding agent by checking environment variables:CLAUDECODE- Claude CodeCURSOR_AGENT- Cursor AgentOPENCODE- OpenCodeCODEX_CI- CodexAMP_HOME- Amp CodeAMI- Ami
- Skips interactive prompts (runs non-interactively)
- Outputs machine-readable diagnostics
- Suggests appropriate fixes for the agent to apply
You don’t need to configure anything. React Doctor automatically adjusts its behavior when running in agent environments.
Best Practices for Agents
1. Run After Each Change
Agents should run React Doctor after completing a feature or fix:2. Use Diff Mode for Speed
Always use--diff to scan only changed files:
3. Fix Errors Before Warnings
Agents should prioritize errors (severity: “error”) over warnings:4. Verify Score Improvements
After fixes, re-run to confirm the score increased:Using the Node.js API
Agents can use the programmatic API instead of CLI:Skill Configuration
The React Doctor skill is defined atskills/react-doctor/SKILL.md:
Troubleshooting Agent Integration
Skill Not Found
If the agent doesn’t recognize React Doctor:Agent Times Out
For large codebases, use--diff mode or specify a project:
Agent Skips Checks
Ensure Node.js version is compatible (v20.19.0+ or v22.12.0+):Example: OpenCode Integration
Here’s how OpenCode uses React Doctor:1
User requests feature
“Add a login form with email validation”
2
OpenCode writes code
Creates components, hooks, and validation logic
3
OpenCode runs React Doctor
npx react-doctor . --verbose --diff4
OpenCode reviews diagnostics
Finds issues like missing error boundaries, accessibility problems
5
OpenCode applies fixes
Wraps form in ErrorBoundary, adds ARIA labels, fixes hooks
6
OpenCode verifies
Re-runs scan, confirms score improved from 72 → 84