Analyze Test Coverage logo

Analyze Test Coverage

Community
dykyi-roman
analyze-test-coverage

Analyzes PHP codebase for test coverage gaps. Detects untested classes, methods, branches, exception paths, and edge cases. Provides actionable recommendations.

Overview

Publisherdykyi-roman
Repositoryawesome-claude-code
Skill nameanalyze-test-coverage
Stars
98
Forks
25
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by dykyi-roman on GitHub. Read the source before you install it.

Installation

Install the Analyze Test Coverage AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/dykyi-roman/awesome-claude-code.git /tmp/awesome-claude-code
mkdir -p .claude/skills
cp -r /tmp/awesome-claude-code/skills/analyze-test-coverage .claude/skills/analyze-test-coverage
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Analyze Test Coverage in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Analyze Test Coverage on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Analyze Test Coverage is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Test Coverage Analysis

Analyzes PHP codebase to identify untested code and coverage gaps.

Detection Patterns

1. Classes Without Tests

bash
# Find all PHP classes in src/
Glob: src/**/*.php

# Find all test files
Glob: tests/**/*Test.php

# Compare: class Foo in src/ should have FooTest in tests/

Pattern Matching:

src/Domain/User/User.php → tests/Unit/Domain/User/UserTest.php
src/Application/PlaceOrder/PlaceOrderHandler.php → tests/Unit/Application/PlaceOrder/PlaceOrderHandlerTest.php

2. Methods Without Tests

php
// For each public method in class
Grep: "public function [a-z]" --glob "src/**/*.php"

// Check if test method exists
Grep: "test_methodName" --glob "tests/**/*Test.php"

Detection Logic:

Class: Order
├── confirm() → test_confirm_* exists? ✅/❌
├── cancel() → test_cancel_* exists? ✅/❌
├── ship() → test_ship_* exists? ✅/❌
└── addItem() → test_addItem_* / test_add_item_* exists? ✅/❌

3. Branches Not Covered

If/Else Branches:

php
// Source code
public function process(Order $order): void
{
    if ($order->isPending()) {     // Branch 1: pending
        $this->processPending($order);
    } elseif ($order->isConfirmed()) { // Branch 2: confirmed
        $this->processConfirmed($order);
    } else {                       // Branch 3: other
        throw new InvalidStateException();
    }
}

// Required tests:
// - test_process_when_pending_*
// - test_process_when_confirmed_*
// - test_process_when_other_throws_exception

Switch Statements:

php
// Source code
match ($status) {
    'pending' => $this->handlePending(),
    'confirmed' => $this->handleConfirmed(),
    'shipped' => $this->handleShipped(),
    default => throw new UnexpectedValueException(),
};

// Required tests: one per case + default

4. Exception Paths

php
// Detect throw statements
Grep: "throw new" --glob "src/**/*.php"

// Each throw should have corresponding test with expectException

Example:

php
// Source
public function withdraw(Money $amount): void
{
    if ($amount->greaterThan($this->balance)) {
        throw new InsufficientFundsException();  // Line 15
    }
}

// Required test
public function test_withdraw_throws_for_insufficient_funds(): void
{
    $this->expectException(InsufficientFundsException::class);
    // ...
}

5. Edge Cases

TypeValues to TestDetection
Nullnull inputParameters without type hint or nullable
Empty[], '', 0Collection/string/numeric parameters
Boundarymin, max, min-1, max+1Constants, validation limits
Unicode'émoji 🎉'String parameters
ConcurrentRace conditionsShared state, repositories

Detection Patterns:

php
// Nullable parameters
Grep: "\?[A-Z]" --glob "src/**/*.php"  // ?Type
Grep: "null\|" --glob "src/**/*.php"   // Type|null

// Collections
Grep: "array \$" --glob "src/**/*.php"
Grep: "iterable" --glob "src/**/*.php"

// Numeric limits
Grep: "const MAX_" --glob "src/**/*.php"
Grep: "const MIN_" --glob "src/**/*.php"

Analysis Process

Phase 1: Inventory

  1. List all production classes:

    Glob: src/**/*.php
  2. List all test classes:

    Glob: tests/**/*Test.php
  3. Build mapping:

    ProductionClass → [TestClass, TestClass]

Phase 2: Class Coverage

For each production class:

  1. Check if corresponding test exists
  2. Calculate: covered_classes / total_classes * 100

Phase 3: Method Coverage

For each public method:

  1. Extract method names from production code
  2. Search for test_{method} patterns in tests
  3. Calculate: tested_methods / total_methods * 100

Phase 4: Branch Coverage

For each conditional:

  1. Count branches (if/elseif/else, match cases)
  2. Search for tests covering each branch
  3. Report uncovered branches

Phase 5: Edge Cases

  1. Identify nullable/optional parameters
  2. Identify collections
  3. Identify numeric limits
  4. Check if edge case tests exist

Output Format

markdown
# Test Coverage Analysis Report

## Summary

| Metric | Value | Target |
|--------|-------|--------|
| Class Coverage | 75% | 90% |
| Method Coverage | 60% | 80% |
| Branch Coverage | 45% | 70% |

## Untested Classes

| Class | Location | Priority |
|-------|----------|----------|
| `PaymentProcessor` | src/Domain/Payment/ | High |
| `EmailNotifier` | src/Infrastructure/ | Medium |

## Untested Methods

| Class | Method | Reason |
|-------|--------|--------|
| `Order` | `splitShipment()` | No test found |
| `User` | `resetPassword()` | Only happy path tested |

## Uncovered Branches

| File | Line | Branch | Missing Test |
|------|------|--------|--------------|
| Order.php | 45 | else (cancelled) | test_ship_when_cancelled |
| User.php | 23 | null check | test_with_null_email |

## Missing Edge Cases

| Class | Method | Edge Case |
|-------|--------|-----------|
| `Cart` | `addItem()` | Empty cart, max items |
| `Money` | `add()` | Zero amount, overflow |

## Action Items

### Critical (Must Have)
1. Add `PaymentProcessorTest` — handles money
2. Add `test_order_ship_when_cancelled` — business rule

### High Priority
1. Add null checks for `User::resetPassword()`
2. Add boundary tests for `Cart::addItem()`

### Recommended Skills

| Gap | Skill | Action |
|-----|-------|--------|
| Missing unit test | `create-unit-test` | Generate test class |
| Missing integration test | `create-integration-test` | Generate DB test |
| Need test data | `create-test-builder` | Generate builder |

Severity Levels

LevelCoverageAction
Critical<50%Immediate attention
Warning50-70%Prioritize improvement
Good70-90%Monitor and maintain
Excellent>90%Focus on edge cases

Integration with Generator

After analysis, recommend using:

  • create-unit-test — for missing unit tests
  • create-integration-test — for missing integration tests
  • create-test-builder — for complex test data
  • create-mock-repository — for repository tests

Frequently asked questions

What does the Analyze Test Coverage AI skill do?

Analyzes PHP codebase for test coverage gaps. Detects untested classes, methods, branches, exception paths, and edge cases. Provides actionable recommendations.

Why use Analyze Test Coverage on TypingMind?

Because you install it once and use it with any model. Analyze Test Coverage is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Analyze Test Coverage in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/dykyi-roman/awesome-claude-code/tree/master/skills/analyze-test-coverage. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Analyze Test Coverage?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Analyze Test Coverage?

As many as you like. As long as a model supports skills, you can use Analyze Test Coverage with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Analyze Test Coverage AI skill free?

Yes. It is published on GitHub by dykyi-roman under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇