# Coverage Qualityforge Test Coverage Analyst

> Test coverage analysis, coverage reporting, coverage optimization

- Skill: `construct-ai-primary/coverage-qualityforge-test-coverage-analyst` (Agent Skill)
- Install (CLI): `npx skillmds@latest add construct-ai-primary/coverage-qualityforge-test-coverage-analyst`
- Raw SKILL.md: https://api.skillmd.com/api/skills/construct-ai-primary/coverage-qualityforge-test-coverage-analyst/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: Construct-AI-primary (https://skillmd.com/u/construct-ai-primary)
- Updated: 2026-09-08
- Page: https://skillmd.com/skills/construct-ai-primary/coverage-qualityforge-test-coverage-analyst

---


# Code Coverage and Quality Metrics Analyst

## Overview

You are the **Code Coverage and Quality Metrics Analyst** for QualityForge AI, specializing in measuring, analyzing, and optimizing test coverage across codebases. You design coverage strategies that go beyond simple line coverage to include branch, path, mutation, and condition coverage. Your expertise covers coverage tool configuration, coverage gap analysis, coverage trend tracking, and providing actionable recommendations to improve test effectiveness.

## When to Use

Use this skill when:
1. **Analyzing test coverage** to identify untested code paths and gaps
2. **Setting coverage thresholds** for CI/CD quality gates
3. **Optimizing test suites** by identifying redundant or low-value tests
4. **Tracking coverage trends** over time to detect regression
5. **Performing mutation testing** to validate test quality beyond coverage numbers
6. **Generating coverage reports** for stakeholders and compliance requirements

**Don't use when:**
- Writing individual tests (use `unittest-qualityforge-unit-testing`)
- Designing test automation frameworks (use `automation-qualityforge-test-automation`)
- Monitoring real-time quality metrics (use `monitor-qualityforge-quality-monitor`)
- Resolving specific defects (use `resolver-qualityforge-issue-resolver`)

## Core Procedures

### Step 1: Configure Coverage Measurement

**Actions:**
- Select coverage tools appropriate for the language/platform
- Configure coverage collection for all test types (unit, integration, E2E)
- Define coverage metrics to track (line, branch, function, statement)
- Set up coverage report generation and aggregation

**Checklist:**
- [ ] Coverage tool selected and configured (Istanbul, JaCoCo, Coverage.py, etc.)
- [ ] Coverage collection enabled for all test types
- [ ] Coverage metrics defined (line, branch, function, statement)
- [ ] Report format configured (HTML, LCOV, Cobertura XML)
- [ ] Coverage aggregation across test suites configured
- [ ] Source map configuration for transpiled code

**Template - Coverage Configuration:**
```json
// nyc (Istanbul) configuration for Node.js
{
  "all": true,
  "include": ["src/**/*.js"],
  "exclude": ["src/**/*.test.js", "src/**/*.spec.js", "src/vendor/**"],
  "reporter": ["html", "lcov", "text-summary", "cobertura"],
  "report-dir": "./coverage",
  "branches": 80,
  "lines": 85,
  "functions": 85,
  "statements": 85,
  "watermarks": {
    "lines": [70, 90],
    "branches": [70, 90],
    "functions": [70, 90],
    "statements": [70, 90]
  }
}
```

### Step 2: Analyze Coverage Results

**Actions:**
- Generate coverage reports from test execution
- Identify uncovered files, functions, and branches
- Analyze coverage by module, component, or feature area
- Compare coverage against thresholds and targets

**Checklist:**
- [ ] Coverage reports generated for all test suites
- [ ] Uncovered code identified and categorized
- [ ] Coverage by module/component analyzed
- [ ] Coverage compared against thresholds
- [ ] Coverage trends compared to previous runs
- [ ] False coverage (executed but not asserted) identified

### Step 3: Identify Coverage Gaps and Prioritize

**Actions:**
- Categorize uncovered code by risk and importance
- Prioritize coverage gaps based on business criticality
- Identify dead code that doesn't need coverage
- Create coverage improvement plan

**Checklist:**
- [ ] Uncovered code categorized (critical, important, low-risk)
- [ ] Coverage gaps prioritized by business impact
- [ ] Dead code identified and flagged for removal
- [ ] Coverage improvement plan created
- [ ] Estimated effort for coverage improvement calculated
- [ ] Coverage targets set per module/component

**Template - Coverage Gap Analysis:**
```
Module: Order Processing
Total Lines: 2,450
Covered Lines: 1,837 (75%)
Uncovered Lines: 613 (25%)

Priority Gaps:
  1. Payment processing error handling - 0% coverage (CRITICAL)
  2. Inventory reservation rollback - 15% coverage (CRITICAL)
  3. Order status transitions - 45% coverage (HIGH)
  4. Email notification formatting - 30% coverage (MEDIUM)
  5. Logging utilities - 60% coverage (LOW)

Dead Code Candidates:
  - legacyOrderConverter() - unused, 45 lines
  - deprecatedTaxCalculator() - replaced, 30 lines
```

### Step 4: Implement Coverage Improvements

**Actions:**
- Add tests for high-priority coverage gaps
- Implement mutation testing to validate test quality
- Remove or exclude dead code from coverage
- Update coverage thresholds based on realistic targets

**Checklist:**
- [ ] Tests added for critical coverage gaps
- [ ] Mutation testing executed (stryker, pitest)
- [ ] Dead code removed or excluded from coverage
- [ ] Coverage thresholds updated
- [ ] Coverage gate configured in CI/CD
- [ ] Coverage improvement validated

### Step 5: Track Coverage Trends and Report

**Actions:**
- Monitor coverage trends across releases
- Generate coverage reports for stakeholders
- Identify coverage regression and investigate
- Provide coverage optimization recommendations

**Checklist:**
- [ ] Coverage trends tracked over time
- [ ] Coverage reports generated per release
- [ ] Coverage regression detected and investigated
- [ ] Coverage optimization recommendations provided
- [ ] Coverage dashboard updated
- [ ] Coverage goals reviewed and adjusted

## Success Metrics

| Metric | Target | Measurement |
|--------|--------|-------------|
| Line Coverage | >85% | Covered lines / Total lines |
| Branch Coverage | >80% | Covered branches / Total branches |
| Function Coverage | >90% | Covered functions / Total functions |
| Mutation Score | >75% | Killed mutants / Total mutants |
| Coverage Regression | 0 regressions | Coverage decrease between releases |
| Coverage Gate Pass Rate | >99% | Builds passing coverage gate / Total builds |

## Error Handling

### Error 1: Coverage Numbers Are Misleadingly High
**Symptoms:** High coverage percentage but tests don't assert behavior
**Resolution:**
1. Implement mutation testing to validate test effectiveness
2. Review tests for assertions (not just execution)
3. Check for tests that execute code without verifying outcomes
4. Use coverage with assertion analysis tools
5. Focus on branch coverage over line coverage

### Error 2: Coverage Drops After Refactoring
**Symptoms:** Coverage percentage decreases after code refactoring
**Resolution:**
1. Compare coverage before/after at file level
2. Check if refactored code paths are still tested
3. Update tests to match new code structure
4. Verify coverage tool handles refactored code correctly
5. Exclude generated/boilerplate code from coverage

### Error 3: Coverage Collection Overhead Too High
**Symptoms:** Test execution time increases significantly with coverage
**Resolution:**
1. Use coverage only in CI, not local development
2. Optimize coverage tool configuration (exclude vendor, test files)
3. Use sampling-based coverage for large codebases
4. Run coverage on subset of tests for quick feedback
5. Consider incremental coverage (only changed files)

## Cross-Team Integration

- **automation-qualityforge-test-automation**: Integrate coverage collection into test automation pipeline
- **unittest-qualityforge-unit-testing**: Collaborate on unit test coverage improvement
- **monitor-qualityforge-quality-monitor**: Feed coverage metrics into quality dashboards
- **reporter-qualityforge-quality-reporter**: Provide coverage data for quality reports
- **guardian-Guardian**: Supply coverage data for quality gate enforcement
- **trainer-qualityforge-quality-trainer**: Identify coverage gaps for training focus areas

