test-guard
하는 일
이 에이전트는 테스트 코드가 모범 사례를 따르는지 검토합니다. 테스트가 프로그램의 동작에 집중하고, 중복을 피하며, 시스템이 이미 보장하는 기능을 테스트하지 않는지 확인합니다.
사용하는 경우
- ✓AI가 새로 생성한 테스트 코드를 검토할 때.
- ✓기존 테스트를 편집하거나 리팩터링할 때.
- ✓테스트 수정이 포함된 변경 사항 집합을 분석하는 경우.
스킬 링크
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/test-guard/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“이 테스트들이 품질 규칙을 따르는지 검토해 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
에이전트는 테스트 코드를 읽고 규칙 모음과 비교합니다. 규칙을 위반하는 부분을 지적하고 고치는 방법을 제안하며, 유지보수 어려움이나 실제 버그를 숨기는 문제에 집중합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
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 to Use
Use this skill when reviewing generated or changed test code before it ships. Activate it reactively after an agent writes, edits, generates, or refactors tests — unit tests, integration tests, e2e tests, or snapshot tests in any framework.
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:
- 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.
- Identify the test stack, then read the matching reference for concrete patterns:
- Python / pytest → references/pytest.md
- PHP / PHPUnit / Pest / WordPress → references/phpunit.md
- JavaScript / TypeScript / Jest / Vitest → references/jest.md
- If the project calls LLM APIs, uses agent frameworks, or wires up observability/telemetry, also read references/llm-app-testing.md — it adds three rules specific to LLM applications.
- Map the project's system boundaries: network calls, databases, filesystem, clock and randomness, third-party SDKs, LLM APIs. Existing fixtures and test helpers usually reveal where the project already draws these lines.
What to do
- Read the test code: the diff, the new file, or the section being modified.
- Check each test against the rules below.
- Report violations concisely: rule number, location, why it violates, suggested fix.
- If the user explicitly invokes this skill before test writing, apply the rules as you write — don't write violations and then flag them.
When writing new tests, ask for each test: "What specific bug does this catch that no other test in this suite catches?" If you can't answer clearly, don't write it.
The Nine Rules
Rule 1: Test behavior, not implementation
Test what code does from the caller's perspective. Assert return values and observable side effects. Never assert that an internal helper was called with specific arguments — that test breaks on every refactor while catching nothing.
Violation pattern: asserting a mock of an internal function was called, where that function is not a system boundary. Fix: assert the return value or the state change the caller observes.
Rule 2: Every mock must be justified
Mock only at system boundaries: network and HTTP calls, LLM APIs, databases, filesystem I/O on external files, clock and randomness, third-party SDKs. Never mock internal classes or helper functions to isolate a "unit" — the seams you create hide the integration bugs worth catching.
When you mock a boundary, assert what the caller does with the response, not that the mock received specific arguments.
Rule 3: One scenario per test, data-driven for variants
If two or more tests share identical setup and differ only in input/output values, merge them into one data-driven test (@pytest.mark.parametrize, PHPUnit #[DataProvider], Jest test.each).
When separate tests ARE correct: different setup, different assertions, different mock configurations, or genuinely different scenarios that happen to exercise the same function.
Rule 4: Every test must justify its existence
Ask: "What bug does this catch that no other test catches?" Delete tests that only catch typos, verify default values of data classes, or test trivial pass-through logic.
…
자주 묻는 질문
'범용 테스트 규칙'이란 무엇인가요?
효과적인 테스트를 작성하기 위한 일반 지침입니다. 예를 들어 내부 구현보다 프로그램의 최종 결과에 집중하고, 서로 지나치게 비슷한 테스트를 피하는 것입니다.
내부 코드의 세부 사항을 테스트하면 안 되는 이유는 무엇인가요?
내부 구현을 테스트하면 최종 결과는 그대로여도 코드를 수정할 때 테스트가 쉽게 깨집니다. 새로운 버그를 찾지도 못한 채 유지보수 부담만 늘어납니다.
'목(mock)'이란 무엇인가요?
테스트에서 프로그램의 다른 부분의 동작을 흉내 내는 가짜 객체입니다. 이 에이전트는 네트워크 호출처럼 시스템 경계에서만 목을 쓰고, 자신의 코드 내부 부분에는 쓰지 않을 것을 제안합니다.
상세 정보
작성자의 원본 설명
Review generated or changed test code against universal testing rules before it ships or is presented for approval.
인기도
- GitHub 스타
- 48k
- 순위
- #5971
- 라이선스
- MIT
- 업데이트
- 2026. 10. 15.
댓글
- …
이 저장소의 다른 스킬
00-andruia-consultant
48k에이전트가 AI 프로젝트를 시작하거나 개선할 수 있도록 코드를 분석하고 스페인어로 실행 계획을 세워 줍니다.
007
48k에이전트가 보안 감사와 위협 모델링을 수행해 공격과 취약점으로부터 프로젝트를 보호하도록 돕습니다.
10-andruia-skill-smith
48k에이전트가 AI 도구의 작동 방식을 정의하고 문서를 쓰며 구조를 검증하도록 돕습니다.
20-andruia-niche-intelligence
48k에이전트가 신뢰할 수 있는 자료를 바탕으로 특정 산업의 맥락, 규칙, 사용 패턴, 위험을 정리한 요약을 만들도록 돕습니다.
비슷한 스킬
test-driven-development
311k에이전트가 기능이나 수정을 만들기 전에 실패하는 테스트를 먼저 쓰고, 그것을 통과시키는 가장 작은 코드를 작성하도록 가르칩니다.
verification-before-completion
311k에이전트가 작업, 수정, 빌드가 완료되었거나 통과했다고 말하기 전에 실제 점검을 실행하고 결과를 읽도록 가르칩니다.
migrate-to-shoehorn
310k테스트 파일의 위험한 타입 캐스팅을 shoehorn 라이브러리로 바꿔, 테스트가 일부 데이터만 써도 타입 검사를 통과하도록 돕습니다.