Claude Skills
CollectionsCompareWorkflowsNominate
Sign inSign up
© 2026 Curated Agent Skills·Learn more about Agent Skills
Back to repository

coverage-analysis

verified

Code coverage analysis and improvement patterns

View on GitHub

Marketplace

alphaagent-team

the-answerai/alphaagent-team

Plugin

aai-testing

testing

Repository

the-answerai/alphaagent-team

plugins/aai-testing/skills/coverage-analysis/SKILL.md

Last Verified

February 1, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/the-answerai/alphaagent-team/blob/main/plugins/aai-testing/skills/coverage-analysis/SKILL.md -a claude-code --skill coverage-analysis

Installation paths:

Claude
.claude/skills/coverage-analysis/
Powered by add-skill CLI

Instructions

# Coverage Analysis Skill

Patterns for analyzing and improving code coverage.

## Coverage Configuration

### Jest Configuration

```typescript
// jest.config.ts
export default {
  collectCoverage: true,
  collectCoverageFrom: [
    'src/**/*.{ts,tsx}',
    '!src/**/*.d.ts',
    '!src/**/*.test.{ts,tsx}',
    '!src/**/__tests__/**',
    '!src/**/index.ts',
    '!src/types/**'
  ],
  coverageDirectory: 'coverage',
  coverageReporters: ['text', 'lcov', 'html', 'json-summary'],
  coverageThreshold: {
    global: {
      branches: 80,
      functions: 80,
      lines: 80,
      statements: 80
    },
    './src/services/': {
      branches: 90,
      functions: 90,
      lines: 90
    },
    './src/utils/': {
      branches: 85,
      functions: 85,
      lines: 85
    }
  }
}
```

### NYC (Istanbul) Configuration

```javascript
// .nycrc.json
{
  "extends": "@istanbuljs/nyc-config-typescript",
  "all": true,
  "include": ["src/**/*.ts"],
  "exclude": [
    "**/*.test.ts",
    "**/*.spec.ts",
    "**/test/**",
    "**/types/**"
  ],
  "reporter": ["text", "lcov", "html"],
  "check-coverage": true,
  "branches": 80,
  "lines": 80,
  "functions": 80,
  "statements": 80
}
```

## Coverage Types

### Statement Coverage

```typescript
function calculate(a: number, b: number): number {
  const sum = a + b     // Line 1 - covered if function called
  const product = a * b // Line 2 - covered if function called
  return sum + product  // Line 3 - covered if function called
}

// 100% statement coverage with one test
test('calculate', () => {
  expect(calculate(2, 3)).toBe(11)
})
```

### Branch Coverage

```typescript
function getStatus(score: number): string {
  if (score >= 90) {        // Branch 1
    return 'A'
  } else if (score >= 80) { // Branch 2
    return 'B'
  } else if (score >= 70) { // Branch 3
    return 'C'
  } else {                  // Branch 4
    return 'F'
  }
}

// 100% branch coverage requires 4 tests
test('returns A for 90+', () => expect(getStatus(95)).

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
5462 chars