Skip to content
Skills Library
Programming · Testing

test-coverage-improver

/test-coverage-improver

Analyze test coverage gaps and generate tests to improve coverage. Use when improving test coverage, finding untested code, or writing missing tests.

Licence
MIT
Last repository change
19.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 19.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Analyze test coverage gaps and generate tests to improve coverage. Use when improving test coverage, finding untested code, or writing missing tests.

Original author description

Analyze test coverage gaps and generate tests to improve coverage. Use when improving test coverage, finding untested code, or writing missing tests.

How it works

  1. Instructions
  2. Generate Coverage Report
  3. Coverage Targets
  4. Test Templates
  5. Branch Coverage Checklist
  6. Coverage Configuration
  7. Priority Order for Testing
Original SKILL.md headings · 204 lines, 571 words
SKILL.md preview
---
name: test-coverage-improver
description: Analyze test coverage gaps and generate tests to improve coverage. Use when improving test coverage, finding untested code, or writing missing tests.
---

# Test Coverage Improver

## Instructions

When improving test coverage:

1. **Run coverage report** to identify gaps
2. **Prioritize** critical/complex code paths
3. **Write tests** for uncovered code
4. **Verify coverage improved**

## Generate Coverage Report

```bash
# Jest
npx jest --coverage

# Vitest
npx vitest --coverage

# NYC (Istanbul) for any test runner
npx nyc npm test

# View HTML report
open coverage/lcov-report/index.html
```

## Coverage Targets

| Type | Minimum | Good | Excellent |
|------|---------|------|-----------|
| Lines | 70% | 80% | 90%+ |
| Branches | 60% | 75% | 85%+ |
| Functions | 70% | 80% | 90%+ |
| Statements | 70% | 80% | 90%+ |

## Test Templates

### Unit Test (Jest/Vitest)

```typescript
import { describe, it, expect, vi, beforeEach } from 'vitest';
import { calculateTotal, formatCurrency } from './utils';

describe('calculateTotal', () => {
  it('should sum all item prices', () => {
    const items = [
      { price: 10, quantity: 2 },
      { price: 5, quantity: 1 },
    ];
    expect(calculateTotal(items)).toBe(25);
  });

  it('should return 0 for empty array', () => {
    expect(calculateTotal([])).toBe(0);
  });

  it('should handle decimal prices', () => {
    const items = [{ price: 10.99, quantity: 1 }];
    expect(calculateTotal(items)).toBeCloseTo(10.99);
  });
});
```

### Testing Async Functions

```typescript
describe('fetchUser', () => {
  it('should return user data', async () => {
    const user = await fetchUser(1);
    expect(user).toEqual({
      id: 1,
      name: expect.any(String),
      email: expect.stringContaining('@'),
    });
  });

  it('should throw for non-existent user', async () => {
    await expect(fetchUser(999)).rejects.toThrow('User not found');
  });
});
```

### Mocking Dependencies

```typescript
import { vi } from 'vitest';
import { sendEmail } from './email';
import { createUser } from './user';

vi.mock('./email', () => ({
  sendEmail: vi.fn().mockResolvedValue({ success: true }),
}));

describe('createUser', () => {
  beforeEach(() => {
    vi.clearAllMocks();
  });

  it('should send welcome email after creating user', async () => {
    await createUser({ name: 'John', email: 'john@test.com' });

    expect(sendEmail).toHaveBeenCalledWith({
      to: 'john@test.com',
      template: 'welcome',
    });
  });
});
```

### React Component Testing

```tsx
import { render, screen, fireEvent } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { Button } from './Button';

describe('Button', () => {
  it('should render children', () => {
    render(<Button>Click me</Button>);
    expect(screen.getByText('Click me')).toBeInTheDocument();
  });

  it('should call onClick when clicked', async () => {
    const handleClick = vi.fn();
    render(<Button onClick={handleClick}>Click</Button>);

    await userEvent.click(screen.getByRole('button'));
    expect(handleClick).toHaveBeenCalledTimes(1);
  });

  it('should be disabled when loading', () => {
    render(<Button isLoading>Submit</Button>);
    expect(screen.getByRole('button')).toBeDisabled();
  });
});
```

### API Route Testing

```typescript
import { createMocks } from 'node-mocks-http';
import handler from './api/users';

describe('GET /api/users', () => {
  it('should return users list', async () => {
    const { req, res } = createMocks({ method: 'GET' });

    await handler(req, res);

    expect(res._getStatusCode()).toBe(200);
    expect(JSON.parse(res._getData())).toHaveProperty('users');
  });
});
```

## Branch Coverage Checklist

Ensure tests cover:

- [ ] If/else branches
- [ ] Ternary operators
- [ ] Switch cases (including default)
- [ ] Try/catch blocks
- [ ] Early returns
- [ ] Nullish coalescing (`??`)
- [ ] Optional chaining results (`?.`)
- [ ] Loop conditions (0, 1, many iterations)

## Coverage Configuration

```javascript
// vitest.config.ts
export default {
  test: {
    coverage: {
      provider: 'v8',
      reporter: ['text', 'html', 'lcov'],
      exclude: [
        'node_modules/',
        '**/*.d.ts',
        '**/*.test.ts',
        '**/types/',
      ],
      thresholds: {
        lines: 80,
        branches: 75,
        functions: 80,
        statements: 80,
      },
    },
  },
};
```

## Priority Order for Testing

1. **Critical paths**: Auth, payments, data mutations
2. **Complex logic**: Algorithms, state machines, calculations
3. **Error handlers**: Catch blocks, error boundaries
4. **Edge cases**: Empty arrays, null values, boundaries
5. **Integration points**: API calls, database queries

Versions

RepositoryScoreLicence
This page · OneWave-AI/claude-skills100MIT
openai/openai-agents-python90MIT
openai/openai-agents-js90MIT

Identical content appears in 1 other GitHub folders. We show one copy with the highest score.

Database snapshot: 13.11.2026 · package version 4b929a077e83 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 84analyze-test-coverage
    Analyze test coverage gaps and prioritize what to test next. Use this skill whenever the user says "analyze test coverage", "what's our test coverage", "find gaps in test coverage", "which code isn't tested", "improve test coverage", "show me a coverage report", "coverage…
  • 100coverage
    Analyze test coverage gaps. Use when user says "test coverage", "what's not tested", "coverage gaps", "missing tests", "coverage report", or "what needs testing".
  • 100test-coverage-guardian
    Analyze test coverage, identify gaps, detect dead code, and improve test quality. Use when user asks to check coverage, review tests, find untested code, or improve test robustness.
  • 90Coverage Guard
    Use when the user wants to check test coverage, enforce 100% coverage, find uncovered code, add missing tests, or increase code coverage. Works with vitest, jest, react-scripts, and other test runners. Also for 'coverage', 'test coverage', 'cover', 'untested', 'uncovered', 'add…
  • 90test-coverage-analyzer
    Automated test coverage analysis with support for multiple testing frameworks, coverage reporting, gap identification, metric tracking, and quality gate enforcement. Use when Claude needs to analyze test coverage, identify untested code, generate coverage reports, or enforce…
  • 100analyzing-test-coverage
    Analyze code coverage metrics and identify untested code paths. Use when analyzing untested code or coverage gaps. Trigger with phrases like "analyze coverage", "check test coverage", or "find untested code".

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.