A Claude Code plugin providing comprehensive Rust development support through:
- rust-analyzer LSP integration for IDE-like features
- 16 automated hooks for code quality, security, and analysis
- Cargo tool ecosystem integration
# Run the setup command (after installing the plugin)
/setupOr manually:
# Install rust-analyzer
rustup component add rust-analyzer
# Install nightly toolchain (required for some tools)
rustup toolchain install nightly
# Install all cargo tools
cargo install cargo-audit cargo-deny cargo-outdated cargo-machete \
cargo-semver-checks cargo-geiger cargo-expand cargo-bloat \
cargo-mutants && \
cargo +nightly install cargo-udepsThe plugin configures rust-analyzer for Claude Code via .lsp.json:
{
"rust": {
"command": "rust-analyzer",
"args": [],
"extensionToLanguage": { ".rs": "rust" },
"transport": "stdio"
}
}Capabilities:
- Go to definition / references
- Hover documentation
- Code actions and quick fixes
- Workspace symbol search
- Real-time diagnostics
All hooks run afterWrite and are configured in hooks/hooks.json.
| Hook | Trigger | Description |
|---|---|---|
rust-format-on-edit |
**/*.rs |
Auto-format with rustfmt |
rust-check-on-edit |
**/*.rs |
Compile check with cargo check |
rust-clippy-on-edit |
**/*.rs |
Lint with cargo clippy |
rust-test-compile-on-edit |
**/*.rs |
Verify tests compile (cargo test --no-run) |
| Hook | Trigger | Description |
|---|---|---|
rust-doc-check |
**/src/**/*.rs |
Check rustdoc for warnings/errors |
rust-todo-fixme |
**/*.rs |
Surface TODO/FIXME/XXX/HACK comments |
rust-unsafe-detector |
**/*.rs |
Flag unsafe blocks for review |
| Hook | Trigger | Tool Required | Description |
|---|---|---|---|
rust-audit |
**/Cargo.lock |
cargo-audit |
CVE vulnerability scanning |
rust-deny-check |
**/Cargo.toml |
cargo-deny |
License/security policy enforcement |
rust-outdated |
**/Cargo.toml |
cargo-outdated |
Check for outdated dependencies |
rust-machete |
**/Cargo.toml |
cargo-machete |
Fast unused dependency detection |
rust-unused-deps |
**/Cargo.toml |
cargo-udeps |
Thorough unused dependency check (nightly) |
| Hook | Trigger | Tool Required | Description |
|---|---|---|---|
rust-semver-check |
**/src/lib.rs |
cargo-semver-checks |
API compatibility verification |
rust-geiger |
**/Cargo.toml |
cargo-geiger |
Unsafe code ratio in dependencies |
| Hook | Trigger | Description |
|---|---|---|
rust-mutants-hint |
**/src/**/*.rs |
Suggests mutation testing when available |
rust-bloat-hint |
**/Cargo.toml |
Suggests binary size analysis |
rust-expand-hint |
**/*.rs |
Suggests macro expansion when macros detected |
rust-bench-hint |
**/*.rs |
Suggests benchmark run when benchmarks detected |
| Hook | Trigger | Description |
|---|---|---|
markdown-lint-on-edit |
**/*.md |
Lint markdown files |
| Tool | Installation | Purpose |
|---|---|---|
rustfmt |
rustup component add rustfmt |
Code formatting |
clippy |
rustup component add clippy |
Linting |
rust-analyzer |
rustup component add rust-analyzer |
LSP server |
| Tool | Installation | Purpose |
|---|---|---|
cargo-audit |
cargo install cargo-audit |
Security vulnerability database |
cargo-deny |
cargo install cargo-deny |
License and security policy |
cargo-outdated |
cargo install cargo-outdated |
Dependency freshness |
cargo-machete |
cargo install cargo-machete |
Unused dependencies (fast) |
| Tool | Installation | Purpose |
|---|---|---|
cargo-udeps |
cargo +nightly install cargo-udeps |
Unused dependencies (thorough) |
cargo-semver-checks |
cargo install cargo-semver-checks |
Semver compatibility |
cargo-geiger |
cargo install cargo-geiger |
Unsafe code metrics |
cargo-expand |
cargo install cargo-expand |
Macro expansion |
cargo-bloat |
cargo install cargo-bloat |
Binary size analysis |
cargo-mutants |
cargo install cargo-mutants |
Mutation testing |
Interactive setup wizard for configuring the complete Rust development environment.
What it does:
- Verifies Rust toolchain - Checks
rustupandcargoinstallation - Installs rust-analyzer - LSP server for IDE features
- Installs nightly toolchain - Required for
cargo-udeps - Installs cargo tools - All 10 recommended extensions
- Validates LSP config - Confirms
.lsp.jsonis correct - Initializes deny.toml - Sets up security/license policy (if needed)
- Verifies hooks - Confirms hooks are properly loaded
Usage:
/setupQuick install command (from the wizard):
rustup component add rust-analyzer && \
rustup toolchain install nightly && \
cargo install cargo-audit cargo-deny cargo-outdated cargo-machete \
cargo-semver-checks cargo-geiger cargo-expand cargo-bloat \
cargo-mutants && \
cargo +nightly install cargo-udeps| Command | Description |
|---|---|
/setup |
Full interactive setup for LSP and all cargo tools |
If using cargo-deny, initialize configuration:
cargo deny initThis creates deny.toml for configuring:
- Allowed/denied licenses
- Security advisory settings
- Duplicate dependency rules
Edit hooks/hooks.json to:
- Disable hooks by removing entries
- Adjust output limits (
head -N) - Modify matchers for different file patterns
- Add project-specific hooks
Example - disable a hook:
{
"name": "rust-geiger",
"enabled": false,
...
}rust-lsp/
├── .claude/
│ └── commands/
│ └── setup.md # /setup command
├── .claude-plugin/
│ └── plugin.json # Plugin metadata
├── .lsp.json # rust-analyzer configuration
├── hooks/
│ └── hooks.json # 16 automated hooks
├── CLAUDE.md # Project instructions
└── README.md # This file
- Ensure
Cargo.tomlexists in project root - Run
cargo checkto generate initial build artifacts - Verify installation:
rust-analyzer --version - Check LSP config:
cat .lsp.json
Requires nightly toolchain:
rustup toolchain install nightly
rustup component add rust-src --toolchain nightly
cargo +nightly udepsInitialize and update:
cargo deny init
cargo deny fetch- Verify hooks are loaded:
cat hooks/hooks.json - Check file patterns match your structure
- Ensure required tools are installed (
command -v cargo-audit)
Reduce head -N values in hooks.json for less verbose output.
MIT