No slash command · from rust-plugin
Runs Rust tests with cargo-nextest for parallel execution, process isolation, and advanced filtering. Useful for CI setup, flaky test retries, and optimizing test runtime.
Ships in rust-plugin. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
cargo-nextest is a faster, more reliable test runner for Rust that executes each test in its own process for better isolation and parallel performance.
| Use this skill when... | Use sibling skill instead when... |
|---|---|
| Running tests in parallel with process isolation | Measuring code coverage -- use cargo-llvm-cov |
| Filtering tests by package, name, or pattern | Linting test code style -- use clippy-advanced |
| Setting up flaky-test retries in CI | Auditing unused test deps -- use cargo-machete |
| Optimizing test runtime via partitioning | Authoring tests / async patterns -- use rust-development |
# Install cargo-nextest
cargo install cargo-nextest --locked
# Verify installation
cargo nextest --version
# Run all tests with nextest
cargo nextest run
# Run specific test
cargo nextest run test_name
# Run tests in specific package
cargo nextest run -p package_name
# Run with verbose output
cargo nextest run --verbose
# Run ignored tests
cargo nextest run -- --ignored
# Run all tests including ignored
cargo nextest run -- --include-ignored
Create .config/nextest.toml in your project root:
[profile.default]
# Number of retries for flaky tests
retries = 0
# Test threads (default: number of logical CPUs)
test-threads = 8
# Fail fast - stop on first failure
fail-fast = false
# Show output for passing tests
success-output = "never" # never, immediate, final, immediate-final
# Show output for failing tests
failure-output = "immediate" # never, immediate, final, immediate-final
[profile.ci]
# CI-specific configuration
retries = 2
fail-fast = true
success-output = "never"
failure-output = "immediate-final"
# Slow test timeout
slow-timeout = { period = "60s", terminate-after = 2 }
[profile.ci.junit]
# JUnit XML output for CI
path = "target/nextest/ci/junit.xml"
# Run tests matching pattern
cargo nextest run -E 'test(auth)'
# Run tests in specific binary
cargo nextest run -E 'binary(my_app)'
# Run tests in specific package
cargo nextest run -E 'package(my_crate)'
# Complex expressions with operators
cargo nextest run -E 'test(auth) and not test(slow)'
# Run all integration tests
cargo nextest run -E 'kind(test)'
# Run only unit tests in library
cargo nextest run -E 'kind(lib) and test(/)'
test(pattern) - Match test name (regex)binary(pattern) - Match binary namepackage(pattern) - Match package namekind(type) - Match test kind (lib, bin, test, bench, example)platform(os) - Match target platformnot expr - Logical NOTexpr and expr - Logical ANDexpr or expr - Logical ORNextest runs each test in its own process by default, providing:
# Control parallelism
cargo nextest run --test-threads 4
# Single-threaded execution
cargo nextest run --test-threads 1
# Use all available cores
cargo nextest run --test-threads 0
# Human-readable output (default)
cargo nextest run
# JSON output for programmatic parsing
cargo nextest run --message-format json
# JSON with test output
cargo nextest run --message-format json-pretty
# Generate JUnit XML for CI
cargo nextest run --profile ci
# Combine with cargo-llvm-cov for coverage
cargo llvm-cov nextest --html
# In .config/nextest.toml
[profile.default]
# Retry flaky tests automatically
retries = 3
# Detect tests that pass on retry
[profile.default.overrides]
filter = 'test(flaky_)'
retries = 5
# Run with retries
cargo nextest run --retries 3
# Show retry statistics
cargo nextest run --retries 3 --failure-output immediate-final
name: Test
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Install the pinned toolchain
run: rustup toolchain install --no-self-update
- name: Install nextest
uses: taiki-e/[email protected]
with:
tool: nextest
- name: Run tests
run: cargo nextest run --profile ci --all-features
- name: Upload test results
if: always()
uses: actions/[email protected]
with:
name: test-results
path: target/nextest/ci/junit.xml
- name: Publish test results
uses: EnricoMi/[email protected]
if: always()
with:
files: target/nextest/ci/junit.xml
# .config/nextest.toml
[profile.default]
# Timeout for slow tests
slow-timeout = { period = "30s", terminate-after = 3 }
# Test groups for resource management
[test-groups.database]
max-threads = 1 # Serialize database tests
[profile.default.overrides]
filter = 'test(db_)'
test-group = 'database'
# Platform-specific overrides
[[profile.default.overrides]]
platform = 'x86_64-pc-windows-msvc'
slow-timeout = { period = "60s" }
Important: nextest does not support doctests. Use cargo test for doctests:
# Run doctests separately
cargo test --doc
# Run both nextest and doctests in CI
cargo nextest run && cargo test --doc
# In workspace root .config/nextest.toml
[profile.default]
default-filter = 'all()'
# Per-package overrides
[[profile.default.overrides]]
filter = 'package(slow_tests)'
test-threads = 1
slow-timeout = { period = "120s" }
| Feature | cargo test | cargo nextest |
|---|---|---|
| Execution model | In-process | Per-test process |
| Parallelism | Thread-based | Process-based |
| Test isolation | Shared state | Complete isolation |
| Output format | Limited | Rich (JSON, JUnit) |
| Flaky test handling | Manual | Built-in retries |
| Doctests | Supported | Not supported |
| Performance | Good | Excellent |
Use profiles for different environments:
default for local developmentci for continuous integrationcoverage for coverage analysisConfigure flaky test detection:
[profile.default]
retries = 2
Group resource-intensive tests:
[test-groups.expensive]
max-threads = 2
Set appropriate timeouts:
[profile.default]
slow-timeout = { period = "60s", terminate-after = 2 }
Use expression filters effectively:
# Run fast tests during development
cargo nextest run -E 'not test(slow_)'
Always run doctests separately in CI:
- run: cargo nextest run --all-features
- run: cargo test --doc --all-features
Tests timeout too quickly:
[profile.default]
slow-timeout = { period = "120s", terminate-after = 3 }
Too much parallel execution:
cargo nextest run --test-threads 4
Need test output for debugging:
cargo nextest run --success-output immediate --failure-output immediate
Flaky tests in CI:
[profile.ci]
retries = 3
failure-output = "immediate-final"
What SKILL.md sets; muted values are Claude Code's defaults
10 skills in this plugin
/cargo-distcargo-dist (dist) release binaries for a Rust CLI. Use when setting up dist-workspace.toml, pairing dist with release-please, or publishing a Homebrew formula./cargo-generatecargo-generate: scaffold a project from a git template repo. Use when bootstrapping a Rust or Bevy project from a template, or authoring one./cargo-llvm-covcargo-llvm-cov: Rust code coverage with LLVM instrumentation. Use when measuring coverage, enforcing thresholds, generating reports, or integrating codecov/coveralls./cargo-machetecargo-machete: detect unused Rust dependencies. Use when auditing Cargo.toml, optimizing build times, or cleaning up dependency bloat./cargo-worktree-buildsShare one CARGO_TARGET_DIR across parallel git-worktree agents so Rust deps compile once. Use when worktrees run cargo concurrently, rebuild deps N times, or fill disk with N target/ copies./clippy-advancedAdvanced Clippy configuration for Rust — custom rules, pedantic/nursery lints, clippy.toml, IDE and CI integration. Use when configuring or enforcing lint standards.npx claudepluginhub laurigates/claude-plugins --plugin rust-pluginOther plugins' skills for the same job