cargo-llvm-cov
cargo-llvm-cov: Rust code coverage with LLVM instrumentation. Use when measuring coverage, enforcing thresholds, generating reports, or integrating codecov/coveralls.
What this skill does
# 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.
## When to Use This Skill
| Use this skill when... | Use sibling skill instead when... |
|---|---|
| Measuring line / branch coverage with LLVM instrumentation | Just running tests fast in parallel -- use `cargo-nextest` |
| Generating HTML / lcov / codecov reports | Auditing unused dependencies -- use `cargo-machete` |
| Enforcing coverage thresholds in CI | Configuring lint rules -- use `clippy-advanced` |
| Wiring codecov.io or coveralls upload | Writing the tests themselves -- use `rust-development` |
## 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
coverage:
cargo llvm-cov --html --open
coverage-ci:
cargo llvm-cov \
--fail-under-lines 80 \
--fail-under-functions 75 \
--lcov --output-path lcov.info
```
Or use a shell script:
```bash
#!/usr/bin/env bash
# scripts/coverage.sh
set -euo pipefail
COVERAGE_THRESHOLD="${COVERAGE_THRESHOLD:-80}"
cargo llvm-cov \
--fail-under-lines "$COVERAGE_THRESHOLD" \
--lcov --output-path target/llvm-cov/lcov.info \
--html
echo "Coverage threshold: $COVERAGE_THRESHOLD% (lines)"
```
## Branch Coverage (Nightly)
Branch coverage requires Rust nightly:
```bash
# Install nightly toolchain
rustup toolchain install nightly
rustup component add llvm-tools-preview --toolchain nightly
# Run with branch coverage
cargo +nightly llvm-cov --branch --html
# Branch coverage with thresholds
cargo +nightly llvm-cov \
--branch \
--fail-under-lines 80 \
--fail-under-branches 70
```
### Branch Coverage Configuration
```toml
# rust-toolchain.toml
[toolchain]
channel = "nightly"
components = ["llvm-tools-preview"]
# Allows using `cargo llvm-cov --branch` without +nightly
```
## Integration with cargo-nextest
```bash
# Use nextest as test runner
cargo llvm-cov nextest --html
# With nextest profile
cargo llvm-cov nextest --profile ci --lcov --output-path lcov.info
# All nextest options work
cargo llvm-cov nextest -E 'not test(slow_)' --html
```
## Codecov Integration
```yaml
# .github/workflows/coverage.yml
name: Coverage
on: [push, pull_request]
jobs:
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@v2
with:
tool: cargo-llvm-cov
- name: Generate coverage
run: cargo llvm-cov --all-features --lcov --output-path lcov.info
- name: Upload to codecov
uses: codecov/codecov-action@v4
with:
files: lcov.info
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
```
## Coveralls Integration
```yaml
# .github/workflows/coverage.yml
name: Coverage
on: [push, pull_request]
jobs:
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@v2
with:
tool: cargo-llvm-cov
- name: Generate coverage
run: cargo llvm-cov --all-features --lcov --output-path lcov.info
- name: Upload to Coveralls
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: lcov.info
```
## Advanced Configuration
### Exclude Files from Coverage
```bash
# Exclude generated code
cargo llvm-cov --ignore-filename-regex '.*generated.*'
# Exclude test files
cargo llvm-cov --ignore-filename-regex '.*test.*'
# Multiple patterns
cargo llvm-cov \
--ignore-filename-regex '.*generated.*' \
--ignore-filename-regex '.*mock.*'
```
### Workspace Coverage
```bash
# Coverage for all workspace members
cargo llvm-cov --workspace --html
# Coverage for specific packages
cargo llvm-cov -p my_lib -p my_app --html
# Exclude specific packages
cargo llvm-cov --workspace --exclude integration_tests --html
```
### Coverage with Feature Flags
```bash
# Coverage with all features
cargo llvm-cov --all-features --html
# Coverage with specific features
cargo llvm-cov --features async,tls --html
# Coverage without default features
cargo llvm-cov --no-default-features --html
```
## GitHub Actions: Complete Example
```yaml
# .github/workflows/coverage.yml
name: Coverage
on:
push:
branches: [main]
pull_request:
env:
CARGO_TERM_COLOR: always
COVERAGE_THRESHOLD: 80
jobs:
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- uses: Swatinem/rust-cache@v2
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@v2
with:
tool: cargo-llvm-cov
- name: Install cargo-nextest
uses: taiki-e/install-action@v2
with:
tool: nextest
- name: Generate coverage
run: |
cargo llvm-cov nextest \
--all-features \
--fail-under-lines $COVERAGE_THRESHOLD \
--lcov --output-path lcov.info \
--html
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: lcov.info
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload HTML report
uses: actions/upload-artifact@v4
if: always()
with:
name: coverage-report
path: target/llvm-cov/html/
```
## Clean Coverage Data
```bash
# Clean previous coverage data
cargo llvm-cov clean
# Clean and run fresh coverage
cargo llvm-cov clean && cargo llvm-cov --html
```
## Doctests Coverage
```bash
# Include doctests in coverage
cargo llvm-cov --doc --html
# Doctests with workspace
cargo llvm-cov --workspace --doc --html
# Note: doctests run in separate context, may not integrate perfectly
```
## Comparison with tarpaulin
| Feature | cargo-llvm-cov | cargo-tarpaulin |
|---------|----------------|----Related in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.