redpanda-data/redpanda · Archived

improve-coverage

Improve code coverage for a Bazel C++ test target or source file

First seen Jun 21, 2026

Installation

$ npx skills add redpanda-data/redpanda --skill improve-coverage

Stronger alternatives

This repository is archived — consider an actively maintained alternative.

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from redpanda-data/redpanda.

npx skills add redpanda-data/redpanda

Browse all from redpanda-data/redpanda

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Repository health

Stars 12.4K
License licenses
Default branch dev
Open issues 178
Status Archived

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 3,102 B
  • docs SUMMARY.md 88 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 2 installs

SKILL.md

Improve Code Coverage

Improve test coverage for a Bazel C++ test target or source file path.

Input Resolution

  1. Bazel test target (starts with //, e.g. //src/v/bytes/tests:iobuf_test):

use it directly.

  1. Source file path (e.g. src/v/bytes/iobuf.cc): find the test target:

``bash bazel query "kind('.*_test', rdeps(//src/v/..., //$(dirname $FILE):$(basename $FILE .cc), 1))" 2>/dev/null ` If multiple targets match, pick the one in the closest tests/` directory. If none match, tell the user and stop.

Workflow

Step 1: Baseline Coverage

Run coverage and read the LLM report:

tools/run-cov <target> -r llm

Note the total line coverage percentage — this is the baseline to beat.

Read the report and identify:

  • Uncovered functions — highest impact. One test can cover many lines.
  • Partially covered functions — uncovered branches indicate missing

error-path or edge-case tests.

  • Zero-coverage files in scope — may need new test cases entirely.

Step 2: Understand the Code

Read the source files named in the report. Focus on:

  • Uncovered functions: what they do, inputs, preconditions.
  • The existing test file: patterns, fixtures, helpers.

Key codebase patterns:

  • redpandaccgtest targets use GTest (TEST(), TEST_F()).

redpandaccbtest targets use Seastar Boost test (SEASTARTHREADTEST_CASE). Match whichever the test file uses.

  • Many functions are ss::future<> coroutines — test with

SEASTARTHREADTEST_CASE or the Seastar GTest runner.

  • Use ss namespace prefix for Seastar types.
  • Use EXPECT for most checks, ASSERT only when continuing would crash.

Step 3: Write Tests

Prioritize by impact:

  1. Uncovered functions — call each one. A 20-line function = 20 lines covered.
  2. Uncovered error paths — trigger the uncovered branches in partially

covered functions.

  1. Zero-coverage files — add smoke tests if practical.

Rules:

  • Add tests to the existing test file. Don't create new files or BUILD

targets unless necessary.

  • Follow existing naming conventions in the file.
  • One logical behavior per test case.
  • Prefer deterministic tests — construct error conditions directly.
  • Do NOT add comments that restate the code.

Step 4: Verify Build

bazel build <target>

Fix compilation errors before proceeding.

Step 5: Verify Coverage

Re-run coverage:

tools/run-cov <target> -r llm

Compare to the baseline. Report:

Coverage: X.Y% → A.B% (+N.N%)
New lines covered: <count>

If coverage did not improve, investigate:

  • Build errors preventing the new tests from running?
  • Code compiled out by preprocessor guards?
  • Template instantiations not triggered by test types?

Step 6: Summary

Report:

  • Which functions/paths are now covered
  • What test cases were added
  • Before/after coverage numbers
  • Remaining significant gaps and suggestions