test-guard
यह क्या करती है
यह एजेंट टेस्ट कोड की समीक्षा करता है ताकि पक्का हो कि वह अच्छे तरीकों को मानता है। यह जाँचता है कि टेस्ट प्रोग्राम के व्यवहार पर ध्यान दें, एक जैसे टेस्ट न दोहराएँ, और ऐसी चीज़ों का टेस्ट न करें जिनकी गारंटी सिस्टम पहले से देता है।
कब इस्तेमाल करें
- ✓जब AI द्वारा बनाए गए नए टेस्ट कोड की समीक्षा करनी हो।
- ✓जब मौजूदा टेस्ट बदलने या रिफैक्टर करने हों।
- ✓जब ऐसे बदलावों का विश्लेषण करना हो जिनमें टेस्ट में बदलाव शामिल हों।
Skill का लिंक
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/test-guard/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“इन टेस्ट की समीक्षा करो और देखो कि ये क्वालिटी के नियमों का पालन करते हैं या नहीं।”
हर हफ़्ते 5 नई skills, 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.
…
अक्सर पूछे जाने वाले सवाल
'universal testing rules' क्या होते हैं?
ये टेस्ट लिखने के आम दिशानिर्देश हैं, जैसे प्रोग्राम के अंतिम नतीजे पर ध्यान देना न कि उसके अंदरूनी तरीके पर, और ऐसे टेस्ट न बनाना जो एक-दूसरे से बहुत मिलते-जुलते हों।
मैं अंदरूनी कोड की डिटेल का टेस्ट क्यों न करूँ?
अंदरूनी डिटेल (implementation) का टेस्ट करने से कोड बदलते ही टेस्ट आसानी से टूट जाते हैं, भले ही प्रोग्राम का आखिरी नतीजा वही रहे। इससे रखरखाव का काम बढ़ता है और कोई नया बग नहीं मिलता।
'mock' क्या है?
mock एक नकली ऑब्जेक्ट है जो टेस्टिंग में प्रोग्राम के दूसरे हिस्सों के व्यवहार की नकल करता है। यह एजेंट सुझाता है कि mock का इस्तेमाल सिर्फ सिस्टम की सीमाओं पर करें (जैसे नेटवर्क कॉल), न कि अपने कोड के अंदरूनी हिस्सों के लिए।
जानकारी
लेखक का मूल विवरण
Review generated or changed test code against universal testing rules before it ships or is presented for approval.
लोकप्रियता
- GitHub स्टार
- 48k
- रैंकिंग में स्थान
- #5971
- लाइसेंस
- MIT
- अपडेट की गई
- 15/10/2026
कमेंट
- …
इस repository की और skills
00-andruia-consultant
48kआपके एजेंट को AI प्रोजेक्ट शुरू करने या उन्हें बेहतर बनाने में मदद करता है। यह code का विश्लेषण करता है, tools सुझाता है और स्पेनिश भाषा में action plan बनाता है।
007
48kआपका एजेंट security audit और threat modeling करता है। यह प्रोजेक्ट को हमलों और कमजोरियों से बचाने में काम आता है।
10-andruia-skill-smith
48kआपके एजेंट को AI tools बनाने या उन्हें बेहतर करने में मदद करता है। यह तय करता है कि tools कैसे काम करेंगे, documentation लिखता है और structure की जांच करता है।
20-andruia-niche-intelligence
48kआपका एजेंट किसी खास industry का summary बनाता है। भरोसेमंद स्रोतों की मदद से यह प्रोजेक्ट का संदर्भ, नियम, इस्तेमाल के तरीके और जोखिम समझने में मदद करता है।
मिलती-जुलती skills
test-driven-development
311kयह आपके एजेंट को किसी भी फ़ीचर या सुधार से पहले पहले असफल होने वाला टेस्ट लिखना, उसे असफल होते देखना, फिर पास करने वाला सबसे छोटा कोड लिखना सिखाती है।
verification-before-completion
311kयह आपके एजेंट को किसी काम, सुधार या build के पूरा या पास होने का दावा करने से पहले असली जांच चलाकर उसका आउटपुट पढ़ना सिखाती है।
migrate-to-shoehorn
310kआपकी टेस्ट फ़ाइलों में जोखिम भरे type casts की जगह shoehorn लाइब्रेरी लगाती है, ताकि टेस्ट अधूरे डेटा से भी type checks पास कर सकें।