Skip to content
Development
Skill

/coverage-analyzer

Automatically analyze test coverage when user asks which code is tested, mentions coverage gaps, or shows code asking about testing. Identifies untested code paths and suggests test additions. Invoke when user asks "what's not tested?", "coverage", "untested code", or "which

From plugin
cms-cultivator
1728 skills1 agent

Claude Code

$ npx -y skills add kanopi/cms-cultivator --skill coverage-analyzer --agent claude-code

SKILL.md

coverage-analyzer.SKILL.md
name: coverage-analyzer
description: Automatically analyze test coverage when user asks which code is tested, mentions coverage gaps, or shows code asking about testing. Identifies untested code paths and suggests test additions. Invoke when user asks "what's not tested?", "coverage", "untested code", or "which tests are missing?".

Coverage Analyzer

Automatically analyze test coverage and identify untested code.

Philosophy

Knowing what's tested gives confidence to refactor and prevents regressions.

Core Beliefs

1. **Visibility Drives Action**: Can't improve what you can't measure 2. **Not All Code Needs 100% Coverage**: Prioritize critical paths over getters/setters 3. **Coverage ≠ Quality**: 100% coverage doesn't guarantee bug-free code 4. **Gap Analysis Guides Testing**: Knowing what's untested helps prioritize test writing

Why Coverage Analysis Matters

  • **Identify Risks**: Find critical code without test protection
  • **Prioritize Effort**: Focus testing where it matters most
  • **Prevent Regressions**: Tests catch bugs before they reach users
  • **Enable Refactoring**: Good coverage allows confident code changes

When to Use This Skill

Activate this skill when the user:

  • Asks "what code isn't tested?"
  • Mentions "test coverage" or "coverage report"
  • Says "which tests are missing?"
  • Shows code and asks "is this tested?"
  • References "untested code paths"
  • Asks "what's my coverage percentage?"

Decision Framework

Before analyzing coverage, consider:

What's the Goal?

1. **Find coverage gaps** → Identify untested code 2. **Measure current coverage** → Run coverage tools and report percentages 3. **Prioritize testing** → Focus on critical paths first 4. **Improve coverage** → Recommend specific tests to write

What's the Scope?

  • **Specific file** - User shows code → Analyze that file's coverage
  • **Component/module** - User mentions feature → Check component tests
  • **Recent changes** - User says "my code" → Check coverage of git diff
  • **Entire project** - User says "overall coverage" → Run project-wide analysis

What Test Types Exist?

**Check for**:

  • PHPUnit tests (PHP) → Run `phpunit --coverage-text`
  • Jest tests (JavaScript) → Run `jest --coverage`
  • Cypress tests (E2E) → Integration coverage only
  • Manual test documentation → Note gaps

What Coverage Metrics Matter?

**Primary metrics**:

  • **Line coverage** - Percentage of lines executed
  • **Branch coverage** - Percentage of decision branches taken
  • **Function coverage** - Percentage of functions called

**Priority order**: 1. Critical paths (auth, payments, data writes) 2. Public APIs 3. Security-sensitive code 4. Business logic 5. Getters/setters (lowest priority)

What's a Good Target?

  • **Critical code** - Aim for 90%+ coverage
  • **Business logic** - Aim for 80%+ coverage
  • **Overall project** - Aim for 70%+ coverage
  • **Getters/setters** - Can skip, focus on behavior

Decision Tree

User asks about coverage
    ↓
Determine scope (file/component/project)
    ↓
Check for existing test files
    ↓
Run coverage tool (PHPUnit/Jest/Cypress)
    ↓
Analyze gaps (prioritize critical paths)
    ↓
Report coverage with recommendations
    ↓
Suggest specific tests for gaps

Quick Coverage Analysis

1. Check if Tests Exist

**PHP (PHPUnit):**

# Check for test files
find tests/ -name "*Test.php"

# Check specific class
test -f "tests/src/Unit/DataProcessorTest.php" && echo "Tests exist"

**JavaScript (Jest):**

# Check for test files
find . -name "*.test.js" -o -name "*.spec.js"

2. Run Coverage Analysis

**PHP:**

# Generate coverage report
vendor/bin/phpunit --coverage-text

# For Kanopi projects
ddev exec vendor/bin/phpunit --coverage-text

**JavaScript:**

# Jest coverage
npm run test -- --coverage

# Or directly
npx jest --coverage

3. Identify Gaps

**Common untested areas:**

  • Error handling (catch blocks)
  • Edge cases (empty input, null values)
  • Private methods (test via public interface)
  • Complex conditionals
  • New features without tests

Response Format

## Test Coverage Analysis

### Summary
- **Overall Coverage**: 72%
- **Files Analyzed**: 45
- **Tested**: 32 files
- **Untested**: 13 files

### Coverage by Type
- Classes: 85% (34/40)
- Methods: 68% (156/230)
- Lines: 72% (2,340/3,250)
- Branches: 58% (89/153)

### 🔴 Critical Gaps (No Tests)

**1. PaymentProcessor.php** - 0% coverage
- **Risk**: High - handles money
- **Methods untested**: processPayment(), refund(), validate()
- **Recommendation**: Add unit tests immediately

**2. AuthenticationService.php** - 0% coverage
- **Risk**: Critical - security component
- **Methods untested**: authenticate(), validateToken()
- **Recommendation**: Add security tests ASAP

### 🟡 Partial Coverage

**3. UserManager.php** - 45% coverage
- ✅ Tested: getUser(), createUser()
- ❌ Untested: deleteUser(), updatePermissions()
- **Recommendation**: Add tests for delete and permission methods

### ✅ Well Tested

- DataProcessor.php - 95%
- EmailService.php - 88%
- ValidationHelper.php - 100%

### Suggested Actions

1. **Immediate** (Critical):
   - Add tests for PaymentProcessor
   - Add tests for AuthenticationService

2. **This Sprint**:
   - Complete UserManager tests
   - Add integration tests for checkout flow

3. **Next Sprint**:
   - Increase overall coverage to 80%
   - Add E2E tests for critical paths

Detailed Analysis

Method-Level Coverage

## DataProcessor.php Coverage

| Method | Tested? | Coverage | Priority |
|--------|---------|----------|----------|
| processData() | ✅ Yes | 100% | - |
| validateInput() | ✅ Yes | 90% | Low |
| handleError() | ❌ No | 0% | High |
| formatOutput() | ⚠️ Partial | 60% | Medium |

### Untested Code Paths

**handleError() method:**
```php
public function handleError($error) {
  // Line 45: No test coverage
  if ($error instanceof ValidationException) {
    return $this->formatVali
Read more
@kanopi
Ships withcms-cultivator

Specialist agents and auto-invoked skills for Drupal/WordPress development. Works in Claude Code, Claude Desktop, and OpenAI Codex. Full documentation: What changed in 2.0? CMS Cultivator now focuses on CMS development workflows.

1728 skills1 agent
Get the whole plugin

Stars on GitHub

Momentum

stars in total
17
Star history of kanopi/cms-cultivator on GitHub, a chart by star-history.com

Other skills on cms-cultivator.

browser-validator

browser-validator

Automatically validate implementations in real browsers after code is written or when user says "test this", "test what you built…

ddev-docker-cleanup

ddev-docker-cleanup

Deterministic cleanup of DDEV and Docker disk usage on OrbStack, Docker Desktop, or any Docker provider. Safely reclaims space by…

ddev-workflow

ddev-workflow

Operate a Kanopi DDEV site day to day — get a fresh clone or worktree actually serving pages, pull a database from the hosting…

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills10d309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc11d293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react1d252k
@facebook@facebookInstall Skill

Questions about coverage-analyzer.

Which coding agents can use coverage-analyzer?
coverage-analyzer installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.