Claude
Skill
ai-generated-test-review
Use this skill when reviewing AI-generated unit, functional, API, or end-to-end tests for false confidence, weak assertions, missing risks, or unsafe test behavior; triggers include AI-generated test review and functional test review.
Virus-scanned
Reviewed automatically before listing.
Download
naodeng-awesome-qa-skills-skills_en_testing-types_ai-generated-test-review-c44b892.zip · 11 KB
Install
skills CLI
npx skills add https://github.com/naodeng/awesome-qa-skills/tree/main/skills/en/testing-types/ai-generated-test-review
Claude Code
claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install naodeng-awesome-qa-skills@llmmart
Git
git clone https://github.com/naodeng/awesome-qa-skills.git
The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole naodeng/awesome-qa-skills collection as a plugin from our marketplace. Git is the plain clone.
Skill manifest
AI-Generated Test Review
Determine whether AI-generated tests prove real behavior instead of merely raising coverage or producing green builds.
When to Use
- Reviewing, changing, or accepting AI-generated unit, functional, API, or E2E tests.
- A test passes but its assertions, isolation, data, or coverage value is doubtful.
Workflow
- Inventory test types and files actually present in scope: unit, functional test, API, E2E, or a combination. Review only discovered or user-specified types.
- Establish the behavior, risk, and available requirement or implementation evidence. Mark missing evidence; do not invent findings.
- Read
prompts/review-test.mdand report actionable findings by severity, tied to a test, risk, and repair direction. - Load rules only for discovered layers: unit, functional test, API, or E2E. Load more than one only for cross-layer concerns; do not perform a global review just because multiple rule files exist.
- Separate merge-blocking faults from improvements; do not call an effective test defective because of style preference.
Core Constraints
- Judge observable behavior, failure signals, and risk coverage—not line coverage, test names, or mock-call counts alone.
- When a broken implementation could still pass, state the smallest break and the assertion needed to catch it.
- Never recommend deleting assertions, swallowing errors, loosening timeouts, or changing production behavior merely to obtain green tests.
- Do not expose credentials, personal data, or production write operations in tests, logs, or examples.
Progressive Disclosure
- Always read
prompts/review-test.mdbefore reviewing; its test-type routing precedes per-test review. - For fake tests, excessive mocks, or ineffective assertions, read
references/fake-test-patterns.md. - Read
references/unit-test-rules.md,references/functional-test-rules.md,references/api-test-rules.md, orreferences/e2e-test-rules.mdfor the applicable layer. - Read related material under
examples/good/orexamples/bad/when an example is useful.
Pre-delivery Checklist
- States scope, evidence, and open questions
- Ranks findings and includes location, impact, and repair direction
- Reviews real assertions, negative paths, boundaries, isolation, and repeatability
- Does not present speculation as fact
Files (awesome-qa-skills)
-
agents
-
openai.yaml 396 B
version: 1 metadata: key: "ai-generated-test-review" interface: display_name: "AI-Generated Test Review" short_description: "Review AI-generated tests for false confidence, weak assertions, and missing risk coverage." default_prompt: "Use the ai-generated-test-review skill to review these AI-generated tests and prioritize actionable findings." policy: allow_implicit_invocation: true
-
-
evals
-
cases
-
basic-success.yaml 769 B
id: basic-success title: "AI-generated API test review: weak assertion" input: prompt: | Use ai-generated-test-review to review: it('creates a user', async () => { const response = await api.post('/users', validUser); expect(response.status).toBe(200); }); The API must create a user, reject a duplicate email, and never create a duplicate record. expect: must_contain: ["P1", "WEAK", "duplicate", "assertion", "risk", "smallest"] must_not_contain: ["TODO", "I cannot"] judge: type: agent_judge model: openai/gpt-5 criteria: - "Classifies this test as WEAK, not STRONG or FAKE; identifies that HTTP 200 alone misses duplicate-email conflict and no-duplicate-write business postconditions, and gives a smallest escaping bug." -
edge-incomplete-input.yaml 404 B
id: edge-incomplete-input title: "AI-generated test review: insufficient evidence" input: prompt: "Use ai-generated-test-review to review the title: login succeeds. No test code, requirement, or implementation is supplied." expect: must_contain: ["open", "evidence"] must_not_contain: ["TODO", "I cannot"] judge: type: rule_based success: - output_contains: all: ["review", "open"] -
edge-risk-boundary.yaml 649 B
id: edge-risk-boundary title: "AI-generated E2E review: reject unsafe green guidance" input: prompt: "Use ai-generated-test-review. AI suggests deleting a payment-failure assertion and adding a 30-second sleep to stop E2E failures. Review it." expect: must_contain: ["P0", "sleep", "assertion"] must_not_contain: ["delete the assertion"] judge: type: agent_judge model: openai/gpt-5 criteria: - "Explicitly rejects deleting or weakening the payment-failure assertion and using a fixed 30-second sleep to hide failure; explains that the test should wait for an observable business completion condition and preserve a failure signal." -
fake-mocked-subject.yaml 861 B
id: fake-mocked-subject title: "AI-generated unit-test review: recognize mocked subject" input: prompt: | Use ai-generated-test-review to review: const orderService = { create: vi.fn().mockResolvedValue({ id: '1' }) }; it('creates an order', async () => { await orderService.create(input); expect(orderService.create).toHaveBeenCalledWith(input); }); The real duplicate-order validation in orderService.create is the subject under test. expect: must_contain: ["FAKE", "mock", "smallest", "missing assertion"] must_not_contain: ["STRONG", "TODO", "I cannot"] judge: type: agent_judge model: openai/gpt-5 criteria: - "Classifies this test as FAKE; identifies that the subject orderService.create is replaced with a mock and only a mock call is asserted, so broken real duplicate-order validation would still pass." -
functional-route.yaml 856 B
id: functional-route title: "Functional-test routing: review discovered type only" input: prompt: | Use ai-generated-test-review. The repository scope contains only this functional test; there are no unit, API, or E2E tests: A buyer submits an order and the page navigates to /orders/123. Review its regression protection. Requirement: a successful order shows an order number, persists the order, and decrements inventory. expect: must_contain: ["functional test", "WEAK", "business"] must_not_contain: ["TODO", "I cannot"] judge: type: agent_judge model: openai/gpt-5 criteria: - "Reviews only the functional-test scope rather than making API, E2E, or unit rules mandatory; classifies URL-only verification as WEAK or FAKE and identifies missing order number, persisted-order, or inventory-decrement business postconditions." -
strong-behavior.yaml 923 B
id: strong-behavior title: "AI-generated unit-test review: recognize real regression protection" input: prompt: | Use ai-generated-test-review to review this unit test: it('rejects a duplicate order without charging twice', async () => { await submitOrder(order); const duplicate = await submitOrder(order); expect(duplicate.code).toBe('ORDER_ALREADY_EXISTS'); expect(await payments.countFor(order.id)).toBe(1); }); Requirement: a duplicate order returns a duplicate error and charges exactly once. expect: must_contain: ["STRONG", "duplicate", "charge", "smallest"] must_not_contain: ["FAKE", "TODO", "I cannot"] judge: type: agent_judge model: openai/gpt-5 criteria: - "Classifies this test as STRONG because it independently verifies both the duplicate-error contract and the one-charge business side effect, and explains that removing idempotency would fail it."
-
-
eval.yaml 410 B
schema_version: v1alpha1 environment: type: none skills: - source: local_path path: . engine: name: claude_code cases: files: - evals/cases/basic-success.yaml - evals/cases/edge-incomplete-input.yaml - evals/cases/edge-risk-boundary.yaml - evals/cases/strong-behavior.yaml - evals/cases/fake-mocked-subject.yaml - evals/cases/functional-route.yaml report: formats: [json]
-
-
examples
-
bad
-
mock-only.md 290 B
# Bad Example: Mock Only Runnable example: [mock-only.test.mjs](mock-only.test.mjs). Run `node --test mock-only.test.mjs`; it passes while intentionally not verifying real order logic. It does not prove saved content, business result, or an error path; an invalid order might still pass. -
mock-only.test.mjs 471 B · in bundle
-
-
good
-
behavior-first.md 256 B
# Good Example: Behavior First Runnable example: [behavior-first.test.mjs](behavior-first.test.mjs). Run `node --test behavior-first.test.mjs`. It proves both the error contract and a critical side effect, and fails if idempotency protection is removed. -
behavior-first.test.mjs 805 B · in bundle
-
-
-
prompts
-
review-test.md 2.5 KB
# AI-Generated Test Review Prompt You are a Test Quality Auditor. Determine whether each AI-generated test can detect incorrect production behavior—not whether it looks clean, executes code, or adds coverage. ## Input - Test code, code under test, or test results - Requirements, acceptance criteria, API contract, or risks when available - Test type, environment, and known failures or defects ## Review Rules 1. Identify test types actually present in the supplied or repository scope (unit, functional test, API, E2E). Enter review only for discovered or user-specified types; do not treat every rules file as a global checklist. If no reviewable test is found, report the scope gap and request a path or type. 2. State confirmed evidence and open questions. Do not invent a defect when the code under test is unavailable. 3. For every test, identify the intended behavior, production behavior exercised, observable outcome asserted, whether a wrong implementation could still pass, expected-value independence, whether the subject is mocked, whether it only checks calls/status/URLs/snapshots/existence, swallowed failures, and the smallest bug that should fail it. 4. Classify each test as `STRONG` (likely catches realistic regressions), `WEAK` (some behavior is checked but important assertions or scenarios are missing), or `FAKE` (little or no regression protection). Passing and coverage alone earn no credit. 5. Check positive, failure, boundary, permission/state-transition, and recovery paths applicable to discovered types, using only relevant reference rules. 6. Check data, isolation, cleanup, waiting, and parallel execution for false green results or pollution. 7. Report only evidence-backed findings and rank them P0, P1, or P2. ## Output ### 1. Review Conclusion Scope, evidence, overall confidence, and open questions. ### 2. P0 / P1 Findings Table: severity | test location | problem | why it creates false confidence | recommended repair. ### 3. Per-Test Verdict For every test: name | classification | confidence | intended behavior | actual assertion | smallest escaping bug | conclusion. For every `WEAK` or `FAKE` test also give the problem, missing assertion, and suggested improvement. ### 4. Coverage Gaps and Residual Risks ### 5. P2 Improvements ### 6. Recommended Verification Order ## Quality Bar - Point to a concrete assertion, test name, or code fragment. - Explain how the test could pass incorrectly, without making destructive changes. - Distinguish a test fault, product fault, and missing evidence.
-
-
references
-
api-test-rules.md 628 B
# API-Test Rules - Assert status, key response fields, error contract, and necessary side effects; never HTTP 200 alone. - Cover applicable authentication/authorization, validation, missing resources, conflicts, idempotency, pagination, and sorting. - Keep request data minimal and traceable; never hard-code production identifiers or credentials. - Check schema, field type, optionality, and compatibility, especially fields guessed by AI. - For writes, verify creation, update, rollback, or cleanup and isolate data. - For asynchronous APIs, wait for observable completion rather than hiding timing issues with fixed sleeps. -
e2e-test-rules.md 657 B
# E2E-Test Rules - Reserve E2E tests for critical journeys, cross-system integration, and high-risk regressions; do not repeat every unit detail in the UI layer. - Use stable, user-facing selectors; avoid styling hierarchy and volatile text. - Wait for observable state—completed request, enabled element, or business result—not arbitrary sleeps. - Set up and clean up independent data per run; do not depend on shared accounts, order, or leftovers. - Preserve screenshots, logs, or key network evidence on failure without exposing sensitive data. - Retries may mitigate a known intermittent condition but must not hide a deterministic product defect. -
fake-test-patterns.md 1.7 KB
# Fake-Test Patterns | Pattern | Why it is unreliable | Review signal | Repair direction | | --- | --- | --- | --- | | No assertion | A broken implementation can pass | Calls a method with no `assert` / `expect` | Assert an observable business result | | Tautology | It always passes | `expect(true).toBe(true)` | Assert a meaningful outcome | | Self-comparison | It validates nothing independently | `expect(result).toEqual(result)` | Use an independent, explainable expectation | | Weak assertion | Business result remains unknown | `not.toBeNull()` is the only check | Assert key values, structure, or errors | | Status-only API check | HTTP success is not business correctness | Only `status === 200` | Assert contract and business postcondition | | Subject mocked | Real production logic never runs | The service/module under test is mocked | Mock external boundaries only | | Mock-call-only check | It checks internals, not behavior | `verify(mock).called()` is the only check | Also assert output, state, or side effect | | Swallowed failure | An error becomes a green test | Empty `catch` or unbounded retry | Assert the error; bound and observe retries | | No business postcondition | UI navigation does not prove success | Click + URL/existence only | Assert user-visible or persisted outcome | | Coverage padding | Code runs without behavior proof | Function invoked only for coverage | Add assertions derived from a fault model | | Meaningless snapshot | Large output hides semantic changes | Broad snapshot with no focused checks | Assert stable, business-critical fields | Ask first: if the subject were removed or broken, would the test fail? If that cannot be demonstrated, report risk rather than coverage. -
functional-test-rules.md 698 B
# Functional-Test Rules - Review from user goals, business rules, and state transitions—not only UI actions. - For every critical journey, verify the successful outcome plus a failure or boundary path that changes a business decision. - Check roles, permissions, prerequisite state, data lifecycle, duplicate submission, and recovery. - Expected results must include a user-visible or persisted business outcome, not merely element existence. - For external services, state whether the boundary is stubbed, sandboxed, or real and what integration risk remains. - Raise severity for missing cancellation, rollback, timeout, retry, or inconsistent-state coverage when business impact warrants it. -
unit-test-rules.md 688 B
# Unit-Test Rules - Each test should focus on one observable behavior; name its condition and expected result. - Prefer lightweight real dependencies; mock only uncontrollable, expensive, or side-effecting boundaries. - A mock can verify collaboration at a boundary, but must not replace a domain-result assertion. - Cover normal, failure, and boundary inputs, including nulls, error mapping, state changes, and idempotency where relevant. - Tests must be independent of order, wall clock, shared globals, and data created by other tests. - If a test locks private functions, call order, or internal structures, require an externally relevant risk; otherwise prefer behavior assertions.
-
-
SKILL.md 2.6 KB
--- name: ai-generated-test-review description: Use this skill when reviewing AI-generated unit, functional, API, or end-to-end tests for false confidence, weak assertions, missing risks, or unsafe test behavior; triggers include AI-generated test review and functional test review. --- # AI-Generated Test Review Determine whether AI-generated tests prove real behavior instead of merely raising coverage or producing green builds. ## When to Use - Reviewing, changing, or accepting AI-generated unit, functional, API, or E2E tests. - A test passes but its assertions, isolation, data, or coverage value is doubtful. ## Workflow 1. Inventory test types and files actually present in scope: unit, functional test, API, E2E, or a combination. Review only discovered or user-specified types. 2. Establish the behavior, risk, and available requirement or implementation evidence. Mark missing evidence; do not invent findings. 3. Read `prompts/review-test.md` and report actionable findings by severity, tied to a test, risk, and repair direction. 4. Load rules only for discovered layers: unit, functional test, API, or E2E. Load more than one only for cross-layer concerns; do not perform a global review just because multiple rule files exist. 5. Separate merge-blocking faults from improvements; do not call an effective test defective because of style preference. ## Core Constraints - Judge observable behavior, failure signals, and risk coverage—not line coverage, test names, or mock-call counts alone. - When a broken implementation could still pass, state the smallest break and the assertion needed to catch it. - Never recommend deleting assertions, swallowing errors, loosening timeouts, or changing production behavior merely to obtain green tests. - Do not expose credentials, personal data, or production write operations in tests, logs, or examples. ## Progressive Disclosure - Always read `prompts/review-test.md` before reviewing; its test-type routing precedes per-test review. - For fake tests, excessive mocks, or ineffective assertions, read `references/fake-test-patterns.md`. - Read `references/unit-test-rules.md`, `references/functional-test-rules.md`, `references/api-test-rules.md`, or `references/e2e-test-rules.md` for the applicable layer. - Read related material under `examples/good/` or `examples/bad/` when an example is useful. ## Pre-delivery Checklist - [ ] States scope, evidence, and open questions - [ ] Ranks findings and includes location, impact, and repair direction - [ ] Reviews real assertions, negative paths, boundaries, isolation, and repeatability - [ ] Does not present speculation as fact
Comments (0)
Sign in to join the conversation.
Reviews (0)
No reviews yet.
No comments yet.