rust-doctor

A unified code health tool for Rust — scan, score, and fix your codebase.
rust-doctor scans Rust projects for security, performance, correctness, architecture, and dependency issues, producing a 0–100 health score with actionable diagnostics.
See it in action →
https://github.com/user-attachments/assets/6766a5d8-9a47-4eb8-892e-76c1a23eb122
Features
- 700+ clippy lints with severity overrides and category mapping
- 19 custom AST rules via syn: error handling, performance, security, async, architecture, framework anti-patterns
- Async anti-pattern detection: blocking calls in async, block_on in async context
- Framework-specific rules: tokio, axum, actix-web
- Dependency auditing: CVE detection via cargo-audit, unused deps via cargo-machete
- Health score: 0–100 with ASCII doctor face output
- MCP server: integrate with Claude Code, Cursor, or any MCP-compatible AI tool
- Diff mode: scan only changed files for fast CI feedback
- Workspace support: scan all crates or select specific members
- Inline suppression:
// rust-doctor-disable-next-line <rule>
- Multiple output modes: terminal,
--json, --score, --sarif
- Setup wizard:
rust-doctor setup — auto-detects Claude Code, Cursor, Windsurf and configures MCP or installs skills in one command
- Claude Code skill:
/rust-doctor slash command — no MCP setup needed
- Library crate: use rust-doctor programmatically via
lib.rs
- NO_COLOR support: respects the NO_COLOR environment variable
Installation
npm / npx (recommended for MCP users)
npx rust-doctor --mcp
Or install globally:
npm install -g rust-doctor
This downloads a pre-built native binary for your platform — no Rust toolchain required.
cargo install (from source)
cargo install rust-doctor
cargo binstall (pre-built binary)
cargo binstall rust-doctor
Shell installer (Linux/macOS)
curl -fsSL https://github.com/ArthurDEV44/rust-doctor/releases/latest/download/install.sh | bash
PowerShell installer (Windows)
irm https://github.com/ArthurDEV44/rust-doctor/releases/latest/download/install.ps1 | iex
GitHub Releases
Download pre-built binaries from GitHub Releases.
Available platforms:
x86_64-unknown-linux-gnu
aarch64-unknown-linux-gnu
x86_64-apple-darwin
aarch64-apple-darwin
x86_64-pc-windows-msvc
Usage
# Scan current directory
rust-doctor
# Scan a specific directory
rust-doctor /path/to/project
# Get bare score for CI
rust-doctor --score
# JSON output
rust-doctor --json
# Scan only changed files
rust-doctor --diff
# Scan against a specific branch
rust-doctor --diff main
# Fail CI on errors
rust-doctor --fail-on error
# Scan specific workspace members
rust-doctor --project core,api
# Verbose output with file:line details
rust-doctor --verbose
# Install missing external tools (cargo-deny, cargo-audit, etc.)
rust-doctor --install-deps
# Run as MCP server
rust-doctor --mcp
# Setup wizard — configure AI agents automatically
rust-doctor setup
AI Agent Setup (recommended)
The fastest way to integrate rust-doctor with your AI coding agent:
npx rust-doctor@latest setup
The wizard auto-detects installed agents (Claude Code, Cursor, Windsurf) and lets you choose:
- CLI + Skills (default) — installs a
SKILL.md that teaches your agent to use the rust-doctor CLI with deep analysis capabilities
- MCP Server — configures the
rust-doctor --mcp stdio server in your agent's config file
The wizard handles detection, configuration, and verification in one command. For manual setup, see the sections below.
MCP Server
rust-doctor includes a built-in Model Context Protocol server, allowing AI coding assistants to scan and analyze Rust projects directly.
Tools
| Tool | Description |
|---|
scan | Scan a Rust project for code health issues. Returns diagnostics with a 0–100 health score. |
score | Get the health score (0–100) of a Rust project as a single integer. |
explain_rule | Get a detailed explanation of a rule: what it checks, why it matters, and how to fix violations. |
list_rules | List all available rules with their categories and severities. |