Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add skills/latestaiagents/agent-skills/test-generation-patternsnpx skills add latestaiagents/agent-skills --skill test-generation-patternsgit clone --depth 1 https://github.com/latestaiagents/agent-skillsWrote 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.
[](https://agentmods.dev/skills/latestaiagents/agent-skills/test-generation-patterns)<a href="https://agentmods.dev/skills/latestaiagents/agent-skills/test-generation-patterns"><img src="https://agentmods.dev/badge/skills/latestaiagents/agent-skills/test-generation-patterns.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00052 | $0.02374 |
| Opus 5 | $0.00026 | $0.01187 |
| Sonnet 5 | $0.00010 | $0.00475 |
| Haiku 4.5 | $0.00005 | $0.00237 |
Grade A, and why
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 6d 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.
How it starts
The opening of the file, as written. The whole thing — 392 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Test Generation Patterns
Generate comprehensive tests with AI assistance following 2026 best practices.
When to Use
- Adding tests to existing code
- Creating test suites for new features
- Improving test coverage
- Setting up testing patterns for a project
- Generating edge case tests
The Testing Pyramid (2026)
┌─────────┐
│ E2E │ Few, slow, high confidence
├─────────┤
│ Integr. │ Some, medium speed
├─────────┤
│ Unit │ Many, fast, isolated
└─────────┘
Unit Test Generation
Step 1: Identify Test Cases
For any function, test:
- Happy path - Normal expected input
- Edge cases - Boundaries, empty, null
- Error cases - Invalid input, failures
- State changes - If function has side effects
AI Prompt Template
Generate comprehensive unit tests for this function:
```[paste function]```
Include tests for:
1. Happy path with typical inputs
2. Edge cases (empty, null, boundary values)
3. Error handling
4. Any state changes or side effects
Use [Vitest/Jest/pytest] with [testing-library if applicable].
Follow AAA pattern (Arrange, Act, Assert).
Example: Testing a Utility Function
Code to test:
function parseAmount(input: string): number | null {
if (!input || typeof input !== 'string') return null;
const cleaned = input.replace(/[$,]/g, '').trim();
const num = parseFloat(cleaned);
return isNaN(num) ? null : Math.round(num * 100) / 100;
}
Generated tests:
import { describe, it, expect } from 'vitest';
import { parseAmount } from './parseAmount';
describe('parseAmount', () => {
describe('happy path', () => {
it('parses plain number', () => {
expect(parseAmount('123.45')).toBe(123.45);
});
it('parses number with dollar sign', () => {
expect(parseAmount('$99.99')).toBe(99.99);
});
it('parses number with commas', () => {
expect(parseAmount('1,234.56')).toBe(1234.56);
});
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.
- 6d ago First seen · 392 lines · 52 tokens per session scan A d82be0b645f8
test-generation-patterns is a skill published in the GitHub repository latestaiagents/agent-skills (5 stars, last pushed 4mo ago), licensed MIT. It adds 52 tokens to every session and 2,374 once invoked, about $0.0003 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-31.
Other skills, from other repositories
agent-tester
Agent skill for tester - invoke with $agent-tester.
moai-ref-testing-pyramid
Test pyramid strategy, coverage targets, test patterns, and quality metrics reference. Agent-extending skill that amplifies manager-develop test-creation and quality-validation work with production-grade testing patterns. NOT for: production code implementation, architecture design, DevOps, security audits.
test-automation
Execute Vitest and Playwright test suites with result collection and failure analysis.
agent-production-validator
Agent skill for production-validator - invoke with $agent-production-validator.
external-memory-plugin
Develop, adapt, review, test, and troubleshoot Nexent external memory provider plugins, including plugin.yaml manifests, searchable and ingestible provider protocols, error mapping, network-isolated unit tests, deployment configuration, and Mem0-based examples. Use when adding a new external memory vendor, changing an…
qa-testing
Generate and execute API and E2E tests with quality gate assessment.