
Rust Quality Gate
- 76 installs
- 63 repo stars
- Updated July 18, 2026
- bobmatnyc/claude-mpm-skills
rust-quality-gate is a protocol skill for running Rust quality gates (cargo fmt, clippy, test) in strict sequence before any merge.
About
This skill is a protocol for running Rust quality gates in strict sequence before a merge: cargo fmt, then cargo clippy with warnings denied, then cargo test. It documents stop-on-first-failure ordering, crate-name-versus-directory gotchas, reading test summary lines, and triaging pre-existing versus new failures. A developer uses it before creating a pull request or merging Rust code.
- Three-gate Rust sequence: cargo fmt, clippy -D warnings, then cargo test
- Stop-on-first-failure ordering with crate-name-vs-directory gotchas
- Pre-existing-versus-new failure triage via git stash
Rust Quality Gate by the numbers
- 76 all-time installs (skills.sh)
- Ranked #70 of 121 Rust skills by installs in the Skillselion catalog
- Data as of Aug 1, 2026 (Skillselion catalog sync)
rust-quality-gate capabilities & compatibility
- Capabilities
- quality gate · linting · test running
- Use cases
- code review · testing · ci cd
- Runs
- Runs locally
- Pricing
- Free
What rust-quality-gate says it does
Three-gate quality sequence (fmt → clippy → test) that must pass before any PR merge in a Rust workspace
Run gates in this exact order. **Stop on first failure — do not proceed to the next gate.**
**Evidence format required**: Report the literal summary line, not "tests pass".
npx skills add https://github.com/bobmatnyc/claude-mpm-skills --skill rust-quality-gateAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 76 |
|---|---|
| repo stars | ★ 63 |
| Last updated | July 18, 2026 |
| Repository | bobmatnyc/claude-mpm-skills ↗ |
What it does
Protocol for running Rust fmt, clippy, and test gates in sequence before merging, with failure triage guidance.
Who is it for?
Rust developers verifying formatting, lints, and tests before opening or merging a PR.
Skip if: Non-Rust projects or feature implementation.
When should I use this skill?
Before any PR merge, after implementation work, or when asked to check quality, run tests, or verify readiness to merge.
What you get
A verified fmt/clippy/test pass with literal test-summary evidence before merge.
By the numbers
- Defines a 3-gate sequence (fmt, clippy, test)
Files
Rust Quality Gate Protocol
When to Invoke
Invoke this protocol when:
- Any implementation task completes and code changes are ready to commit
- User asks "check quality", "run tests", "run clippy", "is this ready", or "verify"
- Before creating a pull request or merging to main
- After modifying a shared library crate (
trusty-common,trusty-mcp-core,trusty-embedder,trusty-symgraph) - After the rust-qa agent delivers a work product
The Three-Gate Sequence
Run gates in this exact order. Stop on first failure — do not proceed to the next gate.
Gate 1: Format Check (fastest — always run first)
cargo fmt --checkPass: No output, exit code 0.
Fail: Lists files with formatting differences. Fix with:
cargo fmtThen re-run cargo fmt --check to confirm clean.
Why first: Format failures are trivially fixable. Running it first avoids wasting clippy and test time on unformatted code.
Gate 2: Clippy Lint Gate
cargo clippy --workspace --all-targets -- -D warningsPass: No warnings emitted, exit code 0.
Fail: One or more error[clippy::] lines. Fix each warning the compiler reports. Common patterns:
# Check a single crate faster during iteration
cargo clippy -p trusty-search -- -D warnings
# Check with a specific feature enabled
cargo clippy -p trusty-common --features axum-server -- -D warningsopen-mpm exception: open-mpm has 142 pre-existing clippy errors at HEAD (tracked separately). These errors do not block other work. When running workspace-wide clippy and open-mpm fails, confirm whether the failures are confined to open-mpm only:
# Run clippy on everything except open-mpm to confirm other crates are clean
cargo clippy --workspace --all-targets -- -D warnings 2>&1 | grep -v "open-mpm"If all errors are in open-mpm, treat the gate as passing for the purpose of non-open-mpm work.
Gate 3: Test Gate
Single-crate (fast — use during iteration):
cargo test -p <crate>Workspace-wide (required before commit):
cargo test --workspaceWith ignored integration tests (full validation):
cargo test -p <crate> -- --include-ignored
# or workspace-wide:
cargo test --workspace -- --include-ignoredCrate Name vs Directory Name
Cargo -p flags use the `name` field in `Cargo.toml`, not the directory name. Exceptions:
| Directory | Cargo flag |
|---|---|
crates/trusty-git-analytics/ | -p tga |
crates/open-mpm/ | -p open-mpm |
All other crates: directory name = crate name (e.g. crates/trusty-search/ → -p trusty-search).
Reading Test Output
Cargo test output ends with a summary line:
test result: ok. 42 passed; 0 failed; 3 ignored; 0 measured; 0 filtered out| Field | Meaning |
|---|---|
passed | Tests that ran and succeeded |
failed | Tests that ran and failed — must be zero |
ignored | Tests tagged #[ignore] — skipped by default (ONNX/integration) |
measured | Benchmark results (bench mode only) |
`#[ignore]` tests: These are slow ONNX-backed or environment-dependent integration tests. They are intentionally skipped in the default gate. Run them with --include-ignored for full local validation before releases.
Evidence format required: Report the literal summary line, not "tests pass". Example of acceptable evidence:
test result: ok. 87 passed; 0 failed; 5 ignored; 0 measured; 0 filtered out; finished in 3.42sPre-existing vs New Failure Triage
If a gate fails, determine whether the failure existed before the current patch:
# Stash current changes
git stash
# Run the failing gate at clean HEAD
cargo test -p <crate>
# If it also fails at HEAD: pre-existing failure — do not block the patch
# If it passes at HEAD: the patch introduced the regression — must fix
# Restore patch
git stash popReport: "Failure is pre-existing at HEAD — not introduced by this change" or "Failure is new — introduced by this patch."
Single-Crate vs Workspace Scope
| Scope | Command | When |
|---|---|---|
| Single crate | cargo test -p <crate> | Fast iteration during implementation |
| Single crate (check only) | cargo check -p <crate> | Fastest — confirms compilation, no test run |
| Single crate + features | cargo test -p trusty-common --features axum-server | When feature flag needed |
| Workspace | cargo test --workspace | Required before committing any change |
| Workspace + ignored | cargo test --workspace -- --include-ignored | Before tagging a release |
After Modifying a Shared Library Crate
When trusty-common, trusty-mcp-core, trusty-embedder, or trusty-symgraph changes:
1. Run cargo check (workspace-wide) first — catches compilation errors in all dependents immediately. 2. Run cargo test -p <lib> for the modified library. 3. Run cargo test -p <consumer> for each crate that imports the modified library. 4. Only commit after all dependent tests pass.
Gate Summary
cargo fmt --check → Gate 1 (format) — fix: cargo fmt
cargo clippy --workspace → Gate 2 (lint) — fix: address each warning
cargo test -p <crate> → Gate 3 (tests) — fix: repair failing testsAll three must be green before a PR is mergeable. Evidence must include the literal output from each gate.
Anti-Patterns
- Running tests before format and clippy — wastes time if format fails.
- Reporting "tests pass" without showing the result summary line.
- Treating
ignoredcount as failures — they are intentionally skipped. - Blocking work on
open-mpmclippy errors that are pre-existing at HEAD. - Using
cargo buildas a substitute forcargo test— build success does not validate behavior. - Running
cargo testworkspace-wide without confirming crate name aliases (e.g., use-p tganot-p trusty-git-analytics).
{
"name": "rust-quality-gate",
"version": "1.0.0",
"category": "toolchain",
"toolchain": "rust",
"tags": [
"rust",
"quality",
"fmt",
"clippy",
"test",
"ci",
"pre-merge"
],
"entry_point_tokens": 120,
"full_tokens": 1200,
"related_skills": [
"cargo-release",
"github-actions"
],
"author": "Claude MPM Team",
"license": "MIT",
"requires": [],
"repository": "https://github.com/bobmatnyc/claude-mpm-skills",
"created": "2026-05-29",
"updated": "2026-05-29"
}
Related skills
FAQ
What order do the Rust gates run in?
cargo fmt --check first, then cargo clippy -D warnings, then cargo test, stopping on the first failure.
How do you tell a pre-existing failure from a new one?
git stash, run the failing gate at clean HEAD, then git stash pop to compare.