Diff Coverage: Test the Lines You Changed

    by José Miguel Gómez

    1

    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.

    $7

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned

    Works with the AI Agents you already use

    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 asking: “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 asking: “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 asking: “Calculate the diff coverage for this change and tell me if it stays above 80 percent.”

    Diff Coverage: Test the Lines You Changed

    Example session with this skill installed

    I have a patch file called bugfix.patch and a coverage report called coverage.xml. Can you check the coverage for my changes and tell me what is missing?

    • Read your context and instructions
    • Compiled the diff coverage

    I will analyze your code changes and the coverage report to see what is tested.

    I have checked bugfix.patch against your coverage.xml report. Your change adds 12 executable lines of code.

    Coverage Results

    • Total New Lines: 12
    • Covered Lines: 9
    • Diff Coverage: 75.0%

    This is below the common 80% goal. Here are the gaps you need to fill:

    File: src/auth.py

    • Line 45: return False — Needs a test for the error path when the token is expired.
    • Line 52: logger.error("Connection failed") — Needs a test that simulates a network timeout.

    File: src/utils.py

    • Line 89: for item in items: — Needs a test with an empty list to verify the loop behavior.

    Next Steps
    You should add tests that trigger these specific lines. Once you run them and update the coverage file, I can check the numbers again for you. Would you like me to suggest the specific test code for one of these lines?

    Connects securely to your tools. The creator never sees your data.

    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.

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

    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

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Frequently Asked Questions

    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.

    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.

    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.

    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.

    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.

    New in Testing & Debugging

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Testing & Debugging.