
Test Guard
This is a post-generation quality gate for AI-written tests. It enforces nine rules designed to prevent the most common failure modes when agents write tests: mock-heavy unit tests that assert implementation details, near-duplicate test bodies that differ by one value, and tests that re-verify the framework instead of your logic. It triggers after test code is written but before it gets committed, covering pytest, PHPUnit, Pest, Jest, Vitest, and Go test files. The rules are sharp, not pedantic. Mock only at system boundaries, never mock state objects, merge value variants into parametrized tests, and delete tests that only catch typos. Production regression tests are sacred and exempt from the justification rule. Stack-specific reference docs provide concrete patterns for each framework.
- skills.sh installs
- 4.3K
- GitHub stars
- 1.3K
- last updated
- Aug 21, 2026
Install
$ npx -y skills add amelnagdy/guard-skills --skill test-guard --agent claude-codeInstalls into .claude/skills of the current project.
Files
Test Guard
You are reviewing generated or changed test code before it ships. Enforce the rules below after the first test-writing pass and before the tests are presented, committed, or merged. Be a sharp reviewer, not a pedantic one: flag what wastes maintenance effort or hides real bugs, ignore cosmetic preferences.
These rules exist because coding agents over-generate tests. The common failure modes: mock-heavy unit tests that assert implementation details, near-duplicate test bodies that differ by one value, and tests that re-verify the framework instead of the project's logic. Each looks productive in a diff and costs maintenance forever.
When this skill activates
- A coding agent has just written new test functions or test files, in any language
- You are editing existing tests
- You are reviewing a diff that contains test changes
- The user asks you to write, add, or review tests
Adapt to the project first
These rules are universal, but their application is not. Before reviewing:
Sponsors
Details
- Repository
- github.com/amelnagdy/guard-skills
- Categories
- Testing & QA, Git & Pull Requests, Documentation, Code Review & Quality, AI & Agent Building, Debugging, Python, PHP & Laravel
- First seen
- Jun 11, 2026