AI Test Generation Patterns

AI Test Generation Patterns is a skill for Claude Code, Codex from PramodDutta/qaskills. It costs 43 tokens per session (5,749 once invoked), scanned A, original, MIT.

Guidance for asking an AI coding agent to create and review software tests. It covers using project context, finding missing coverage, checking test strength, and validating tests in small batches.

In plain words
What is it for?
Writing prompts for new tests, targeting coverage gaps, improving weak assertions, and reviewing AI-generated test code.
Why use it?
It helps avoid tests that merely look plausible, miss important code paths, or pass without checking the intended behavior.

Skill for Claude CodeCodex

Which agent this was written for is unclear — built for aider. Also seen: mentions Codex; built for aider; mentions Gemini CLI.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is import { TestQualityChecker, QualityReport } from '../review/quality-checker';.

Good fit Writing prompts for new tests, targeting coverage gaps, improving weak assertions, and reviewing AI-generated test code.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/PramodDutta/qaskills
agentmods
npx agentmods add skills/pramoddutta/qaskills/ai-test-generation

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for AI Test Generation Patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/pramoddutta/qaskills/ai-test-generation/github.svg)](https://agentmods.dev/skills/pramoddutta/qaskills/ai-test-generation)
Your own site
<a href="https://agentmods.dev/skills/pramoddutta/qaskills/ai-test-generation"><img src="https://agentmods.dev/badge/skills/pramoddutta/qaskills/ai-test-generation/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for AI Test Generation Patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/pramoddutta/qaskills/ai-test-generation"><img src="https://agentmods.dev/badge/skills/pramoddutta/qaskills/ai-test-generation.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 43 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 5,749 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 2 findings, up to high

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • high System Prompt Leakage · line 178
    Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.
    Fix: Remove any instructions that reveal, print, or output system prompts or internal rules. System instructions should never be exposed to end users.
  • high System Prompt Leakage · line 263
    Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.
    Fix: Remove any instructions that reveal, print, or output system prompts or internal rules. System instructions should never be exposed to end users.
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00043 $0.05749
Opus 5 $0.00022 $0.02874
Sonnet 5 $0.00009 $0.01150
Haiku 4.5 $0.00004 $0.00575

Measured 9d ago against content hash a8a44972d515, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

AI Test Generation Patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

seed-skills/ai-test-generation/SKILL.md · 638 lines

How it starts

The opening of the file, as written. The whole thing — 638 lines — stays where its author put it; the contents beside it link to each section on GitHub.

AI Test Generation Patterns Skill

You are an expert in using AI coding agents to generate high-quality test code. When the user asks you to generate tests using AI, create prompting strategies for test generation, build coverage-driven test pipelines, or review AI-generated test quality, follow these detailed instructions.

Core Principles

  1. Context-rich prompting -- Provide the AI agent with the source code under test, existing test patterns, project conventions, and expected behavior. More context produces better tests.
  2. Coverage-gap targeting -- Analyze existing coverage reports to identify untested paths, then prompt the AI specifically for those gaps rather than regenerating all tests.
  3. Pattern-based generation -- Establish test patterns (AAA, Given-When-Then) in your codebase first, then instruct the AI to follow those patterns for consistency.
  4. Incremental validation -- Generate tests in small batches, run them, verify they pass and fail correctly, then generate the next batch. Never generate an entire suite without validation.
  5. Mutation-aware testing -- Use mutation testing results to identify weak test assertions and prompt the AI to strengthen them with more specific checks.
  6. Human review gates -- Every AI-generated test must pass human review. AI excels at generating structure but can miss business logic nuances.
  7. Prompt versioning -- Version your generation prompts alongside your code. When test patterns change, update prompts accordingly.

Project Structure

test-generation/
  prompts/
    unit-test-prompt.md
    integration-test-prompt.md
    e2e-test-prompt.md
    api-test-prompt.md
    edge-case-prompt.md
  templates/
    vitest-unit.template.ts
    playwright-e2e.template.ts
    api-test.template.ts
  analyzers/
    coverage-analyzer.ts
    mutation-analyzer.ts
    complexity-analyzer.ts
  generators/
    prompt-builder.ts
    batch-generator.ts
    test-validator.ts
  review/
    quality-checker.ts
    anti-pattern-detector.ts
    assertion-strength-analyzer.ts
  config/
    generation-config.ts
    model-config.ts

Read the full file on GitHub · 638 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 638 lines · 43 tokens per session scan A a8a44972d515

Subscribe to this mod's changes

AI Test Generation Patterns is a skill published in the GitHub repository PramodDutta/qaskills (219 stars, last pushed 9d ago), licensed MIT. It adds 43 tokens to every session and 5,749 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.