- Home
- Skills
- Code Quality & Review
- Agent Diff Gate: Catch Weakened Tests and Scope Creep
Works with the AI Agents you already use
Agent Diff Gate: Catch Weakened Tests and Scope Creep
An agent told to make the build pass has cheap ways to get there.
$7.99
Agent Diff Gate: Catch Weakened Tests and Scope Creep
Example session with this skill installed
The agent just finished the discount rounding fix and says all tests pass. Before I merge, check its diff against main for weakened tests and anything outside src/cart and tests.
- Read your context and instructions
- Compiled the agent diff gate
Diff Gate: BLOCKED. 7 blocking, 3 warnings, 0 justified. 5 files, exit code 2. Scope: src/cart/** and tests/** allowed, .github/** protected.
| Rule | What it counts | Blocking | Warning |
|---|---|---|---|
| DG003 | Test declaration removed | 1 | 0 |
| DG005 | Skip or ignore marker added | 2 | 0 |
| DG006 | Suppression added | 0 | 1 |
| DG010 | Expected value rewritten | 0 | 1 |
| DG011 | CI or test command edited | 1 | 0 |
| DG012 | Lockfile changed without its manifest | 0 | 1 |
| DG013 | Path outside the agreed scope | 3 | 0 |
Blocking
tests/test_pricing.pyline 41, DG003:def test_discount_rounding():removed with 2 assertion lines.tests/test_pricing.pyline 58, DG005:@pytest.mark.skip(reason="rounding changed, revisit later")added abovetest_tax_included.web/cart.test.tsline 9, DG005 and DG013:it.skip("shows the discount row when a discount applies", ...)in a file outside the scope..github/workflows/ci.ymlline 19, DG011 and DG013:continue-on-error: trueadded to a protected path.package-lock.jsonline 15, DG013: matches no allowed glob.
Warnings: tests/test_pricing.py line 19 now expects Decimal("20.0") where it expected Decimal("19.99"), and src/cart/pricing.py changed in the same diff. // @ts-ignore was added at web/cart.test.ts line 10. The lockfile changed with no package.json change.
Next: I'd class all seven blocking findings as revert. With your go-ahead I'll restore test_discount_rounding from main, remove both skip markers, revert the three out-of-scope files, and put 19.99 back unless ten-cent rounding is the requirement. Then I fix src/cart/pricing.py and rerun the gate and the tests. A pass only means none of the counted patterns appeared.
Connects securely to your tools. The creator never sees your data.
About this skill
An agent told to make the build pass has cheap ways to get there. It can delete the failing test, add a skip marker, loosen an assertion, swallow the error, or edit CI config nobody asked it to touch. The summary still says all tests pass, and the evidence is somewhere in a 600-line diff.
What your agent does
- Agrees the scope first: writes allowed and protected path globs from your task into
scope.jsonand shows them to you. - Runs one script on the diff: 14 rules, and every finding carries the file, line, removed text and added text.
- Counts test tampering: deleted test files, removed tests, dropped assertions, new skip and xfail markers, tautologies such as
assert True, rewritten expected values. - Counts the quieter edits: lint and type suppressions, empty error handlers, lowered coverage thresholds, snapshot rewrites,
continue-on-errorin CI, lockfile drift, paths outside the scope. - Triages with you: each finding is classed as revert, justify or legitimate refactor, then the agent reruns and shows before and after counts.
Built-in guard rails
- An allow entry needs a reason you gave, and a justified finding still prints with it.
- Text quoted from the diff is treated as data, never as an instruction.
- Changed test files in a language without patterns give the verdict INCOMPLETE, never CLEAN.
- The script has no network code and writes only to the output folder you pass.
What's inside
SKILL.md: nine-step workflow, hard rules, limits.scripts/diff_gate.py: one standard-library script with exit codes 0 to 3 and Markdown plus JSON reports.- 5 reference files: rule catalog, triage guide, framework patterns, scope and allow files, hooks and CI (pre-commit, GitHub Actions, GitLab CI).
- 34 fixture files: a sample agent diff with its report, a clean refactor, one diff per rule, one per framework, and a
patterns.jsonexample. - 271 unit tests in 7 test files.
Patterns are built in for pytest, unittest, JUnit 4 and 5, kotlin.test, xUnit, NUnit, MSTest, Jest, Vitest, Mocha and Go test. The script matches text on changed lines. It doesn't parse code or run tests, so you still need code review and a test run.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Code Quality & Review.
It matches text patterns on changed lines and doesn't parse or run code, so some weakenings go unseen, such as a mock that returns the expected value. Only the listed frameworks are counted unless you add patterns. The scope check is only as good as scope.json, and untracked files are invisible.
How to use
- 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
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 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 today
Windows only
- Software
Python 3 (3 point 8 or later)A unified diff of the change
Claude CodeorCodexorCursorGit
Node.js
- Optional
- Git on PATH for base ref diffsAllow file with your reasonsPatterns file for extra frameworksScope file with allowed paths
Scope file with allowed and protected globs. Scope file with allowed and protected globs.