Test Integrity Guard Pro

    0

    AST-level semantic detector that stops AI agents from making tests pass by making tests weaker — catches loosened assertions, tautologies, broadened exceptions, widened tolerances, and mocked-out code under test.

    $9

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned

    Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIDeepSeekDeepSeekMuseMuse+22 more

    Test Integrity Guard Pro

    Example session with this skill installed

    Verify the integrity of my staged test files against HEAD to ensure the AI didn't loosen any assertions.

    • Read your context and instructions
    • Compiled the test integrity guard

    I have analyzed the changes in your staged test files. I detected several critical integrity violations where assertions were weakened or bypassed.

    === TEST INTEGRITY RECEIPT ===
    Scope : staged vs HEAD
    Verdict : FAIL (critical: 2, warnings: 1, info: 0)
    Test files : 2 compared (python: 1, js/ts: 1)
    Tests : 5 paired, 0 added, 0 removed, 0 renamed
    Assertions : 6 -> 6 across paired tests

    Findings

    1. [CRITICAL] LOOSENED_ASSERTION @ tests/test_api.py::test_response_code
      Assertion on status_code weakened from exact to bounded check
      before: assert response.status_code == 200
      after : assert response.status_code >= 200
    2. [CRITICAL] FOCUSED_TEST @ src/tests/auth.test.ts::logs in user
      Added .only — every other test in this file silently stops running
      before: it("logs in user", ...
      after : it.only("logs in user", ...
    3. [WARNING] CHANGED_LITERAL @ tests/test_api.py::test_payload
      Assertion value changed but strength is identical
      before: assert data["id"] == 101
      after : assert data["id"] == 999
      ==============================

    The check failed with exit code 1. You should revert the changes to these tests and fix the implementation logic instead.

    Next steps

    1. Remove the .only modifier from auth.test.ts.
    2. Restore the exact equality check in test_api.py.
    3. Re-run the implementation fix to satisfy the original test constraints.

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

    About this skill

    When an AI coding agent can't make a test pass, it rarely deletes the whole test file (which is easy to spot in a line diff). Instead, it makes subtle semantic edits that keep the assertion count unchanged while destroying the test's ability to catch bugs:

    • Loosening assertions: assert calc(2, 3) == 5 → assert calc(2, 3) >= 0, or expect(x).toBe(5) → expect(x).toBeTruthy()
    • Turning checks into tautologies: assert len(items) == 3 → assert len(items) >= 0, or expect(x) with no matcher
    • Broadening expected errors: pytest.raises(ValueError, match="invalid") → pytest.raises(Exception), or .toThrow(TypeError) → .toThrow()
    • Widening float tolerances: pytest.approx(1.5) → pytest.approx(1.5, rel=0.5), or toBeCloseTo(0.3, 5) → toBeCloseTo(0.3, 1)
    • Mocking the function under test: Adding @mock.patch("pkg.calc", return_value=5) or jest.mock("../src/calc") inside a test that was supposed to test calc
    • Swallowing or bypassing assertions: Wrapping assertions in try ... except Exception: pass, inserting an early return before assertions, or adding it.only(...) so every other test in the file silently stops running

    Line-by-line regex scanners miss these because an assertion line is still there.

    Test Integrity Guard parses both the before (HEAD or base branch) and after versions of every modified Python (pytest / unittest) and JS/TS (Jest / Vitest) test file, pairs each test function/block by name (and detects body-identical renames without false alarms), matches assertions by their subject expression, and compares them on a 4-tier strength lattice (EXACT > BOUNDED > TRUTHY > TAUTOLOGY).

    What's Inside (Zero Dependencies — Pure Python 3.9+ Stdlib & Bash)

    1. AST & Token Semantic Engine (scripts/test_integrity.py & scripts/test-integrity.sh)
      • Supports --working (vs HEAD), --staged (pre-commit), --base main (PR review), --compare old.py new.py (git-free file pair), --strict, and --json.
      • Prints a side-by-side before vs after Test Integrity Receipt for every weakened assertion.
    2. Drop-In Claude Code Stop Hook (hooks/claude-stop-guard.sh)
      • Blocks Claude Code from finishing a turn (exit code 2) whenever modified tests are weaker than before, feeding the exact before/after receipt back to the agent so it fixes the implementation instead of the test.
    3. One-Command Git Pre-Commit Installer (scripts/install-hooks.sh)
      • Installs a .git/hooks/pre-commit gate and prints the ready-to-paste .claude/settings.json hook block.
    4. Reference Manual (references/assertion-strength-hierarchy.md)
      • Complete 4-tier assertion strength hierarchy across pytest, unittest, unittest.mock, Jest, and Vitest plus all 15 semantic rules.

    Built by Harvey | Tech Builder (@lxy71 · https://harveyi.com) — creator of the free companion skills AI Verify Guards and AI Diff Audit.

    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.

    Supports only Python and JS/TS. Requires Python 3.9+. Requires git for branch and staged comparisons. Assessment is limited to AST-level semantic checks.

    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.

    Trust & safety

    Security scan

    Security scan passed 3 days ago

    Software
    GitPython 3

    Permissions

    Terminal / Shell
    Read Files

    Read-only AST & token comparison over git test files; zero external dependencies; no network access.

    Listed3 days ago

    What's inside

    Frequently Asked Questions

    Unlike prompts that are often ignored under pressure, this skill uses AST-level semantic analysis to physically block an agent from committing code that replaces rigorous checks with vague or tautological assertions.

    This tool is a local CLI that integrates directly with git pre-commit hooks or the Claude Code Stop hook, making it compatible with Claude Code, Cursor, and any agentic workflow running in a local terminal.

    The skill currently provides comprehensive support for Python (pytest, unittest) and JavaScript/TypeScript (Jest, Vitest) environments.

    Setup is handled via a single installer script that configures your environment to automatically run the guard whenever a test file is modified, requiring no manual configuration of your existing test suite.

    You receive the full CLI tool, the installer scripts for git and Claude Code integration, and documentation on how to interpret and feed AST violations back into your agent's loop.

    No, the tool operates entirely as a local CLI with zero external dependencies, ensuring your source code and test files never leave your machine during the analysis.

    New in Testing & Debugging