testing-patterns

testing-patterns is a skill for Claude Code, Codex from phuonghx/aim-cli. It costs 72 tokens per session (961 once invoked), scanned A, original, MIT.

A guide to organizing dependable test suites, covering unit tests for small pieces of logic, integration tests for connected parts, and end-to-end tests for complete user journeys.

In plain words
What is it for?
Use it when writing or reviewing tests, choosing between unit, integration, and end-to-end coverage, and arranging tests with the arrange-act-assert pattern.
Why use it?
It helps choose the right test size and avoid suites that are slow, unclear, or fragile. It also gives patterns for setup, action, checking results, test naming, mocks, and test data.

Skill for Claude CodeCodex

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

Good fit Use it when writing or reviewing tests, choosing between unit, integration, and end-to-end coverage, and arranging tests with the arrange-act-assert pattern.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/phuonghx/aim-cli/testing-patterns
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 phuonghx/aim-cli --skill testing-patterns
Clone the repo
git clone --depth 1 https://github.com/phuonghx/aim-cli

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/phuonghx/aim-cli/testing-patterns.svg)](https://agentmods.dev/skills/phuonghx/aim-cli/testing-patterns)
Your own site
<a href="https://agentmods.dev/skills/phuonghx/aim-cli/testing-patterns"><img src="https://agentmods.dev/badge/skills/phuonghx/aim-cli/testing-patterns.svg" alt="Measured on agentmods" height="20"></a>
Per session 72 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 961 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.
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.00072 $0.00961
Opus 5 $0.00036 $0.00481
Sonnet 5 $0.00014 $0.00192
Haiku 4.5 $0.00007 $0.00096

Measured 3d ago against content hash 558a314f62da, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, 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 3d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/test_runner.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.

aim/templates/aim-agents/skills/testing-patterns/SKILL.md · 137 lines

How it starts

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

Testing Patterns

Reliable tests describe behavior clearly and fail for one understandable reason.


The test pyramid

Lots of fast, narrow tests at the bottom; a few slow, broad ones at the top.

        /\          End-to-end (a few)
       /  \         critical journeys only
      /----\
     /      \       Integration (some)
    /--------\      APIs, DB queries, service seams
   /          \
  /------------\    Unit (many)
                    functions and classes

Arrange, Act, Assert

Every test reads in three beats:

  • Arrange -- set up the data and preconditions.
  • Act -- run the one thing under test.
  • Assert -- check the result against expectations.

Choosing a test type

  • Unit -- pure logic and functions; runs in milliseconds; lots of them.
  • Integration -- how pieces talk to each other (API, database, services); moderate speed; a meaningful number.
  • End-to-end -- complete user journeys through the real stack; slow; reserved for what truly matters.

Unit tests

What makes a good one

  • Quick -- well under ~100ms each.
  • Self-contained -- no network, disk, or shared state.
  • Deterministic -- identical result on every run.
  • Self-verifying -- asserts the outcome; no eyeballing.
  • Written alongside the code, not bolted on later.

Where to aim them

Cover business rules, edge cases, and error paths. Don't bother testing framework internals, third-party libraries, or trivial accessors.


Integration tests

What to exercise

  • API endpoints -- request in, response out.
  • Database access -- queries and transactional behavior.
  • External services -- the contract at the boundary.

Lifecycle hooks

  • Before all -- open shared resources (connections, containers).
  • Before each -- reset to a known state.
  • After each -- tidy up what the test created.
  • After all -- release the shared resources.

Mocking

Mock the edges, not the subject

Replace external APIs, networks, clocks, and randomness so tests stay deterministic. Mock the database in unit tests but use a real one for integration. Never mock the very thing you are testing, and skip mocking trivial pure functions or in-memory stores.

Read the full file on GitHub · 137 lines

Files

What ships with it

1 file 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. 3d ago First seen · 137 lines · 72 tokens per session scan A 558a314f62da

Subscribe to this mod's changes

testing-patterns is a skill published in the GitHub repository phuonghx/aim-cli (1 stars, last pushed 2mo ago), licensed MIT. It adds 72 tokens to every session and 961 once invoked, about $0.0004 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-09-03.