Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

Test Coverage Gap Finder

БесплатноБез исполняемых скриптовНе проверен

Identify untested code paths, uncovered branches, and missing test scenarios using coverage analysis, risk mapping, and change-based coverage tracking

PramodDuttaот PramodDutta★ 253 звезды на GitHub

Об этом скилле

Test Coverage Gap Finder

Test coverage analysis identifies which parts of the codebase are exercised by the test suite and, more importantly, which parts are not. Raw coverage percentages are misleading without context: 80% statement coverage might mean the most critical error-handling paths are completely untested while trivial getters are thoroughly covered. This skill guides AI coding agents through comprehensive coverage gap analysis that goes beyond percentages to identify high-risk untested code, enforce coverage on new changes, and generate actionable test recommendations.

Core Principles

  1. Coverage Is a Diagnostic Tool, Not a Goal: High coverage does not guarantee test quality. A test that executes every line without meaningful assertions provides coverage with zero defect detection capability. Use coverage to find what is missing, not as proof of quality.

  2. Branch Coverage Over Statement Coverage: Statement coverage counts whether a line executed; branch coverage counts whether both true and false paths of every conditional executed. A function with an early return can have 100% statement coverage but 50% branch coverage if only one path is tested.

  3. Risk-Weighted Coverage: Not all code carries equal risk. Payment processing, authentication, and data validation deserve 100% coverage. Configuration constants and simple data transfer objects do not. Prioritize coverage gaps by business risk.

  4. Change-Based Coverage Is Non-Negotiable: Tracking coverage of new and modified code ensures that every change ships with tests. Legacy code coverage gaps are inherited, but new gaps are preventable.

  5. Dead Code Is Not a Coverage Gap: Code that is never reached in production is not an untested path needing tests; it is dead code needing removal. Distinguish between untested live code and genuinely unreachable code before writing tests.

  6. Coverage Trends Matter More Than Snapshots: A codebase at 70% coverage and improving is healthier than one at 85% and declining. Track coverage over time to detect erosion before it becomes a problem.

  7. Exclude What Does Not Belong: Generated code, vendor libraries, type definitions, and configuration files inflate or deflate coverage numbers without providing signal. Exclude them to keep coverage metrics meaningful.

Project Structure

project-root/
├── src/
│   ├── controllers/
│   │   ├── user.controller.ts
│   │   └── order.controller.ts
│   ├── services/
│   │   ├── payment.service.ts
│   │   └── notification.service.ts
│   ├── utils/
│   │   ├── validators.ts
│   │   └── formatters.ts
│   └── types/
│       └── index.ts
├── tests/
│   ├── unit/
│   │   ├── payment.test.ts
│   │   └── validators.test.ts
│   └── integration/
│       └── order-flow.test.ts
├── coverage/
│   ├── lcov.info
│   ├── coverage-summary.json
│   └── html/
│       └── index.html
├── scripts/
│   ├── coverage-gap-analysis.ts
│   ├── change-coverage.ts
│   ├── risk-coverage-map.ts
│   └── coverage-trend.ts
├── .nycrc.json
├── jest.config.ts
├── vitest.config.ts
└── coverage.config.ts

Istanbul/V8 Coverage Analysis

Configuring Jest Coverage

// jest.config.ts
import type { Config } from 'jest';

const config: Config = {
  preset: 'ts-jest',
  testEnvironment: 'node',
  collectCoverage: true,
  coverageProvider: 'v8', // V8 is faster and more accurate than Istanbul for Node.js

  // Coverage collection targets
  collectCoverageFrom: [
    'src/**/*.{ts,tsx}',
    '!src/**/*.d.ts',           // Exclude type definitions
    '!src/**/index.ts',          // Exclude barrel files
    '!src/types/**',             // Exclude type-only files
    '!src/**/*.stories.{ts,tsx}', // Exclude Storybook stories
    '!src/**/mocks/**',          // Exclude test mocks
    '!src/generated/**',         // Exclude generated code
  ],

  // Coverage output formats
  coverageReporters: [
    'text',           // Console summary
    'text-summary',   // Brief console summary
    'lcov',           // For CI tools (SonarQube, Codecov)
    'json-summary',   // Machine-readable summary
    'json',           // Detailed per-file data
    'html',           // Interactive HTML report
    'clover',         // Clover XML format
  ],

  // Coverage thresholds
  coverageThreshold: {
    global: {
      branches: 80,
      functions: 85,
      lines: 85,
      statements: 85,
    },
    // Per-directory thresholds for critical paths
    './src/services/payment*.ts': {
      branches: 95,
      functions: 100,
      lines: 95,
      statements: 95,
    },
    './src/utils/validators.ts': {
      branches: 100,
      functions: 100,
      lines: 100,
      statements: 100,
    },
  },

  coverageDirectory: 'coverage',
};

export default config;

Configuring Vitest Coverage

// vitest.config.ts
import { defineConfig } from 'vitest/config';

export default defineConfig({
  test: {
    coverage: {
      provider: 'v8',
      enabled: true,
Полный SKILL.md на GitHub

Установить Test Coverage Gap Finder в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл Test Coverage Gap Finder?

Identify untested code paths, uncovered branches, and missing test scenarios using coverage analysis, risk mapping, and change-based coverage tracking

Как установить скилл Test Coverage Gap Finder?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл Test Coverage Gap Finder запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить Test Coverage Gap Finder с