Agent SkillsJamieMason/syncpack › testing-gaps

testing-gaps

GitHub

分析指定源文件的测试覆盖率,识别未覆盖的代码分支及缺失的真实场景。通过运行文本格式覆盖率报告,定位零执行次数的行,结合测试文件交叉验证,分类处理未覆盖路径并报告遗漏的组合测试用例。

.claude/skills/testing-gaps/SKILL.md JamieMason/syncpack

Trigger Scenarios

需要分析代码测试覆盖率 寻找未被测试的分支逻辑 发现潜在的死代码或防御性分支

Install

npx skills add JamieMason/syncpack --skill testing-gaps -g -y
More Options

Non-standard path

npx skills add https://github.com/JamieMason/syncpack/tree/main/.claude/skills/testing-gaps -g -y

Use without installing

npx skills use JamieMason/syncpack@testing-gaps

指定 Agent (Claude Code)

npx skills add JamieMason/syncpack --skill testing-gaps -a claude-code -g -y

安装 repo 全部 skill

npx skills add JamieMason/syncpack --all -g -y

预览 repo 内 skill

npx skills add JamieMason/syncpack --list

SKILL.md

Frontmatter
{
    "name": "testing-gaps",
    "description": "Run coverage, inspect results, and identify missing test scenarios for a given source file. Use when analysing test coverage or finding untested branches."
}

Testing Gaps

Find untested branches and missing real-world test scenarios for a source file.

Workflow

  1. Run text coverage for the target file
  2. Identify uncovered branches from the output
  3. Cross-reference with test file to understand what's tested
  4. Report uncovered branches + missing real-world scenarios

Step 1: Run Coverage

Use cargo llvm-cov with --text output (not --html) for parseable results.

# Full coverage, filtered to target file
cargo llvm-cov test --text \
  --ignore-run-fail \
  --ignore-filename-regex '(_test.rs|\/test\/)' \
  2>/dev/null | sed -n '/TARGET_FILE\.rs:/,/^$/p'

Example for preferred_semver.rs:

cargo llvm-cov test --text \
  --ignore-run-fail \
  --ignore-filename-regex '(_test.rs|\/test\/)' \
  2>/dev/null | sed -n '/preferred_semver\.rs:/,/^$/p'

Step 2: Read Coverage Output

The text format shows per-line execution counts:

  42|     80|        .and_then(|range| ...)     # Hit 80 times
  74|      0|        Some(preferred)            # Never hit
 321|      0|        instance.mark_conflict(...) # Never hit
  • count > 0 = covered
  • count = 0 = uncovered branch
  • ^N annotations on sub-expressions show partial coverage within a line

Extract only uncovered lines

... | grep -E '^\s+\d+\|\s+0\|'

Step 3: Classify Gaps

For each uncovered branch, determine:

  1. What code path leads here? — Trace the if/else chain backward
  2. What input would trigger it? — What package.json + config combination
  3. Is it reachable? — Some branches may be defensive/unreachable
  4. Is it worth testing? — Real-world scenario vs theoretical edge case

Categories

Category Action
Real-world scenario never tested Write a test
Edge case in existing logic Write a test
Defensive branch (unreachable) Note but skip
Dead code Consider removing

Step 4: Identify Missing Scenarios

Beyond line coverage, look for missing combinations:

  • Feature A tested, Feature B tested, A+B never tested together
  • Only tested with one package, never with multiple
  • Only tested with highestSemver, never lowestSemver
  • Only tested with one range type (^), never others (>=, <=)
  • Only tested without semver groups, never with

Step 5: Report

Structure findings as:

  1. Uncovered branches — Specific lines, what triggers them, why untested
  2. Missing real-world scenarios — Combinations and interactions not covered

Running Tests After Adding Coverage

just test                              # All tests
cargo test test_name -- --nocapture   # Specific test
just coverage                         # Regenerate coverage report

Version History

  • 15.3.2 Current 2026-07-06 19:59

Same Skill Collection

.claude/skills/add-feature/SKILL.md
.claude/skills/document-code/SKILL.md
.claude/skills/fix-bug/SKILL.md
.claude/skills/front-loading/SKILL.md
.claude/skills/optimize-benchmarks/SKILL.md
.claude/skills/review-docs/SKILL.md
.claude/skills/search-code/SKILL.md
.claude/skills/signal-over-noise/SKILL.md
.claude/skills/write-code/SKILL.md
.claude/skills/write-tests/SKILL.md

Metadata

Files
0
Version
15.3.2
Hash
139817a9
Indexed
2026-07-06 19:59

Главная - Вики-сайт
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-07 00:12
浙ICP备14020137号-1 $Гость$