testing-patterns

A guide to planning and maintaining automated tests in different programming languages. It includes TDD, a method of writing a failing test before the code and then improving the implementation.

In plain words
What is it for?
Writing unit, integration, and end-to-end tests; organizing test cases; using test doubles; handling flaky tests in continuous integration; and testing Python or JavaScript/TypeScript code.
Why use it?
It helps keep tests useful, fast, and reliable while showing which kinds of tests belong at different levels of an application.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/svngoku/coding-agents-skills/testing-patterns
Any agent
npx skills add svngoku/coding-agents-skills --skill testing-patterns
Clone the repo
git clone --depth 1 https://github.com/svngoku/coding-agents-skills

Made for: Claude Code, Codex.

Per session 184 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,819 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00184 $0.02819
Opus 5 $0.00092 $0.01409
Sonnet 5 $0.00037 $0.00564
Haiku 4.5 $0.00018 $0.00282

Measured 2d ago against content hash 0bba2c368e82, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

testing-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 2d ago.

The scan reads SKILL.md. This mod also ships 2 executable files (fixtures/orders.py, graders/check.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

skills/testing-patterns/SKILL.md · 298 lines

How it starts

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

Testing Patterns

Automated tests are how a codebase stays safe to change. This language-agnostic skill tells you what to test, where each test belongs, and how to keep the suite fast and reliable — with worked examples in Python (pytest, Hypothesis, factory_boy, testcontainers) and JavaScript/TypeScript (Vitest, Jest, fast-check, Playwright).

Quick Reference

Task Reference
pytest fixtures & parametrization, factory_boy, Hypothesis, coverage.py, mutmut python-testing.md
Vitest/Jest mocking, fast-check, Playwright config & selectors, testcontainers-node js-ts-testing.md
CI parallelization, flaky-test triage, rerun policies, quarantine flaky-tests-ci.md

Test Pyramid

Many fast, isolated unit tests at the bottom; fewer slower integration tests in the middle; a handful of slow, brittle end-to-end tests at the top.

Layer Scope Speed Typical count Catches
Unit one function/class ms hundreds+ logic errors, edge cases
Integration modules + real deps (DB, cache, APIs) s dozens schema/contract mismatches, wiring
E2E whole system via UI/API min tens broken journeys, config/deploy

Map each feature to the lowest layer that can catch its failure:

Feature                Layer        Tool
price calculation      unit         pytest / vitest
order persistence      integration  pytest + testcontainers Postgres
guest checkout         e2e          Playwright

When the pyramid is wrong

  • Testing trophy (Kent C. Dodds): front-end apps should be integration-heavy — render components with real hooks/context, assert on user-visible behavior. Reserve e2e for critical journeys.
  • Contract tests: at service-to-service boundaries, test the API contract once per side (consumer-driven contracts) instead of full-stack e2e flows.

Read the full file on GitHub · 298 lines

Files

What ships with it

9 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 2d ago First seen · 298 lines · 184 tokens per session scan A 0bba2c368e82

Subscribe to this mod's changes

testing-patterns is a skill published in the GitHub repository svngoku/coding-agents-skills (9 stars, last pushed 20d ago), licensed MIT. It adds 184 tokens to every session and 2,819 once invoked, about $0.0009 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.