← ClaudeAtlas

ai-test-generation-patternslisted

Systematic patterns for prompting AI coding agents to generate high-quality tests including prompt engineering for test creation, coverage-driven generation, mutation-aware testing, and review checklists for AI-generated test code.
PramodDutta/qaskills · ★ 145 · Testing & QA · score 83
Install: claude install-skill PramodDutta/qaskills
# 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, upda