# Diff Coverage: Test the Lines You Changed

> Measure test coverage of only the lines a change adds, then get a plan of the missing tests with code and hints. Cobertura XML and coverage.py JSON, thresholds, CI recipes, offline scripts and 25 tests.

Diff Coverage: Test the Lines You Changed is a paid AI agent skill on Agensi by José Miguel Gómez, in Testing & Debugging. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $7 (one-time purchase)
- Creator: [José Miguel Gómez](https://www.agensi.io/creators/jose-miguel-gomez)
- Category: [Testing & Debugging](https://www.agensi.io/skills/testing-debugging)
- Version: 1.0
- Last updated: 2026-12-03
- Security: scan passed (2026-12-03); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/diff-coverage-test-the-lines-you-changed
- Tags: testing, automation, python

## What it does

- Calculates the exact percentage of new or changed code covered by your tests
- Lists every new line of code that was not executed during your last test run
- Provides a test plan that suggests what kind of test each missing line needs
- Identifies files that were skipped or not measured in your report
- Creates a formatted summary ready to be pasted into a code review or pull request

## Who it's for

- **Developers fixing bugs or adding features:** Ensure every new line of code you write is actually tested before you merge it. Try: "Check the test coverage for the changes in this patch file."
- **Code reviewers and tech leads:** Stop guessing if a pull request is safe and see exactly which new lines are missing tests. Try: "List the uncovered lines in this diff and tell me what tests they need."
- **Teams setting up quality gates:** Set a minimum coverage rule for new code without needing to fix the whole legacy project at once. Try: "Calculate the diff coverage for this change and tell me if it stays above 80 percent."

## About this skill

When you change code, it is easy to miss testing a new edge case or an error path. This skill helps you focus only on the lines you just added or changed. Instead of looking at the coverage for your whole project, which can be messy and distracting, it looks at your specific changes and tells you exactly what is not tested yet.

It reads your code changes and your test reports to find the gaps. It then creates a clear plan showing the specific lines of code that need attention and the type of test you should write for them, like an error check or a loop test.

**How it works**
1. Give your AI agent a file showing your code changes and a recent test coverage report.
2. The skill identifies which of your new lines were actually run during the tests.
3. It calculates a percentage score for just your new changes.
4. It lists every new line that was missed, including the code itself and a hint on how to test it.
5. You use the plan to write the missing tests and verify the fix.

**What you get:** A detailed report of untested new code and a step-by-step plan to reach your coverage goals.

## Requires

- Python
- Git

## Known limitations

Only works with Cobertura XML or coverage.py JSON reports. It does not run git or your tests for you.

## Technical details

This skill uses Python scripts to parse unified diffs and coverage reports (Cobertura XML or coverage.py JSON). It maps line numbers from the diff to the execution data in the report to calculate 'patch coverage'. It includes templates for PR comments and CI configurations. It does not require network or git access as it operates entirely on provided local files.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the Diff Coverage: Test the Lines You Changed skill from Agensi" and describe your task.
3. Buy it on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### Why should I use this instead of my usual test coverage tool?

This skill focuses only on the specific lines of code you recently added or changed. It helps you see exactly what your tests missed so you can fix those gaps without getting distracted by the rest of the project.

### What files do I need to give my AI agent for this to work?

You need to provide a file showing your code changes (a unified diff) and a recent test coverage report in Cobertura XML or coverage.py JSON format. The skill requires Python 3.10 or newer to run these checks.

### What does the final report actually look like?

You get a detailed report showing a coverage percentage for your changes and a step by step plan. This plan lists every missing line of code along with a hint on what kind of test to write, such as an error check or a loop test.

### Are there any specific file types or actions this skill cannot handle?

The skill does not connect to the internet, read your environment settings, or run git commands. It also only supports specific report formats and will not process XML files that contain certain document type declarations.

### How do I tell my AI agent to start checking my code changes?

You can ask your agent to measure the patch coverage of a specific file or request a list of new lines that are missing tests. You should tell the agent where your diff and coverage report files are located when you make the request.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
