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".
What this skill does
# 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**:
```typescript
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**:
```typescript
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**:
```typescript
// 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**:
```typescript
// 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
```markdown
# 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) { // UNTESTED
return false;
}
return true;
}
```
**Impact**: Security vulnerability, potential for unauthorized access.
**Recommendation**: Add comprehensive tests for all auth flows.
**Required Tests**:
1. resetPassword with valid email
2. resetPassword with invalid email
3. resetPassword with malformed email
4. validateResetToken with expired token
5. validateResetToken with invalid token
6. validateResetToken with valid token
**Estimated Coverage After**: 88%
---
### [GAP-002] Payment Processing
**File**: src/payments/PaymentService.ts
**Line Coverage**: 41% (Target: 99%+)
**Branch Coverage**: 29%
**Risk**: CRITICAL
**Untested Code Paths**:
```typescript
async processPayment(order: Order): Promise<PaymentResult> {
try {
const charge = await stripe.charges.create({ // TESTED
amount: order.total,
currency: 'usd',
source: order.paymentToken
});
if (charge.status === 'failed') { // UNTESTED
await this.handleFailedPayment(order); // UNTESTED
throw new PaymentError('Payment failed');
}
await this.fulfillOrder(order); // TESTED
return { success: true, chargeId: charge.id };
} catch (error) {
if (error.code === 'card_declined') { // UNTESTED
await this.notifyCardDeclined(order); // UNTESTED
}
throw error; // UNTESTED
}
}
```
**Impact**: Financial loss, failed orders without proper handling.
**Recommendation**: Mock Stripe, test all payment scenarios.
**Required Tests**:
1. Successful payment flow
2. Failed payment (charge.status === 'failed')
3. Card declined error
4. Network error during payment
5. Order fulfillment failure after charge
**Estimated Coverage After**: 94%
## High Priority Gaps (Priority 2)
### [GAP-003] User Registration Validation
**File**: src/users/UserService.ts
**Line Coverage**: 62%
**Branch Coverage**: 48%
**Risk**: HIGH
**Untested Validation Logic**:
```typescript
validateUserData(data: UserInput): ValidationResult {
const errors: string[] = [];
if (!data.email || !data.email.includes('@')) { // Partially tested
errors.push('Invalid email');
}
if (data.password.length < 8) { // UNTESTED
errors.push('Password too short');
}
if (!/[A-Z]/.test(data.password)) { // UNTESTED
errors.push('Password needs uppercase');
}
if (!/[0-9]/.test(data.password)) { // UNTESTED
errors.push('Password needs number');
}
return { valid: errors.length === 0, errors };
}
```
**Recommendation**: Test all validation branches.
### [GAP-004] API Error Handling
**File**: src/api/handlers/UserHandler.ts
**Line Coverage**: 59%
**Branch Coverage**: 41%
**Risk**: HIGH
**Untested Error Paths**:
```typescript
async getUser(req: Request, res: Response) {
try {
const user = await this.userService.getById(req.params.id);
res.json(user); // TESTED
} catch (erRelated 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.