Back to Skills

cargo-llvm-cov

verified

Code coverage for Rust using LLVM instrumentation with support for multiple output formats and CI integration. Use when measuring test coverage, generating coverage reports, enforcing coverage thresholds, or integrating with codecov/coveralls. Trigger terms: coverage, llvm-cov, code coverage, test coverage, coverage report, codecov, coveralls, branch coverage.

View on GitHub

Marketplace

laurigates-plugins

laurigates/claude-plugins

Plugin

rust-plugin

language

Repository

laurigates/claude-plugins
3stars

rust-plugin/skills/cargo-llvm-cov/SKILL.md

Last Verified

January 24, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/laurigates/claude-plugins/blob/main/rust-plugin/skills/cargo-llvm-cov/SKILL.md -a claude-code --skill cargo-llvm-cov

Installation paths:

Claude
.claude/skills/cargo-llvm-cov/
Powered by add-skill CLI

Instructions

# cargo-llvm-cov - Code Coverage with LLVM

cargo-llvm-cov provides accurate code coverage for Rust using LLVM's instrumentation-based coverage. It supports multiple output formats and integrates seamlessly with CI platforms.

## Installation

```bash
# Install cargo-llvm-cov
cargo install cargo-llvm-cov

# Verify installation
cargo llvm-cov --version

# Install llvm-tools-preview component (required)
rustup component add llvm-tools-preview
```

## Basic Usage

```bash
# Run tests and generate coverage
cargo llvm-cov

# Generate HTML report
cargo llvm-cov --html
open target/llvm-cov/html/index.html

# Generate LCOV report
cargo llvm-cov --lcov --output-path target/llvm-cov/lcov.info

# Generate JSON report
cargo llvm-cov --json --output-path target/llvm-cov/coverage.json

# Show coverage as text summary
cargo llvm-cov --text

# Show coverage for specific files
cargo llvm-cov --text -- --show-instantiations
```

## Output Formats

```bash
# HTML report (interactive, line-by-line)
cargo llvm-cov --html --open

# LCOV format (compatible with many tools)
cargo llvm-cov --lcov --output-path lcov.info

# JSON format (programmatic analysis)
cargo llvm-cov --json --output-path coverage.json

# Cobertura XML (for Jenkins, GitLab)
cargo llvm-cov --cobertura --output-path cobertura.xml

# Text summary (terminal output)
cargo llvm-cov --text

# Multiple formats simultaneously
cargo llvm-cov --html --lcov --output-path lcov.info
```

## Coverage Thresholds for CI

```bash
# Fail if coverage is below threshold
cargo llvm-cov --fail-under-lines 80

# Multiple threshold types
cargo llvm-cov --fail-under-lines 80 --fail-under-functions 75

# Available threshold types
cargo llvm-cov --fail-under-lines 80      # Line coverage
cargo llvm-cov --fail-under-regions 80    # Region coverage
cargo llvm-cov --fail-under-functions 75  # Function coverage
```

### Threshold Configuration

Create a script or Makefile for consistent thresholds:

```makefile
# Makefile
.PHONY: coverage coverage-ci

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
8720 chars