CH

check-rust-coverage

Detects and lists specific lines of Rust code not covered by existing tests.

Install

mkdir -p .claude/skills/check-rust-coverage && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/1049" && unzip -o skill.zip -d .claude/skills/check-rust-coverage && rm skill.zip

Installs to .claude/skills/check-rust-coverage

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Check which Rust lines are not covered by Rust tests. Use this when you developed new Rust code and want to ensure it is tested.
128 chars✓ has a “when” trigger
Beginner

Key capabilities

  • →Run coverage analysis on Rust crates
  • →Identify untested lines of code
  • →Output uncovered line numbers

How it works

It executes cargo llvm-cov to generate coverage data and filters the JSON output to display lines with zero hits.

Inputs & outputs

You give it
Path to a Rust crate
You get back
List of uncovered lines per file

When to use check-rust-coverage

  • →Check test coverage for new crate features
  • →Identify untested edge cases in source code
  • →Audit project test maturity

About this skill

Check Rust Coverage

Determine which Rust lines are not covered by Rust tests.

Arguments

  • <path>: Path to a Rust crate.
  • <path 1> <path 2>: Multiple crate paths.

If a path doesn't include src/, assume it to be in the src/redisearch_rs directory. E.g. numeric_range_tree becomes src/redisearch_rs/numeric_range_tree. If a path points to a directory, consider all Rust crates in that directory.

Instructions

Run

NEXTEST_PROFILE=coverage cargo +$(cat .rust-nightly) llvm-cov nextest --manifest-path <crate_directory>/Cargo.toml --branch --json 2>/dev/null | jq -r '"Uncovered Lines:",
(.data[0].files[] |
  .filename as $f |
  [.segments[] | select(.[2] == 0 and .[4] == true) | .[0]] |
  unique |
  if length > 0 then "\($f): \(join(", "))" else empty end
),
"Partially Covered Branches (line: true/false):",
(.data[0].files[] |
  .filename as $f |
  [.branches | group_by(.[0:4])[] |
    {line: .[0][0], t: (map(.[4]) | add), f: (map(.[5]) | add)} |
    select(.t == 0 or .f == 0) | "\(.line): \(.t)/\(.f)"] |
  unique |
  if length > 0 then "\($f): \(join(", "))" else empty end
)'

from the repository root to get, for each file in the target crate, the lines no test executes and the conditions no test drives both ways.

This mirrors the CI coverage job, which Codecov reports from:

  • --branch is what catches a condition that runs but never takes one of its outcomes, such as one operand of an && chain that is never false. Without it such a line counts as covered.
  • --branch needs nightly, and only the pinned .rust-nightly is known to work: an unpinned +nightly can silently produce a report with every line at zero.
  • NEXTEST_PROFILE=coverage gives tests the longer timeouts that branch instrumentation needs; under the default profile slow tests are killed and no report is written.
  • Generic code yields one branch entry per instantiation, so the query sums them per condition before deciding it is partially covered.

Ignore lines that exist only to reject states the code rules out, as no test can reach them: unreachable!, unreachable_unchecked, debug_assert! and its variants, and a panic! or expect guarding an invariant. A condition inside a debug_assert! that never fails shows as partially covered for the same reason.

When not to use it

  • →When the project is not a Rust crate
  • →When tests are not configured for the target

Prerequisites

cargo-llvm-covjq

Limitations

  • →Requires cargo-llvm-cov installation
  • →Only works for Rust projects

How it compares

It provides a direct, automated path to identifying specific untested lines rather than relying on manual coverage report inspection.

Compared to similar skills

check-rust-coverage side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
check-rust-coverage (this skill)59moReviewBeginner
rust-tests-guidelines79moNo flagsBeginner
check-code-quality14moReviewAdvanced
lint15moReviewIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

Search skills

Search the agent skills registry