test-guard
Review generated or changed test code against universal testing rules before it ships. Best used reactively after an agent writes, edits, generates, or refactors tests, before presenting, committing, or merging them. Use for pytest (test_*.py, *_test.py), PHPUnit/Pest (*Test.php), Jest/Vitest (*.test.ts, *.spec.js), Go (*_test.go), files under tests/, __tests__/, or spec/, and review requests like 'write tests for X', 'add tests', 'test this', 'review these tests', or PR diffs containing tests. Can also guide test writing when explicitly invoked before the work. This skill is the quality gate
npx skills add amElnagdy/guard-skills --skill test-guard --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# 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: 1. Check the project's own agent instructions (CLAUDE.md, AGENTS.md) and testing docs. Project-specific testing rules win over this skill when they conflict. 2. Identify the test stack, then
- When this skill activates
- Adapt to the project first
- What to do
- The Nine Rules
- Rule 1: Test behavior, not implementation
- Rule 2: Every mock must be justified
- Rule 3: One scenario per test, data-driven for variants
- Rule 4: Every test must justify its existence
- Rule 5: Name tests for the scenario
- Rule 6: Production regression tests are sacred
- Rule 7: No tests for framework guarantees
- Rule 8: State and value objects are real, never mocked
- Rule 9: Infrastructure under test gets real infrastructure
- Reporting format
What does the test-guard skill do?
Review generated or changed test code against universal testing rules before it ships. Best used reactively after an agent writes, edits, generates, or refactors tests, before presenting, committing, or merging them. Use for pytest (test_*.py, *_test.py), PHPUnit/Pest (*Test.php), Jest/Vitest (*.test.ts, *.spec.js), Go (*_test.go), files under tests/, __tests__/, or spec/, and review requests like 'write tests for X', 'add tests', 'test this', 'review these tests', or PR diffs containing tests. Can also guide test writing when explicitly invoked before the work. This skill is the quality gate
How do I install it?
Run `npx skills add amElnagdy/guard-skills --skill test-guard --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From amElnagdy/guard-skills, a repository with 1,138 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
