// Copyright (c) 2026 R3BL LLC. Licensed under Apache License, Version 2.0.
Skill: check-test-coverage
Audit and verify test coverage for a specific file or module. Ensure all custom logic branches, state transitions, and boundary conditions are covered while strictly eliminating dependency test bloat (never testing std, third-party crates, or macro-derived boilerplate).
When to Use
- When invoked via the
/check-test-coverage <file_path> command.
- When reviewing a file before creating a commit or finalizing a task.
- When evaluating whether a newly added or modified file has sufficient test coverage.
- When auditing existing test suites to identify missing custom logic tests or remove redundant test bloat.
Core Philosophy: Zero Test Bloat ("Test OUR Code, Not Dependencies")
Traditional "code coverage" tools blindly count lines or instructions executed, encouraging developers to write low-signal tests for boilerplate, compiler derives, and third-party crates.
In this codebase, test quality is measured by branch-targeted verification of OUR custom logic:
- Test OUR Code Exclusively:
- Tests must target the unique execution paths, custom algorithms, match branches, state transitions, conversion traits (
From, TryFrom), and error conditions written by us.
- Never Test Dependencies or Compiler Derives:
- Never write tests that merely assert standard library behavior (
std::collections::HashMap, std::env, std::ffi::OsString).
- Never write unit tests for standard compiler derives (
#[derive(Default, Clone, Copy, PartialEq, Eq, Debug)]).
- Never write unit tests for third-party derive macros (such as
#[derive(Display, EnumString)] with #[strum(serialize_all = "lowercase")] or clap::ValueEnum).
- High Signal, Low Maintenance Overhead:
- Redundant tests slow down
cargo test and check.fish iteration cycles.
- Redundant test failures during refactoring obscure real bugs and create maintenance friction.
5-Step Audit Workflow
When running /check-test-coverage <path>, follow these five steps systematically:
Step 1: Inspect the Target File
Read the entire target file using view_file or AST navigation (rust_analyzer_symbols). Catalog all items:
- Public and private functions (
fn)
- Structs and Enums
- Derived traits vs custom trait implementations (
impl Trait for Type)
- Match expressions,
if let blocks, and conditionals
- Error handling paths (
Result, Option, unwrap_or_else, unreachable!)
Step 2: Classify Code Components (Custom Logic vs Upstream/Derives)
Separate items into two categories:
| Category |
What it includes |
Testing Requirement |
| OUR Custom Logic |
Custom functions, custom parsers/formatters, manual trait impls (From, TryFrom, Display), business logic, state machines, boundary checks, error branches |
Must be covered with targeted test cases (1 test per branch/boundary) |
| Upstream / Derives |
#[derive(Default, Clone, Copy, PartialEq, Eq, Debug)], strum macro attributes, clap derive attributes, standard library forwards |
Do NOT test (testing these is test bloat) |
Step 3: Discover All Test Locations
Locate all test functions covering the file:
- Inline unit tests:
mod tests inside the file itself.
- Adjacent unit test modules: E.g.,
unit_tests.rs or mod.rs test modules in the same directory.
- Integration and conformance tests: E.g.,
tests/, conformance_tests/, or crate-level integration suites.
Step 4: Construct the Branch & Boundary Matrix
Create a structured audit table mapping each piece of custom logic to its test coverage:
| Target Symbol / Branch | Test Function | Classification | Status |
| :--- | :--- | :--- | :--- |
| `InputKind::from((Some, None))` | `test_tuple_to_input_kind_file` | Custom `From` logic | Covered |
| `InputKind::from((None, Some))` | `test_tuple_to_input_kind_command` | Custom `From` logic | Covered |
| `BaseEnv::default()` | — | Compiler `#[derive(Default)]` | Skipped (Dependency / Derive) |
| `OutputFormat` strum display | — | Strum macro derive | Skipped (Dependency / Derive) |
Step 5: Deliver Actionable Verdict & Recommendations
Provide a concise, high-signal report:
- Verdict: Explicitly state whether coverage is Sufficient or Insufficient.
- Branch Coverage Breakdown: Show which custom logic branches are covered vs missing.
- Zero Bloat Verification: Confirm no tests are testing standard library or third-party macros.
- Concrete Test Code: If any custom branches are missing, provide exact, ready-to-use unit test snippets.
Detailed Classification Guide
What MUST Be Tested (Our Custom Logic)
- Manual Trait Implementations:
// MUST TEST: Custom conversion logic with 2 branches
impl From<(&Option<PathBuf>, &Option<String>)> for InputKind {
fn from(tuple: (&Option<PathBuf>, &Option<String>)) -> InputKind {
match tuple {
(Some(file), None) => InputKind::File(file.clone()),
(None, Some(cmd)) => InputKind::InlineCommand(cmd.clone()),
_ => unreachable!(),
}
}
}
- Custom Parsing & Formatting Logic:
- Regex parsing, state machines, ANSI code builders, diff calculators.
- Boundary & Overflow Checks:
- Off-by-one boundary cases, index-overflow conditions (see
check-bounds-safety skill).
- Error & Fallback Branches:
Err returns, fallback defaults when inputs are malformed.
What MUST NOT Be Tested (Test Bloat)
- Standard Derives:
// DO NOT TEST: Testing BaseEnv::default() tests the Rust compiler derive macro.
#[derive(Debug, Clone, Default, PartialEq, Eq)]
pub enum BaseEnv {
#[default]
Inherit,
Explicit(EnvMap),
}
- Third-Party Macro Derives:
// DO NOT TEST: Testing .to_string() tests strum's macro generator.
#[derive(Debug, Clone, Copy, PartialEq, Eq, clap::ValueEnum, Display, EnumString)]
#[strum(serialize_all = "lowercase")]
pub enum OutputFormat {
Fish,
Powershell,
Json,
Dotenv,
}
- Standard Library Collections / Types:
- Do NOT test whether
HashMap::insert stores a value or whether PathBuf::from works.
Related Skills
organize-tests: Test directory taxonomy, isolation patterns, and zero test-bloat directive.
check-bounds-safety: Type-safe index and length bounds verification.
check-code-quality: Full quality verification suite (./check.fish --full).
1---2name: check-test-coverage3description: Audit and verify test coverage for a specific file or module, ensuring all custom logic branches, state transitions, and boundary conditions are covered while strictly eliminating dependency test bloat (never testing std, third-party crates, or macro-derived boilerplate). Use via /check-test-coverage <filename>.4---56// Copyright (c) 2026 R3BL LLC. Licensed under Apache License, Version 2.0.78# Skill: check-test-coverage910Audit and verify test coverage for a specific file or module. Ensure all custom logic branches, state transitions, and boundary conditions are covered while strictly eliminating dependency test bloat (never testing `std`, third-party crates, or macro-derived boilerplate).1112## When to Use1314- When invoked via the `/check-test-coverage <file_path>` command.15- When reviewing a file before creating a commit or finalizing a task.16- When evaluating whether a newly added or modified file has sufficient test coverage.17- When auditing existing test suites to identify missing custom logic tests or remove redundant test bloat.1819## Core Philosophy: Zero Test Bloat ("Test OUR Code, Not Dependencies")2021Traditional "code coverage" tools blindly count lines or instructions executed, encouraging developers to write low-signal tests for boilerplate, compiler derives, and third-party crates.2223In this codebase, **test quality is measured by branch-targeted verification of OUR custom logic**:24251. **Test OUR Code Exclusively**:26 - Tests must target the unique execution paths, custom algorithms, match branches, state transitions, conversion traits (`From`, `TryFrom`), and error conditions written by us.272. **Never Test Dependencies or Compiler Derives**:28 - Never write tests that merely assert standard library behavior (`std::collections::HashMap`, `std::env`, `std::ffi::OsString`).29 - Never write unit tests for standard compiler derives (`#[derive(Default, Clone, Copy, PartialEq, Eq, Debug)]`).30 - Never write unit tests for third-party derive macros (such as `#[derive(Display, EnumString)]` with `#[strum(serialize_all = "lowercase")]` or `clap::ValueEnum`).313. **High Signal, Low Maintenance Overhead**:32 - Redundant tests slow down `cargo test` and `check.fish` iteration cycles.33 - Redundant test failures during refactoring obscure real bugs and create maintenance friction.3435---3637## 5-Step Audit Workflow3839When running `/check-test-coverage <path>`, follow these five steps systematically:4041### Step 1: Inspect the Target File4243Read the entire target file using `view_file` or AST navigation (`rust_analyzer_symbols`). Catalog all items:44- Public and private functions (`fn`)45- Structs and Enums46- Derived traits vs custom trait implementations (`impl Trait for Type`)47- Match expressions, `if let` blocks, and conditionals48- Error handling paths (`Result`, `Option`, `unwrap_or_else`, `unreachable!`)4950### Step 2: Classify Code Components (Custom Logic vs Upstream/Derives)5152Separate items into two categories:5354| Category | What it includes | Testing Requirement |55| :--- | :--- | :--- |56| **OUR Custom Logic** | Custom functions, custom parsers/formatters, manual trait impls (`From`, `TryFrom`, `Display`), business logic, state machines, boundary checks, error branches | **Must be covered** with targeted test cases (1 test per branch/boundary) |57| **Upstream / Derives** | `#[derive(Default, Clone, Copy, PartialEq, Eq, Debug)]`, strum macro attributes, clap derive attributes, standard library forwards | **Do NOT test** (testing these is test bloat) |5859### Step 3: Discover All Test Locations6061Locate all test functions covering the file:621. **Inline unit tests**: `mod tests` inside the file itself.632. **Adjacent unit test modules**: E.g., `unit_tests.rs` or `mod.rs` test modules in the same directory.643. **Integration and conformance tests**: E.g., `tests/`, `conformance_tests/`, or crate-level integration suites.6566### Step 4: Construct the Branch & Boundary Matrix6768Create a structured audit table mapping each piece of custom logic to its test coverage:6970```markdown71| Target Symbol / Branch | Test Function | Classification | Status |72| :--- | :--- | :--- | :--- |73| `InputKind::from((Some, None))` | `test_tuple_to_input_kind_file` | Custom `From` logic | Covered |74| `InputKind::from((None, Some))` | `test_tuple_to_input_kind_command` | Custom `From` logic | Covered |75| `BaseEnv::default()` | — | Compiler `#[derive(Default)]` | Skipped (Dependency / Derive) |76| `OutputFormat` strum display | — | Strum macro derive | Skipped (Dependency / Derive) |77```7879### Step 5: Deliver Actionable Verdict & Recommendations8081Provide a concise, high-signal report:821. **Verdict**: Explicitly state whether coverage is **Sufficient** or **Insufficient**.832. **Branch Coverage Breakdown**: Show which custom logic branches are covered vs missing.843. **Zero Bloat Verification**: Confirm no tests are testing standard library or third-party macros.854. **Concrete Test Code**: If any custom branches are missing, provide exact, ready-to-use unit test snippets.8687---8889## Detailed Classification Guide9091### What MUST Be Tested (Our Custom Logic)9293- **Manual Trait Implementations**:94 ```rust95 // MUST TEST: Custom conversion logic with 2 branches96 impl From<(&Option<PathBuf>, &Option<String>)> for InputKind {97 fn from(tuple: (&Option<PathBuf>, &Option<String>)) -> InputKind {98 match tuple {99 (Some(file), None) => InputKind::File(file.clone()),100 (None, Some(cmd)) => InputKind::InlineCommand(cmd.clone()),101 _ => unreachable!(),102 }103 }104 }105 ```106- **Custom Parsing & Formatting Logic**:107 - Regex parsing, state machines, ANSI code builders, diff calculators.108- **Boundary & Overflow Checks**:109 - Off-by-one boundary cases, index-overflow conditions (see `check-bounds-safety` skill).110- **Error & Fallback Branches**:111 - `Err` returns, fallback defaults when inputs are malformed.112113### What MUST NOT Be Tested (Test Bloat)114115- **Standard Derives**:116 ```rust117 // DO NOT TEST: Testing BaseEnv::default() tests the Rust compiler derive macro.118 #[derive(Debug, Clone, Default, PartialEq, Eq)]119 pub enum BaseEnv {120 #[default]121 Inherit,122 Explicit(EnvMap),123 }124 ```125- **Third-Party Macro Derives**:126 ```rust127 // DO NOT TEST: Testing .to_string() tests strum's macro generator.128 #[derive(Debug, Clone, Copy, PartialEq, Eq, clap::ValueEnum, Display, EnumString)]129 #[strum(serialize_all = "lowercase")]130 pub enum OutputFormat {131 Fish,132 Powershell,133 Json,134 Dotenv,135 }136 ```137- **Standard Library Collections / Types**:138 - Do NOT test whether `HashMap::insert` stores a value or whether `PathBuf::from` works.139140---141142## Related Skills143144- `organize-tests`: Test directory taxonomy, isolation patterns, and zero test-bloat directive.145- `check-bounds-safety`: Type-safe index and length bounds verification.146- `check-code-quality`: Full quality verification suite (`./check.fish --full`).