Command Palette

Search for a command to run...

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

test-coverage

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

On-demand test coverage analysis. Use when identifying untested code, finding test gaps, measuring coverage metrics, or improving test quality. Trigger…

MadAppGangот MadAppGang★ 290 звёзд на GitHub

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

Test Coverage Skill

Overview

The test-coverage skill provides comprehensive on-demand test coverage analysis for your codebase. It identifies untested code paths, measures coverage metrics, finds test gaps, evaluates test quality, and provides actionable recommendations for improving test coverage across all supported technology stacks.

When to Use:

  • Measuring current test coverage
  • Identifying untested critical code paths
  • Finding gaps before deployment
  • Improving test suite quality
  • Compliance requirements (80% coverage)
  • Refactoring with confidence
  • Onboarding new team members

Technology Coverage:

  • React/TypeScript/JavaScript (Jest, Vitest, React Testing Library)
  • Go (go test with coverage)
  • Rust (cargo test with tarpaulin)
  • Python (pytest with coverage.py)
  • Full-stack applications

Coverage Metrics

1. Line Coverage

Definition: Percentage of executable lines that are executed by tests.

Example:

function divide(a: number, b: number): number {
  if (b === 0) {              // Line 1: COVERED
    throw new Error('Div 0'); // Line 2: NOT COVERED
  }
  return a / b;               // Line 3: COVERED
}

// Test only covers normal case
test('divides numbers', () => {
  expect(divide(10, 2)).toBe(5);
});

// Line Coverage: 66% (2/3 lines)

Interpretation:

  • 100%: All lines executed (ideal for critical code)
  • 80-99%: Good coverage, some edge cases missed
  • 60-79%: Moderate, needs improvement
  • <60%: Poor, significant gaps

2. Branch Coverage

Definition: Percentage of decision branches (if/else, switch, ternary) that are tested.

Example:

function getUserStatus(user: User): string {
  if (user.isActive) {     // Branch 1: true (COVERED)
    if (user.isPremium) {  // Branch 2: true (NOT COVERED)
      return 'premium';    // NOT COVERED
    }
    return 'active';       // COVERED
  }
  return 'inactive';       // Branch 1: false (NOT COVERED)
}

// Test only covers active non-premium
test('returns status', () => {
  expect(getUserStatus({ isActive: true, isPremium: false })).toBe('active');
});

// Branch Coverage: 33% (1/3 branches)
// Line Coverage: 60% (3/5 lines)

Why Important: Higher than line coverage, catches edge cases.

3. Function Coverage

Definition: Percentage of functions that are called at least once in tests.

Example:

// auth.ts
export function login(user: string, pass: string) { ... }    // COVERED
export function logout() { ... }                             // COVERED
export function resetPassword(email: string) { ... }         // NOT COVERED
export function changePassword(old: string, new: string) { ... } // NOT COVERED

// Function Coverage: 50% (2/4 functions)

Red Flag: Exported functions with 0% coverage.

4. Statement Coverage

Definition: Percentage of statements executed (similar to line coverage but more granular).

Difference from Line Coverage:

// Single line, multiple statements
const x = 1, y = 2, z = 3;

// Line coverage: 1 line
// Statement coverage: 3 statements

Use Case: More precise for minified or compact code.

Gap Analysis

Identifying Untested Code

Priority Levels:

CRITICAL (Must Test):

  • Authentication and authorization logic
  • Payment processing
  • Data validation
  • Security checks
  • Error handling
  • Database transactions

HIGH (Should Test):

  • Business logic
  • API endpoints
  • Data transformations
  • State management
  • Integration points

MEDIUM (Nice to Test):

  • Utility functions
  • Formatters
  • Constants
  • Simple getters/setters

LOW (Optional):

  • Type definitions
  • Configuration files
  • Mock data

Gap Report Format

# Test Coverage Gap Analysis

**Generated**: 2026-01-28 14:32:00
**Coverage**: 68% (Target: 80%)
**Files Analyzed**: 247
**Critical Gaps**: 12 files

## Executive Summary

**Overall Coverage**:
- Line Coverage: 68% (Target: 80%) - 12% below
- Branch Coverage: 54% (Target: 75%) - 21% below
- Function Coverage: 71% (Target: 85%) - 14% below

**Risk Assessment**: MEDIUM-HIGH
- 12 critical files under 50% coverage
- 23 high-priority functions untested
- 47 error handling branches untested

## Critical Gaps (Priority 1)

### [GAP-001] Authentication Module
**File**: src/auth/AuthService.ts
**Line Coverage**: 34% (Target: 95%+)
**Branch Coverage**: 22%
**Risk**: CRITICAL

**Untested Code Paths**:
```typescript
// CRITICAL: No tests for password reset flow
async resetPassword(email: string): Promise<void> {
  const user = await this.userRepo.findByEmail(email);
  if (!user) {
    throw new NotFoundError('User not found'); // UNTESTED
  }
  const token = generateResetToken();           // UNTESTED
  await this.emailService.sendResetEmail(       // UNTESTED
    user.email,
    token
  );
}

// CRITICAL: No tests for token expiry
validateResetToken(token: string): boolean {
  const decoded = jwt.verify(token, SECRET);
  if (Date.now() > decoded.exp) {
Полный SKILL.md на GitHub

Установить test-coverage в Claude Code и Claude Desktop

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

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

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

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

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

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

FAQ

Что делает скилл test-coverage?

On-demand test coverage analysis. Use when identifying untested code, finding test gaps, measuring coverage metrics, or improving test quality. Trigger keywords - "test coverage", "coverage report", "untested code", "test gaps", "missing tests", "coverage metrics".

Как установить скилл test-coverage?

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

Скилл test-coverage запускает скрипты?

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

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

Сравнить test-coverage с