Skip to content

Rust toolchain plugin that adds cargo, clippy, nextest, coverage, and dependency-audit skills for Claude Code.

CCM score
59 of 100
version
1.9.1
GitHub stars
60
View on GitHub

Own this plugin? Claim it

What it does

  • Adds rust-development agent plus skills for clippy, nextest, llvm-cov, machete, cargo-generate, cargo-dist, and mockito testing
  • Covers linting with cargo clippy -D warnings, parallel tests via cargo nextest run, and coverage with cargo llvm-cov thresholds
  • Includes a cargo-worktree-builds skill that shares one CARGO_TARGET_DIR across parallel git-worktree agents to avoid repeated builds
  • Designed for Rust projects that run CI with strict clippy lints and need unused-dependency checks via cargo-machete

Rust development - cargo, clippy, testing, memory safety

Add marketplace

/plugin marketplace add laurigates/claude-plugins

Run it inside Claude Code once, then install the plugin below.

Install

/plugin install rust-plugin@laurigates-claude-plugins

Run it inside Claude Code after adding the marketplace.

Files

Discovered from source

cargo-dist — Release Binaries for a Rust CLI

dist (formerly cargo-dist) builds per-target archives, installers and a Homebrew formula, and generates the release.yml GitHub workflow that does it on every tag. The Setup steps are the non-interactive setup, written for dist 0.32; check the installed version with dist --version and the config reference when it differs.

When to Use This Skill

Use this skill when...Use instead when...
Shipping prebuilt binaries of a Rust CLI on GitHub ReleasesVersioning and changelogs only: configure-plugin:configure-release-please
Pairing dist with release-please tagsTap layout, formula review, homebrew-core eligibility: the proposed homebrew-plugin
Adding a Homebrew formula or shell/PowerShell installerContainer images: configure-plugin:configure-container
Pinning the actions in dist's generated release.ymlStarting the crate itself: rust-plugin:cargo-generate
Producing the release once the binary is ready to shipThe binary still reads files from its checkout (embedded config, user dirs, clap shape): rust-plugin:rust-installable-cli

Take project facts from the project, or ask

Nothing in this skill assumes an owner, tap, target list or secret layout. Read them before writing config, and ask with AskUserQuestion for whatever the files do not settle:

FactWhere to look first
Binary crates and their namesCargo.toml ([[bin]], [workspace] members)
Release toolingrelease-please-config.json, .github/workflows/*release*
Homebrew tap (<owner>/homebrew-tap)An existing dist-workspace.toml, the README's install section
TargetsExisting CI matrix, the README's supported platforms
How secrets reach repo settingsAsk — it is the user's choice

When the user gives an answer that will hold across their repos (the tap, the target set, how secrets are provisioned), offer to save it as a user-level rule so later setups read it instead of asking again.

Context

  • Manifests: !find . -maxdepth 1 \( -name 'Cargo.toml' -o -name 'dist-workspace.toml' -o -name 'release-please-config.json' \)
  • Release workflows: !find . -maxdepth 3 -path './.github/workflows/release*.yml'

Setup

1. Write dist-workspace.toml by hand, then generate

dist init is interactive. Write the file directly and let dist generate produce release.yml:

[workspace]
members = ["cargo:."]

[dist]
cargo-dist-version = "0.32.0"
ci = "github"
installers = ["shell", "homebrew"]
tap = "<owner>/homebrew-tap"
targets = ["aarch64-apple-darwin", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu"]
install-path = "CARGO_HOME"
create-release = false          # release-please owns the GitHub Release
publish-jobs = ["./publish-homebrew"]
dist generate          # writes .github/workflows/release.yml

To run a pinned dist without installing it, use mise if it is available, otherwise dist's own installer:

mise exec github:axodotdev/cargo-dist@<version> -- dist generate

2. Add the dist profile

dist build fails with "profile dist is not defined" until the workspace Cargo.toml has it:

[profile.dist]
inherits = "release"
lto = "thin"

3. Choose which crates ship

SituationSetting on the crate
Workspace has publish = false[package.metadata.dist] dist = true on each binary crate that ships — dist skips unpublishable crates otherwise
Several binary crates, only some ship[package.metadata.dist] dist = false on the rest — each shipped binary crate becomes its own release and its own formula
Install name differs from the package name[package.metadata.dist] formula = "<binary>"

The formula and the archives are named after the package, not the binary. formula changes the install name only; archives keep the package name (<package>-<target>.tar.xz).

Set homepage in package metadata. Without it, dist generate warns "The Homebrew publish job is enabled but no homepage was specified". In a workspace, put homepage in [workspace.package] and homepage.workspace = true in the crate.

Working with release-please

  • create-release = false makes dist upload to the release that already exists for the tag, instead of creating its own. release-please creates that release.
  • release-please must run with a GitHub App token (or a PAT), not GITHUB_TOKEN. A tag pushed with GITHUB_TOKEN does not trigger other workflows, so release.yml never starts. The token setup is in configure-plugin:configure-release-please.
  • On pull requests, release.yml runs only plan (pr-run-mode = "plan", the default), so a green PR check does not prove the build works. Verify locally (Verify before tagging).

Pinning the generated workflow's actions

Hand edits to release.yml are overwritten by the next dist generate, and dist generate --check fails on them. Pin through config instead:

[dist.github-action-commits]
"actions/checkout" = "<sha-or-tag>"
"actions/upload-artifact" = "<sha-or-tag>"
"actions/download-artifact" = "<sha-or-tag>"

The table accepts tags ("v7.0.1") as well as commit SHAs, so follow the repo's existing pinning convention.

Custom publish job

Use a custom job when the built-in homebrew publish job does not fit — for example when the tap token is a static repository secret the built-in job cannot read under that name. List it as publish-jobs = ["./publish-homebrew"] and write .github/workflows/publish-homebrew.yml as a reusable workflow (on: workflow_call with a required string input plan).

dist generate calls it from release.yml like this (abbreviated):

custom-publish-homebrew:
  needs: [plan, ...]
  if: ${{ !fromJson(needs.plan.outputs.val).announcement_is_prerelease || fromJson(needs.plan.outputs.val).publish_prereleases }}
  uses: ./.github/workflows/publish-homebrew.yml
  with:
    plan: ${{ needs.plan.outputs.val }}
  secrets: inherit

The prerelease guard stays on the calling job, so the reusable workflow does not repeat it. With homebrew in installers but not in publish-jobs, dist generate warns "A Homebrew tap was specified but the Homebrew publish job is disabled". That warning is expected: the formula is still built as a release artifact, and the custom job publishes it.

Verify before tagging

CheckCommand
Config parses, release plan is what you expectdist plan
Committed release.yml matches configdist generate --check
One target buildsdist build --artifacts=local --target <triple>
Generated Homebrew formuladist build --artifacts=global (look under target/distrib/)

After the local build, extract the archive from target/distrib/ and run the binary with --version.

Limits

  • [dist.dependencies.homebrew] entries default to stage = "build": they are installed on the build machine and do not become depends_on in the formula. The config reference documents stage = ["build", "run"] for runtime dependencies; confirm the generated formula with dist build --artifacts=global before relying on it.
  • PR runs do only plan (Working with release-please).

Agentic Optimizations

ContextCommand
Plan as JSONdist plan --output-format=json
CI drift checkdist generate --check
Single-target smoke builddist build --artifacts=local --target <triple>
Pinned dist without installmise exec github:axodotdev/cargo-dist@<version> -- dist plan

Readme

Rust Plugin

Comprehensive Rust development support including modern language features, cargo tooling, testing, coverage, and code quality.

Overview

This plugin provides expert knowledge for Rust development with a focus on:

  • Modern Rust 2024+ features and ownership patterns
  • Async programming with Tokio
  • Memory safety and fearless concurrency
  • Advanced cargo tooling for testing and coverage
  • Code quality with clippy
  • Dependency management and cleanup

Contents

Agent

rust-development - Expert Rust development agent

  • Modern Rust language features (2024 edition, const generics, GATs)
  • Ownership, borrowing, and lifetime management
  • Async programming patterns with Tokio
  • Error handling with thiserror and anyhow
  • Performance optimization and profiling
  • FFI, WebAssembly, and embedded systems
  • Unsafe code guidelines with safety documentation

Skills

rust-development - Core Rust development

  • Cargo build system and package management
  • Rustc compiler optimization and cross-compilation
  • Clippy linting and rustfmt formatting
  • Ownership patterns and memory safety
  • Async programming with Tokio and async-std
  • Error handling and type safety
  • Testing and benchmarking

clippy-advanced - Advanced Clippy configuration

  • Comprehensive lint categories and rules
  • Custom clippy.toml configuration
  • Disallowed methods and types
  • CI integration and GitHub Actions
  • rust-analyzer IDE integration
  • Workspace-wide lint configuration

cargo-nextest - Next-generation test runner

  • Parallel test execution with process isolation
  • Advanced test filtering with expression language
  • Flaky test detection and retries
  • JUnit XML output for CI
  • GitHub Actions integration
  • Test groups and timeouts

mockito-http-mocking - HTTP API mocking in integration tests

  • Expectation semantics (matched() equals-count trap, expect_at_least)
  • Mock matching order (first created wins; specific before catch-all)
  • Taming polling clients against instant mock servers (error backoff, task.abort())
  • teloxide long-poll specifics and a diagnosis checklist

cargo-llvm-cov - Code coverage with LLVM

  • LLVM-based coverage instrumentation
  • Multiple output formats (HTML, LCOV, JSON, Cobertura)
  • Coverage thresholds for CI
  • Branch coverage (nightly)
  • Codecov and Coveralls integration
  • Integration with cargo-nextest

cargo-machete - Unused dependency detection

  • Fast unused dependency analysis
  • Comparison with cargo-udeps
  • False positive handling
  • CI integration
  • Workspace support
  • Dependency audit workflows

cargo-generate - Project scaffolding from git templates

  • Generating from published templates (Bevy, wasm-pack) and local directories
  • Authoring templates: cargo-generate.toml placeholders, conditionals, Rhai hooks
  • Non-interactive use (--define, --template-values-file, --silent)
  • Liquid brace collisions with GitHub Actions / Handlebars, and the fixes
  • Works for non-Rust projects — a template needs no Cargo.toml

cargo-worktree-builds - Shared target dir for parallel worktree agents

  • One pre-warmed CARGO_TARGET_DIR across N git worktrees
  • Dependencies compile once instead of N times
  • Disk stays ≈ 1× instead of N× copies of target/
  • Cargo build-lock serialization (safety + thrash cap)
  • The transient stale-rlib "method not found" gotcha and its fix
  • Companion to agent-patterns-plugin worktree fan-out

cargo-dist - Release binaries with dist (cargo-dist)

  • Non-interactive setup: hand-written dist-workspace.toml, then dist generate
  • [profile.dist], and choosing which workspace crates ship (dist = true/false, formula)
  • Pairing with release-please (create-release = false, App-token tags)
  • Pinning the generated workflow's actions via [dist.github-action-commits]
  • Custom Homebrew publish jobs and the warnings they produce
  • Local verification: dist plan, dist generate --check, dist build

rust-installable-cli - Patterns for a CLI that runs outside its repo

  • Default config embedded with include_str!, plus a drift test when the crate keeps its own copy
  • Layered config (built-in, user, beside-input, input, CLI) with whole-entry tool tables
  • Hermetic library loader; only the binary reads the user's config
  • Config and cache directories from an injected env lookup, no dependency
  • clap: a positional input beside subcommands without args_conflicts_with_subcommands
  • Copy-out from a cache (copy, temp name then rename, plain names only) and stable cache keys

Quick Start

Using the Agent

# Invoke the rust-development agent for Rust projects
claude agent rust-development

The agent will automatically assist with:

  • Rust 2024 language features
  • Ownership and borrowing patterns
  • Async programming
  • Error handling
  • Performance optimization
  • Testing and documentation

Using the Skills

Skills are automatically loaded when working with Rust projects. They provide expert knowledge for:

# Comprehensive linting
cargo clippy --workspace --all-targets --all-features -- -D warnings

# Fast, parallel testing
cargo nextest run --profile ci --all-features

# Code coverage with thresholds
cargo llvm-cov nextest --all-features --fail-under-lines 80 --html

# Detect unused dependencies
cargo machete --with-metadata

Development Workflow

Project Setup

cargo new my-project              # plain binary/library
# — or scaffold from a template (see the cargo-generate skill)
# cargo generate --git https://github.com/TheBevyFlock/bevy_new_2d --name my_game
cd my-project
cargo add tokio --features full
cargo add serde --features derive
cargo add thiserror anyhow

Development Cycle

cargo check            # Fast type checking
cargo clippy          # Linting
cargo nextest run     # Fast parallel tests
cargo llvm-cov --html # Coverage report
cargo machete         # Check unused deps

CI Pipeline

# Quality checks
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo fmt --check

# Testing with coverage
cargo llvm-cov nextest \
  --all-features \
  --fail-under-lines 80 \
  --lcov --output-path lcov.info

# Dependency audit
cargo machete --with-metadata
cargo audit

Key Features

Modern Rust Development

  • Rust 2024 edition features (RPITIT, async fn in traits)
  • Const generics and compile-time computation
  • Generic associated types (GATs)
  • Advanced lifetime management

Memory Safety

  • Ownership patterns and borrowing
  • Smart pointers (Box, Rc, Arc, Cell, RefCell, Mutex, RwLock)
  • Interior mutability patterns
  • Zero-copy abstractions

Async Programming

  • Tokio runtime configuration
  • Concurrent execution patterns (join!, select!, spawn)
  • Stream processing
  • Graceful shutdown and cancellation

Testing & Coverage

  • cargo-nextest for parallel test execution
  • cargo-llvm-cov for LLVM-based coverage
  • Property-based testing with quickcheck
  • Fuzzing with cargo-fuzz

Code Quality

  • Advanced clippy configuration
  • Disallowed methods and types
  • Workspace-wide lint configuration
  • CI integration with strict linting

Dependency Management

  • Fast unused dependency detection with cargo-machete
  • Accurate analysis with cargo-udeps
  • Security audits with cargo-audit
  • License checking with cargo-deny

CI Integration

GitHub Actions Example

The jobs install the compiler named in a rust-toolchain.toml at the repository root, not a floating stable, so a new Rust release's clippy lints arrive as a Renovate PR instead of failing -D warnings on main. The file, the Renovate grouping and the rules for per-job components are in clippy-advanced § Pin the toolchain.

name: Rust CI

on: [push, pull_request]

env:
  CARGO_TERM_COLOR: always

jobs:
  quality:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      # Installs the toolchain rust-toolchain.toml names, with its clippy + rustfmt
      - run: rustup toolchain install --no-self-update
      - uses: Swatinem/rust-cache@v2

      - name: Clippy
        run: cargo clippy --workspace --all-targets --all-features -- -D warnings

      - name: Format check
        run: cargo fmt --check

  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: rustup toolchain install --no-self-update
      # Per-job extras go on the pinned toolchain, from the repo directory
      - run: rustup component add llvm-tools-preview
      - uses: Swatinem/rust-cache@v2

      - name: Install tools
        uses: taiki-e/install-action@v2
        with:
          tool: nextest,cargo-llvm-cov,cargo-machete

      - name: Test with coverage
        run: |
          cargo llvm-cov nextest \
            --all-features \
            --fail-under-lines 80 \
            --lcov --output-path lcov.info

      - name: Upload coverage
        uses: codecov/codecov-action@v4
        with:
          files: lcov.info

      - name: Check unused dependencies
        run: cargo machete --with-metadata

Best Practices

Ownership Patterns

// Prefer borrowing over ownership
fn process(data: &[u8]) -> Result<(), Error> { }

// Use Cow for flexible ownership
use std::borrow::Cow;
fn maybe_modify(input: Cow<'_, str>) -> Cow<'_, str> { }

Error Handling

use thiserror::Error;

#[derive(Error, Debug)]
pub enum ServiceError {
    #[error("connection failed: {0}")]
    Connection(#[from] std::io::Error),

    #[error("invalid input: {message}")]
    InvalidInput { message: String },
}

Async Programming

use tokio::sync::mpsc;

async fn run_service(mut shutdown: mpsc::Receiver<()>) {
    loop {
        tokio::select! {
            _ = shutdown.recv() => break,
            result = process_request() => handle(result),
        }
    }
}

Common Patterns

Testing

#[cfg(test)]
mod tests {
    #[test]
    fn test_parser() -> Result<()> {
        let result = parse("input")?;
        assert_eq!(result, expected);
        Ok(())
    }

    #[tokio::test]
    async fn test_async() {
        let result = fetch_data().await.unwrap();
        assert_eq!(result.status, Status::Success);
    }
}

Clippy Configuration

# Cargo.toml
[workspace.lints.clippy]
correctness = "deny"
complexity = "warn"
perf = "warn"
pedantic = "warn"
unwrap_used = "warn"

Resources

Installation

This plugin is part of the claude-plugins repository. Install by copying the rust-plugin directory to your Claude plugins location.

License

Same as parent repository.

Details

Marketplace
laurigates/claude-plugins
Source
rust-plugin
Author
Lauri Gates
Category
Language
License
MIT
Keywords
rust, cargo, clippy, memory-safety
Listed since
Apr 7, 2026

Questions

What does the rust-plugin add to Claude Code?

The rust-plugin adds a rust-development agent and skills for cargo, clippy, cargo-nextest, mockito HTTP mocking, cargo-llvm-cov, cargo-machete, cargo-generate, cargo-dist and other Rust tooling. It covers modern Rust features, ownership and async patterns with Tokio, and code quality checks.

How do I install the rust-plugin in Claude Code?

Run /plugin marketplace add laurigates/claude-plugins, then run /plugin install rust-plugin@laurigates-claude-plugins inside Claude Code. The second command installs the rust-plugin from that marketplace into your session.

Where does the rust-plugin fit among Developer Tools plugins?

The rust-plugin is listed in the Developer Tools category on Claude Marketplaces, alongside n8n, understand-anything, ruflo-cost-tracker, ruflo-iot-cognitum and ruflo-metaharness. It sets itself apart with Rust-specific skills for testing, coverage, dependency cleanup and release binaries.

Which Rust tasks can the rust-plugin help me with?

The plugin helps with cargo builds, clippy linting, rustfmt, cargo-nextest parallel tests, cargo-llvm-cov coverage with thresholds, and cargo-machete unused dependency checks. It also covers project scaffolding with cargo-generate and release setup with cargo-dist.

More from laurigates/claude-plugins

All 52

Similar to rust-plugin

More Developer Tools