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-code

Installs 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

More from amelnagdy/guard-skills

All 5
1forcedotcom avatargenerating-apex-testforcedotcom/sf-skillsGenerate and validate Apex test classes with TestDataFactory patterns, bulk testing (251+ records), mocking strategies, assertion best practices, and discipline4.2Kskills.sh installs
2dotnet avatartest-smell-detectiondotnet/skillsDeep-dive audit using the full testsmells.org 19-smell academic catalog for tests in any language. Every finding maps to a named, citable smell from the researc4.1Kskills.sh installs
3dotnet avatartest-taggingdotnet/skillsAnalyzes test suites in any language and tags each test with standardized traits (positive, negative, critical-path, boundary, smoke, regression, integration, p4Kskills.sh installs
4giuseppe-trisciuoglio avatarlangchain4j-testing-strategiesgiuseppe-trisciuoglio/developer-kitProvides unit test, integration test, and mock AI patterns for LangChain4j applications. Creates mock LLM responses, tests retrieval chains, validates RAG workf3.8Kskills.sh installs
5langgenius avatarfrontend-testinglanggenius/difyUse when writing or changing Vitest or React Testing Library tests under `web/` or `packages/dify-ui/`, or when the user explicitly requests frontend test strat3.8Kskills.sh installs
6forcedotcom avatartesting-agentforceforcedotcom/sf-skillsWrite, run, and analyze structured test suites for Agentforce agents. TRIGGER when: user writes or modifies test spec YAML (AiEvaluationDefinition); runs sf age3.6Kskills.sh installs