Skip to main content

Basic Usage

Run React Doctor in your project directory:
Scan a specific directory:

Commands

Main Command

The main command scans your React codebase for issues.
string
default:"."
Project directory to scan

Fix Command

Open Ami to automatically fix detected issues.

Install Ami Command

Install Ami and open it to fix issues.

Options

Linting Options

boolean
default:"true"
Enable linting checks using oxlint
boolean
Skip linting checks
Example:

Dead Code Detection

boolean
default:"true"
Enable dead code detection using Knip
boolean
Skip dead code detection
Example:

Output Options

boolean
default:"false"
Show file details per rule, including line numbers for each diagnostic
boolean
default:"false"
Output only the score (0-100) without diagnostics
Examples:

Project Selection

string
Select workspace project(s) to scan. Comma-separated for multiple projects.
boolean
default:"false"
Skip prompts and scan all workspace projects
Examples:

Diff Mode

boolean | string
Scan only files changed vs base branch. If no base branch is specified, compares against uncommitted changes or the default base branch.
Examples:
Diff mode automatically disables dead code detection since it requires a full codebase scan.

Error Handling

string
default:"none"
Exit with error code on diagnostics. Valid values: error, warning, none
Examples:

Telemetry

boolean
default:"false"
Skip telemetry. Telemetry is anonymous, not stored, and only used to calculate your health score.
Example:

Ami Integration

boolean
default:"false"
Open Ami to auto-fix all detected issues
boolean
default:"false"
Skip Ami-related prompts
Examples:

Version

boolean
Display the version number
Example:

Common Workflows

Exit Codes

React Doctor uses exit codes to indicate scan results:
  • 0: Success (or no failures based on --fail-on setting)
  • 1: Diagnostics detected that match the --fail-on level
Example CI usage:

Environment Variables

React Doctor detects automated environments and adjusts behavior accordingly:
  • CI: Continuous Integration
  • CLAUDECODE: Claude Code
  • CURSOR_AGENT: Cursor Agent
  • OPENCODE: OpenCode
  • AMI: Ami environment
When these are set, React Doctor:
  • Skips interactive prompts
  • Scans all workspace projects automatically
  • Disables Ami installation prompts

Output

Standard Output

A typical scan produces:
  1. Project Detection: Framework, React version, TypeScript/JavaScript
  2. Diagnostics: Grouped by rule with severity, message, and help text
  3. Summary: Health score, error/warning counts, affected files
  4. Full Report: Diagnostics written to /tmp/react-doctor-{uuid}/

Verbose Output

With --verbose, each diagnostic includes:
  • File paths
  • Line numbers for each occurrence
  • Detailed context
Example:

Score-Only Output

With --score, outputs a single number (0-100):