# How npx react-doctor install Equips AI Coding Agents with React Diagnostic Skills

> Learn how npx react-doctor install empowers AI coding agents like Cursor and Claude with React diagnostic skills. Enable intelligent code fixes and explanations based on best practices.

- Repository: [Million Software, Inc./react-doctor](https://github.com/millionco/react-doctor)
- Tags: how-to-guide
- Published: 2026-05-12

---

**The `npx react-doctor install` command detects installed AI coding agents on your system and installs a React-Doctor skill—consisting of Markdown rule files—enabling agents like Cursor and Claude Code to suggest fixes, explain rule intent, and auto-apply suppressions based on React best practices.**

The `millionco/react-doctor` repository provides static analysis for React applications, but the `npx react-doctor install` CLI command bridges the gap between diagnostics and AI code generation. When executed, this command copies structured skill documentation into agent-specific directories, allowing supported coding assistants to understand and apply React-Doctor rules directly within your development workflow.

## What Is the React-Doctor Skill?

The skill installed by `npx react-doctor install` is not a binary or library, but a collection of **Markdown documentation files** ([`SKILL.md`](https://github.com/millionco/react-doctor/blob/main/SKILL.md), [`AGENTS.md`](https://github.com/millionco/react-doctor/blob/main/AGENTS.md), `.cursorrules`) that encode React best-practice rules. Once installed, an agent can:

- **Suggest fixes** that satisfy React-Doctor diagnostics instead of merely reporting violations.
- **Explain rule intent** directly in chat conversations because the skill ships with comprehensive rule documentation.
- **Auto-apply suppressions** or refactorings using the same rule set the CLI uses for scoring.

## How npx react-doctor install Works: The Three-Stage Pipeline

The installation process follows a strict pipeline defined in [`packages/react-doctor/src/install-skill.ts`](https://github.com/millionco/react-doctor/blob/main/packages/react-doctor/src/install-skill.ts), delegating low-level operations to the upstream **agent-install** library to support **46 agents** (including Goose, Windsurf, and Replit) as of version 0.0.45.

### Step 1: Detect Available Agents

The function `detectAvailableAgents` in [`packages/react-doctor/src/utils/detect-agents.ts`](https://github.com/millionco/react-doctor/blob/main/packages/react-doctor/src/utils/detect-agents.ts) scans for agent binaries on `$PATH` and configuration directories in `$HOME` (such as `~/.cursor` or `~/.claude`). It utilizes `detectInstalledSkillAgents` and `getSkillAgentTypes` from the **agent-install** package to build a comprehensive list of supported agents present on your system.

### Step 2: Interactive Prompt or Auto-Select

Unless the terminal is non-interactive or the `--yes` flag is provided, the command invokes the prompt logic in [`packages/react-doctor/src/utils/prompts.ts`](https://github.com/millionco/react-doctor/blob/main/packages/react-doctor/src/utils/prompts.ts) to display a **multiselect UI**. This interface allows you to choose which detected agents should receive the skill, or you can bypass the UI entirely using the `-y` flag for automated environments.

### Step 3: Copy Skill Files to Agent Directories

The core installation logic resides in `runInstallSkill` within [`packages/react-doctor/src/install-skill.ts`](https://github.com/millionco/react-doctor/blob/main/packages/react-doctor/src/install-skill.ts), which wraps `installSkillsFromSource` from the **agent-install** library. Using `mode: "copy"`, it writes the bundled skill files from `skills/react-doctor` into each selected agent’s skill directory (for example, `.cursor/skills/react-doctor`). If the skill contains malformed front-matter or other errors, the operation aborts and surfaces a clear error message.

## CLI Options and Usage Examples

The command is registered in [`packages/react-doctor/src/cli.ts`](https://github.com/millionco/react-doctor/blob/main/packages/react-doctor/src/cli.ts) and supports flags for automation and verification.

Install interactively for all detected agents:

```bash
npx -y react-doctor@latest install

```

Skip the prompt and install automatically (ideal for CI/CD):

```bash
npx -y react-doctor@latest install --yes

```

Preview what would be installed without modifying the file system:

```bash
npx -y react-doctor@latest install --dry-run

```

## Key Source Files and Architecture

| File | Role |
|------|------|
| [`packages/react-doctor/src/cli.ts`](https://github.com/millionco/react-doctor/blob/main/packages/react-doctor/src/cli.ts) | Registers the `install` subcommand and parses `--yes` and `--dry-run` flags. |
| [`packages/react-doctor/src/install-skill.ts`](https://github.com/millionco/react-doctor/blob/main/packages/react-doctor/src/install-skill.ts) | Orchestrates detection, prompting, and skill installation via `runInstallSkill`. |
| [`packages/react-doctor/src/utils/detect-agents.ts`](https://github.com/millionco/react-doctor/blob/main/packages/react-doctor/src/utils/detect-agents.ts) | Implements `detectAvailableAgents` to scan `$PATH` and home directories. |
| [`packages/react-doctor/src/utils/prompts.ts`](https://github.com/millionco/react-doctor/blob/main/packages/react-doctor/src/utils/prompts.ts) | Handles interactive multiselect UI for agent selection. |
| [`packages/react-doctor/CHANGELOG.md`](https://github.com/millionco/react-doctor/blob/main/packages/react-doctor/CHANGELOG.md) | Documents delegation to **agent-install** and the expansion to 46 supported agents in v0.0.45. |

## Summary

- **`npx react-doctor install`** equips AI agents with Markdown-based React diagnostic skills, enabling contextual fix suggestions and rule explanations.
- The command executes a **three-stage pipeline**: agent detection via `detectAvailableAgents`, optional interactive prompting, and file copying through `installSkillsFromSource`.
- It supports **46+ agents** including Cursor, Claude Code, and Windsurf by delegating to the **agent-install** library.
- Use the **`--yes`** flag to automate installation in scripts, or **`--dry-run`** to preview changes without writing files.

## Frequently Asked Questions

### Which AI coding agents are supported by npx react-doctor install?

The command automatically supports **46 agents** as of version 0.0.45, including Claude Code, Cursor, Codex, OpenCode, Goose, Windsurf, and Replit. Support is determined dynamically by the underlying **agent-install** library, which scans for agent binaries and configuration directories on your system.

### Where does npx react-doctor install copy the skill files?

The skill files are copied into agent-specific skill directories within your home folder, such as `~/.cursor/skills/react-doctor` for Cursor or `~/.claude/skills/react-doctor` for Claude Code. The exact path is determined by the `installSkillsFromSource` function in the **agent-install** library using `mode: "copy"`.

### Can I use npx react-doctor install in non-interactive environments like CI/CD?

Yes, pass the **`--yes`** or **`-y`** flag to skip the interactive multiselect prompt and install the skill for all detected agents automatically. You can also use **`--dry-run`** to verify which agents would be targeted without modifying the file system, making it safe for testing deployment scripts.

### What happens if no agents are detected when running npx react-doctor install?

If `detectAvailableAgents` in [`packages/react-doctor/src/utils/detect-agents.ts`](https://github.com/millionco/react-doctor/blob/main/packages/react-doctor/src/utils/detect-agents.ts) finds no supported agent binaries or configuration directories, the command will report that no agents were detected and exit without installing files. In interactive mode, this means no multiselect UI is presented; in `--yes` mode, the command simply completes with a warning message.