Skip to content

Repository files navigation

🔒 Agentic Tests

Lock down your code. Refactor without fear.

A suite of portable Agent Skills for Antigravity CLI, Codex, Claude Code, Cline, and Pi that turns any AI model—even small, cheap ones—into a disciplined test engineer. It generates unit tests that capture your code's current behavior, proves those tests actually hold with mutation testing, then lets you refactor at full speed with a safety net it never touches.

Your code stays yours. Your tests stay honest. Your coverage number finally means something.


Why this exists

Every AI coding agent can write tests. Almost none can be trusted with them:

  • 🙈 They "fix" your production code to make their tests pass
  • 🎭 They pad coverage with expect(true).toBe(true)
  • 🎲 They write flaky tests that pass today and lie tomorrow
  • 🧟 They mock useSelector and call it a React test

Agentic Tests is built around hard rules, not good intentions. Main code is read-only. User-written tests are read-only. Every generated test must survive a 3-run flakiness gate and a test-quality checklist. Coverage is measured on agent-generated tests alone — no credit borrowed from your existing suite.

What's inside

Six portable skills, one per job (authoritative sources under .agents/skills/). Ask your agent to “use the agentic-… skill.” Host shortcuts are optional.

Skill What it does
🏗️ agentic-unit-test Generates tests to hit your coverage goal (line/branch/function, per-file or overall)
🧬 agentic-mutation-check Mutation-tests the safety net — proves the tests catch real changes
agentic-refactor Refactors/optimizes main code; the frozen test suite is the referee
🔁 agentic-test-update Re-locks tests after intentional behavior changes — one confirmation per diff
📊 agentic-coverage-report Where do the agent tests stand? Read-only report
🧹 agentic-test-clean Remove every agent test (with confirmation)

30-second start

you:   Use the agentic-unit-test skill on src/pricing.ts with branch coverage,
       a 90% per-file goal.
cline: ✅ preconditions… 📊 baseline 0%… 📝 plan written… 🏗️ generating…
       ─────────────────────────────────────
       Goal: branch ≥ 90% per-file — MET (93.4%)
       Failures: none

Then make it bulletproof, and use it:

Use the agentic-mutation-check skill with an 85% goal.       ← prove the tests bite
Use the agentic-refactor skill on src/pricing.ts; make it faster. ← refactor with the net up

The guarantees

  1. Your code is never edited. Not to fix a test, not "just a little", never.
  2. Your tests are never edited. Agent tests live in clearly-named files (*.agentic.spec.ts, *AgenticTest.java, test_agentic_*.py, …) — everything else is read-only.
  3. The goal is met by agent tests alone, with assertion-quality rules and a flakiness gate that make gaming the number a rule violation, not a shortcut.

Interrupted mid-run? Every skill writes a crash-proof plan file and resumes exactly where it stopped.

Built for weaker models, great with strong ones

Every instruction is written so a small model can't wander: numbered steps with binary branches, fixed report formats, copy-paste templates for 9 languages, framework detection by file lookup, and a 3-attempt gate that reverts cleanly instead of thrashing. Recipes cover the classic weak-model tar pits — mocking time/network/filesystem, React + Redux (real store, never mock useSelector), React Router & Context (probe routes, never mock useNavigate), and async rendering.

Language support

Tests Coverage Mutation
TypeScript / JavaScript (Jest, Vitest) ✅ StrykerJS
Java (JUnit 5, Maven/Gradle) ✅ JaCoCo ✅ PIT
Groovy (Spock, Maven/Gradle) ✅ JaCoCo ✅ PIT
Python (pytest) ✅ coverage.py ✅ mutmut
Go (go test) go test -cover ✅ gremlins
Rust (cargo test) ✅ cargo-llvm-cov ✅ cargo-mutants
C / C++ (GoogleTest, CTest) ✅ gcov/llvm-cov

Install

Installation is agent-guided only — there are no install scripts. Paste this into your coding agent:

Fetch https://github.com/ghraw/jpbaking/agentic-tests/main/AGENT-INSTALL.md and follow its instructions exactly to install Agentic Tests. Merge with — never blindly overwrite — any existing files, and report every file you created or changed.

The agent acquires the sources itself (git clone, repo zip, or gh) and copies each skill from .agents/skills/ into your user-global skill directories: ~/.agents/skills/ (Codex and Pi), ~/.claude/skills/ (Claude Code), ~/.gemini/antigravity-cli/skills/ (Antigravity CLI), and ~/.cline/skills/ (Cline). Nothing is added to your repos: the only per-project footprint is the generated agent tests themselves, which are committed because they are the safety net. The install is per-user; teammates install for themselves. See Getting started for details.

Learn more

📚 User guideGetting started · Core concepts · Skill reference · The lock-down lifecycle · Troubleshooting & FAQ

About

Lock down your code, refactor without fear: behavior-locking unit tests, mutation checks, and frozen-suite refactoring as portable Agent Skills for any coding agent

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors