Test Guard
Reviews AI-written tests against nine rules: mock boundaries, no duplicate or empty tests
Test report
- Verdict
- Tested · Works
- Score
- Tested
- Jul 21, 2026
- Environment
- Claude Code 2.x (agent harness)
- Upstream re-checked
- Aug 10, 2026 · aecdc7f
Cloned the repo into a temp HOME and confirmed the copy lands SKILL.md at ~/.claude/skills/test-guard/SKILL.md; frontmatter parses with name+description (815 chars), and all four files the body links (references/pytest.md, jest.md, phpunit.md, llm-app-testing.md) returned HTTP 200; no curl|sh, base64, or credential-touching text anywhere. Task: I wrote a 30-line Python pricing module plus a deliberately AI-flavored 9-test pytest file (MagicMock standing in for the Cart dataclass, @patch on the private _tax_rate, assert_called_once on log.info), then produced a baseline review with no skill and a second review following SKILL.md and references/pytest.md. The baseline caught the parametrize duplication, weak naming and missing arithmetic assertions, but never noticed the mocked dataclass and called test_cart_dataclass_sets_attributes "low value but harmless; keeping it costs nothing"; the skill review flagged that same test as a Rule 4 delete, flagged the MagicMock Cart as Rule 8 across three tests, and cut 9 tests to 4 with a "do not merge" verdict and a rewritten suite whose expected totals (119.00 DE, 107.10 with a 10% code) I verified by running the module. Trigger phrasings — should fire: "I just wrote tests for the payment module, review them before I commit", "Add unit tests for src/parser.ts covering the malformed-input path", "Here's a PR diff touching tests/test_orders.py, anything wrong with these tests?"; should not fire: "My pytest suite fails with a fixture ScopeMismatch error, help me debug it", "Review this refactor of the OrderService class" — 5/5, the description's explicit DO NOT USE clause routes both negatives away cleanly.
Scored on four weighted criteria — install, triggering, output vs. baseline, docs. How scoring works
- Installs cleanly 5/5
- Triggers reliably 5/5
- Output vs. baseline 8/10
- Docs & honesty 5/5
What Test Guard does
Test Guard is a review pass for test code an agent just wrote or changed, applying nine rules: mock only at system boundaries, never mock dataclasses or state objects, parametrize near-duplicate tests, delete tests that catch nothing, name tests for the scenario, and keep production regression tests. It loads a stack-specific reference for pytest, Jest/Vitest, PHPUnit/Pest, or LLM applications, then reports violations as rule number plus location, cause, and fix. Triggers on requests to write, add, or review tests, and on diffs touching test_*.py, *Test.php, *.test.ts, *_test.go, or files under tests/ and __tests__/.
How to install Test Guard
git clone --depth 1 https://github.com/amElnagdy/guard-skills.git /tmp/test-guard-src
mkdir -p ~/.claude/skills
cp -R /tmp/test-guard-src/skills/test-guard ~/.claude/skills/test-guard
# No dependencies, no API keys, no scripts — SKILL.md plus 4 markdown references.
# The repo also ships clean-code-guard, docs-guard, wp-guard, woo-guard in /tmp/test-guard-src/skills/.
# CLI alternative (installs a copy, same result): npx skills add amElnagdy/guard-skills --skill test-guard
# Usage: after your agent writes tests, say "Use test-guard on the tests you just wrote."
Skills live in ~/.claude/skills/ (global) or .claude/skills/
(per-project). Restart Claude Code after installing.
Commands — how to trigger Test Guard
-
/test-guardReviews AI-written tests against nine rules: mock boundaries, no duplicate or empty tests
It also activates on plain-language prompts like these:
-
Review these tests before I commit them -
Write tests for this new function -
Check this test file for common testing mistakes
Frequently asked questions
- Is the Test Guard skill free?
- Yes. The skill itself is free from amElnagdy/guard-skills. SkillProof publishes the install command and an independent test verdict at no cost.
- Does Test Guard work with Claude Code?
- We tested it with Claude Code 2.x (agent harness) on Jul 21, 2026. Verdict: Tested · Works. Cloned the repo into a temp HOME and confirmed the copy lands SKILL.md at ~/.claude/skills/test-guard/SKILL.md; frontmatter parses with name+description (815 chars), and all four files the body links (references/pytest.md, jest.md, phpunit.md, llm-app-testing.md) returned HTTP 200; no curl|sh, base64, or credential-touching text anywhere. Task: I wrote a 30-line Python pricing module plus a deliberately AI-flavored 9-test pytest file (MagicMock standing in for the Cart dataclass, @patch on the private _tax_rate, assert_called_once on log.info), then produced a baseline review with no skill and a second review following SKILL.md and references/pytest.md. The baseline caught the parametrize duplication, weak naming and missing arithmetic assertions, but never noticed the mocked dataclass and called test_cart_dataclass_sets_attributes "low value but harmless; keeping it costs nothing"; the skill review flagged that same test as a Rule 4 delete, flagged the MagicMock Cart as Rule 8 across three tests, and cut 9 tests to 4 with a "do not merge" verdict and a rewritten suite whose expected totals (119.00 DE, 107.10 with a 10% code) I verified by running the module. Trigger phrasings — should fire: "I just wrote tests for the payment module, review them before I commit", "Add unit tests for src/parser.ts covering the malformed-input path", "Here's a PR diff touching tests/test_orders.py, anything wrong with these tests?"; should not fire: "My pytest suite fails with a fixture ScopeMismatch error, help me debug it", "Review this refactor of the OrderService class" — 5/5, the description's explicit DO NOT USE clause routes both negatives away cleanly.
- What is the Test Guard SkillProof Score?
- 9.2/10 — installs cleanly 5/5, triggers reliably 5/5, output vs. baseline 8/10, docs & honesty 5/5.
- How do I install Test Guard?
- Copy the install command from this page, run it in your terminal, and restart Claude Code. Skills live in ~/.claude/skills/ (global) or .claude/skills/ inside a project.
- Can I use Test Guard with Cursor, Copilot, Gemini CLI, Codex or other AI tools?
- The SKILL.md format is native to Claude (Claude Code, Desktop, claude.ai). The instructions inside adapt to other assistants: Cursor rules, GitHub Copilot instructions, Windsurf rules, Custom GPTs, AGENTS.md for OpenAI Codex, and GEMINI.md for Google Gemini CLI — our conversion guides cover each, and the free converter on the tools page does the wrapping for you.