qe-coverage-analysis
Analyzes test coverage data (Istanbul, c8, lcov) to identify uncovered lines, branches, and functions with risk-weighted gap detection. Use when analyzing coverage reports, identifying coverage gaps, comparing coverage between branches, or prioritizing which untested code to cover first.
What this skill does
# QE Coverage Analysis
## Purpose
Guide the use of v3's advanced coverage analysis capabilities including sublinear gap detection algorithms, risk-weighted coverage scoring, and intelligent test prioritization based on code criticality.
## Activation
- When analyzing test coverage
- When identifying coverage gaps
- When prioritizing testing effort
- When setting coverage targets
- When assessing code risk
## Quick Start
```bash
# Analyze coverage with gap detection
aqe coverage analyze --source src/ --tests tests/
# Find high-risk uncovered code
aqe coverage gaps --risk-weighted --threshold 80
# Generate coverage report
aqe coverage report --format html --output coverage-report/
# Compare coverage between branches
aqe coverage diff --base main --head feature-branch
```
## Agent Workflow
```typescript
// Comprehensive coverage analysis
Task("Analyze coverage gaps", `
Perform O(log n) coverage analysis on src/:
- Calculate statement, branch, function coverage
- Identify uncovered critical paths
- Risk-weight gaps by code complexity and change frequency
- Recommend tests to write for maximum coverage impact
`, "qe-coverage-specialist")
// Risk-based prioritization
Task("Prioritize coverage effort", `
Analyze coverage gaps and prioritize by:
- Business criticality (payment, auth, data)
- Code complexity (cyclomatic > 10)
- Recent bug history
- Change frequency
Output prioritized list of files needing tests.
`, "qe-coverage-analyzer")
```
## Analysis Strategies
### 1. Sublinear Gap Detection
```typescript
await coverageAnalyzer.detectGaps({
algorithm: 'sublinear', // O(log n) complexity
source: 'src/**/*.ts',
metrics: ['statement', 'branch', 'function'],
sampling: {
enabled: true,
confidence: 0.95,
maxSamples: 1000
}
});
```
### 2. Risk-Weighted Coverage
```typescript
await coverageAnalyzer.riskWeightedAnalysis({
coverage: coverageReport,
riskFactors: {
complexity: { weight: 0.3, threshold: 10 },
changeFrequency: { weight: 0.25, window: '90d' },
bugHistory: { weight: 0.25, window: '180d' },
criticality: { weight: 0.2, tags: ['payment', 'auth'] }
},
output: {
riskScore: true,
prioritizedGaps: true
}
});
```
### 3. Differential Coverage
```typescript
await coverageAnalyzer.diffCoverage({
base: 'main',
head: 'feature-branch',
requirements: {
newCode: 80, // New code must have 80% coverage
modifiedCode: 'maintain', // Don't decrease existing
deletedCode: 'ignore'
}
});
```
## Coverage Thresholds
```yaml
thresholds:
global:
statements: 80
branches: 75
functions: 85
lines: 80
per_file:
min_statements: 70
critical_paths: 90
new_code:
statements: 85
branches: 80
exceptions:
- path: "src/migrations/**"
reason: "Database migrations"
- path: "src/generated/**"
reason: "Auto-generated code"
```
## Coverage Report
```typescript
interface CoverageAnalysis {
summary: {
statements: { covered: number; total: number; percentage: number };
branches: { covered: number; total: number; percentage: number };
functions: { covered: number; total: number; percentage: number };
};
gaps: {
file: string;
uncoveredLines: number[];
uncoveredBranches: BranchInfo[];
riskScore: number;
suggestedTests: string[];
}[];
trends: {
period: string;
coverageChange: number;
newGaps: number;
closedGaps: number;
};
recommendations: {
priority: 'critical' | 'high' | 'medium' | 'low';
file: string;
action: string;
expectedImpact: number;
}[];
}
```
## Quality Gates
```yaml
quality_gates:
coverage:
block_merge:
- new_code_coverage < 80
- coverage_regression > 5
- critical_path_uncovered
warn:
- overall_coverage < 75
- branch_coverage < 70
metrics:
- track_trends: true
- alert_on_decline: 3 # consecutive PRs
```
## Run History
After each coverage analysis, append results to `run-history.json` in this skill directory:
```bash
# Read current history, append new entry, write back
node -e "
const fs = require('fs');
const h = JSON.parse(fs.readFileSync('.claude/skills/qe-coverage-analysis/run-history.json'));
h.runs.push({date: new Date().toISOString().split('T')[0], statements_pct: STATEMENTS, branches_pct: BRANCHES, gaps_found: GAPS});
fs.writeFileSync('.claude/skills/qe-coverage-analysis/run-history.json', JSON.stringify(h, null, 2));
"
```
Read `run-history.json` before each run to detect trends (e.g., "coverage dropped 3 consecutive times").
## Skill Composition
- **Coverage dropped?** → Use `/coverage-drop-investigator` to trace the cause
- **Need more tests** → Use `/qe-test-generation` to fill gaps
- **Validate quality** → Use `/mutation-testing` to ensure coverage means quality
- **Ship decision** → Feed into `/qe-quality-assessment` for deployment readiness
## Gotchas
- High line coverage does NOT mean good tests — 100% coverage with 0% assertions is common agent output. Use mutation testing to verify
- coverage-analysis domain has 86% success rate — 14% of runs fail on initialization. Always verify results and have fallback plan (e.g. manual coverage tools)
- Self-learning pipeline may silently stop learning (statusline frozen for days) — only human inspection catches this
## Coordination
**Primary Agents**: qe-coverage-specialist, qe-coverage-analyzer, qe-gap-detector
**Coordinator**: qe-coverage-coordinator
**Related Skills**: qe-test-generation, qe-quality-assessment
Related in Code Review
gstack
IncludedFast headless browser for QA testing and site dogfooding. Navigate pages, interact with elements, verify state, diff before/after, take annotated screenshots, test responsive layouts, forms, uploads, dialogs, and capture bug evidence. Use when asked to open or test a site, verify a deployment, dogfood a user flow, or file a bug with screenshots. (gstack)
startup-due-diligence
IncludedLegal due diligence review for seed-stage and Series A startups (US, Delaware C-Corp focus). Supports both investor and founder perspectives. Capabilities include: (1) Interactive document review and issue spotting; (2) Document request list generation; (3) Cap table and SAFE/convertible note analysis; (4) Red flag identification with severity ratings; (5) Diligence report generation. TRIGGERS: due diligence, DD, startup investment, cap table review, Series A, seed round, investor diligence, legal review startup, SAFE analysis, convertible note, 409A, founder vesting.
interview-master
IncludedThis skill should be used when the user asks to "generate interview questions", "prepare for interview", "optimize resume", "conduct mock interview", "analyze git commits for resume", "generate resume from code", "review my resume", or mentions interview preparation, career assistance, or extracting project experience from git history. Provides comprehensive interview and career development guidance for both job seekers and interviewers.
fix-issue
IncludedFixes GitHub issues using parallel analysis agents for root cause investigation, code exploration, and regression detection. Reads issue context from gh CLI, searches codebase and memory for related patterns, generates a fix with tests, and links the resolution back to the issue via PR. Includes prevention analysis to avoid recurrence. Use when debugging errors, resolving regressions, fixing bugs, or triaging issues.
sf-apex
IncludedGenerates and reviews Salesforce Apex code with 150-point scoring. TRIGGER when: user writes, reviews, or fixes Apex classes, triggers, test classes, batch/queueable/schedulable jobs, or touches .cls/.trigger files. DO NOT TRIGGER when: LWC JavaScript (use sf-lwc), Flow XML (use sf-flow), SOQL-only queries (use sf-soql), or non-Salesforce code.
swift-development
IncludedComprehensive Swift development for building, testing, and deploying iOS/macOS applications. Use when Claude needs to: (1) Build Swift packages or Xcode projects from command line, (2) Run tests with XCTest or Swift Testing framework, (3) Manage iOS simulators with simctl, (4) Handle code signing, provisioning profiles, and app distribution, (5) Format or lint Swift code with SwiftFormat/SwiftLint, (6) Work with Swift Package Manager (SPM), (7) Implement Swift 6 concurrency patterns (async/await, actors, Sendable), (8) Create SwiftUI views with MVVM architecture, (9) Set up Core Data or SwiftData persistence, or any other Swift/iOS/macOS development tasks.