test-patterns

test-patterns is a skill for Claude Code, Codex from rohitg00/skillkit. It costs 138 tokens per session (1,668 once invoked), scanned A, original, Apache-2.0.

A guide to common ways of structuring software tests, such as Arrange-Act-Assert, test fixtures, parameterized tests, spies, and test doubles. These patterns describe how to prepare a test, run the code, and check the result clearly.

In plain words
What is it for?
Use it when writing or improving unit tests, integration tests, end-to-end tests, feature specifications, repeated test cases, or tests with external dependencies.
Why use it?
It helps make tests easier to read, maintain, and trust as setup becomes more complex. It also maps patterns to unit, integration, end-to-end, and behaviour-focused tests.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when writing or improving unit tests, integration tests, end-to-end tests, feature specifications, repeated test cases, or tests with external dependencies.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/rohitg00/skillkit/test-patterns
About the project

SkillKit is a package manager for AI coding-agent skills that installs skills from many sources and translates them between the different formats used by coding agents. It helps developers share skills across agents such as Claude Code, Cursor, Copilot, and Codex.

rohitg00/skillkit · 1,555 stars · on GitHub · skillkit.sh

Install

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.

Any agent
npx skills add rohitg00/skillkit --skill test-patterns
Clone the repo
git clone --depth 1 https://github.com/rohitg00/skillkit

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 test-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/rohitg00/skillkit/test-patterns/github.svg)](https://agentmods.dev/skills/rohitg00/skillkit/test-patterns)
Your own site
<a href="https://agentmods.dev/skills/rohitg00/skillkit/test-patterns"><img src="https://agentmods.dev/badge/skills/rohitg00/skillkit/test-patterns/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 test-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/rohitg00/skillkit/test-patterns"><img src="https://agentmods.dev/badge/skills/rohitg00/skillkit/test-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 138 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,668 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 pass 7 Sept 2026
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.00138 $0.01668
Opus 5.5 $0.00055 $0.00667
Sonnet 5.5 $0.00028 $0.00334
Haiku 4.5 $0.00014 $0.00167

Measured 1mo ago against content hash b47d6eaa1420, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

test-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 1mo 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.

packages/core/src/methodology/packs/testing/test-patterns/SKILL.md · 269 lines

How it starts

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

Test Patterns

You are applying proven testing patterns to write maintainable, reliable tests. These patterns help ensure tests are readable, focused, and trustworthy.

Pattern Selection Guide

Use this to choose the right pattern for your situation:

  • Structuring a single test? → Arrange-Act-Assert (AAA) or Given-When-Then
  • Writing behavior/feature specs? → Given-When-Then (BDD style)
  • Repeating test setup data? → Test Data Builders
  • Many variations of complex objects? → Object Mother
  • Testing same logic with many inputs? → Parameterized Tests
  • Shared setup/teardown across tests? → Test Fixtures
  • Verifying a dependency was called? → Spy
  • Replacing an external dependency? → Test Doubles (Stub / Mock / Fake)

Pattern Combination Workflows

Patterns rarely stand alone — here's how to combine them for common scenarios:

Unit tests (isolated logic): Fixtures for setup → AAA structure → Stubs/Mocks for dependencies → Parameterized Tests for multiple input cases

Integration tests (service + external dependencies): Fixtures for setup → AAA structure → Fakes for external services (e.g. in-memory DB) → Spies to verify interaction points

BDD / feature specs: Given-When-Then → Object Mother or Test Data Builders for scenario data → Fakes for infrastructure

High-variation logic (validators, calculators, formatters): Parameterized Tests → Test Data Builders to construct each case → AAA structure within each case


Core Pattern: Arrange-Act-Assert (AAA)

Structure every test with three distinct phases:

// Arrange - Set up test data and dependencies
const user = createTestUser({ role: 'admin' });
const service = new UserService(mockRepository);

// Act - Execute the code under test
const result = await service.updateRole(user.id, 'member');

// Assert - Verify the expected outcome
expect(result.role).toBe('member');
expect(mockRepository.save).toHaveBeenCalledWith(user);

Guidelines:

  • Keep sections visually separated (blank lines or comments)
  • Arrange should be minimal - only what's needed for this test
  • Act should be a single operation
  • Assert should verify one logical concept

Read the full file on GitHub · 269 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. 1mo ago First seen · 269 lines · 138 tokens per session scan A b47d6eaa1420

Subscribe to this mod's changes

test-patterns is a skill published in the GitHub repository rohitg00/skillkit (1,555 stars, last pushed 4mo ago), licensed Apache-2.0. It adds 138 tokens to every session and 1,668 once invoked, about $0.0006 per session on Opus 5.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.

Related

Other skills, from other repositories

pytest-expert

Pytest fixtures, parametrize, mock/monkeypatch, async testing with pytest-asyncio, and coverage reporting.

Blazkojj/skillhub · 29 tokens

am-agent-test-engineer

QA engineer specialized in test strategy, test writing, and coverage analysis. Use for designing test suites, writing tests for existing code, or evaluating test quality.

sampleXbro/agentsmesh · 37 tokens

fix-bug

Investigates and fixes a reported bug. Reads relevant code, identifies the root cause, proposes a fix, and adds or updates tests to prevent regression. Invoked when the user describes unexpected behavior, an error, a crash, or a failing test.

soulcodex/agentic · 54 tokens

sf-test

Generate comprehensive Apex test classes with @TestSetup methods, TestFactory patterns, bulk data (200 records), positive/negative/permission scenarios, and HttpCalloutMock implementations. Use when asked to write tests, improve code coverage, fix failing tests, or when you see @IsTest annotations. Activate on…

Clientell-Ai/salesforce-skills · 89 tokens

test-writing

Write tests that catch real regressions — behavior-focused, minimal mocking, edge cases chosen from the code's actual branches. Use when adding tests for new code or backfilling tests for a fix.

jnMetaCode/skillet · 43 tokens

code-review

AI-powered code review and PR analysis. Performs systematic reviews covering security vulnerabilities, code quality, style compliance, architectural integrity, test coverage, and performance considerations. Works with PR diffs, commit ranges, file changes, or raw code snippets. Primary keyword clusters: AI code review…

JPeetz/agent-skills · 137 tokens