testing-patterns

testing-patterns is a skill for Claude Code, Codex from vladolaru/claude-code-plugins. It costs 42 tokens per session (1,495 once invoked), scanned A, original, MIT.

A language-independent guide to writing reliable tests that check what software does from a user's point of view. It covers test structure, common test problems, mocking decisions, and coverage.

In plain words
What is it for?
Use it to design, review, and improve tests in any programming language. It is useful for deciding what to test, how to organize tests, and when to use mocks.
Why use it?
It helps prevent tests from breaking during harmless code changes by focusing on observable results rather than internal implementation details. It also helps identify flaky or overly fragile tests.

Skill for Claude CodeCodex

Part of the pirategoat-tools plugin — 22 skills shipped together

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/vladolaru/claude-code-plugins/testing-patterns
Any agent
npx skills add vladolaru/claude-code-plugins --skill testing-patterns
Clone the repo
git clone --depth 1 https://github.com/vladolaru/claude-code-plugins

Made for: Claude Code, Codex.

Or install pirategoat-tools, the plugin that ships this one along with the rest of its 22 skills.

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/vladolaru/claude-code-plugins/testing-patterns.svg)](https://agentmods.dev/skills/vladolaru/claude-code-plugins/testing-patterns)
Your own site
<a href="https://agentmods.dev/skills/vladolaru/claude-code-plugins/testing-patterns"><img src="https://agentmods.dev/badge/skills/vladolaru/claude-code-plugins/testing-patterns.svg" alt="Measured on agentmods" height="20"></a>
Per session 42 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,495 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.00042 $0.01495
Opus 5 $0.00021 $0.00747
Sonnet 5 $0.00008 $0.00299
Haiku 4.5 $0.00004 $0.00150

Measured yesterday against content hash e3dd163fcb2a, 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 yesterday.

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.

plugins/pirategoat-tools/skills/testing-patterns/SKILL.md · 108 lines

How it starts

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

Skill Directory

Resolve SKILL_DIR to the absolute directory containing this SKILL.md, as shown by the current host, before using any bundled path below. Before a shell command uses $SKILL_DIR, assign it in that command or replace it with the resolved path. It is not a host-exported environment variable.

Testing Patterns

Apply these language-agnostic test quality principles when writing or reviewing tests. Diagnose test smells. Enforce behavior-first testing. Route to language-specific skills for framework details.

RULE 0: Test Behavior, Not Implementation

Every test must verify observable outcomes (return values, side effects, exceptions) — never internal method calls, execution order, or implementation structure. Tests that break during behavior-preserving refactors are testing the wrong thing.

When this rule conflicts with other guidance in this skill, this rule wins.

When to Use This Skill

Use for language-agnostic test quality: philosophy, smells, structure, mocking strategies, coverage decisions, test data.

Before applying patterns: Read 2-3 existing tests in the project to identify established conventions (naming, structure, assertion style, fixture approach). Align your suggestions with the codebase's existing patterns unless they violate RULE 0.

Delegate to language-specific skills for framework details:

  • php-testing-patterns — PHPUnit, WordPress, WooCommerce
  • js-testing-patterns — Jest, Vitest, React Testing Library
  • e2e-testing-patterns — Playwright, Page Object Model
  • go-testing-patterns — Go testing, table-driven tests, httptest
  • rust-testing-patterns — built-in framework, mockall, proptest
  • python-testing-patterns — pytest, hypothesis, factory_boy

Do not use for TDD workflow (separate skill).

Reference Routing

When you find a test concern, read ONLY the specified sections. Do NOT read full files.

Test Concern Reference File Sections to Read
Tests pass but don't verify behavior $SKILL_DIR/references/test-philosophy.md ## Quick Reference + ## The Behavior vs Implementation Distinction
Flaky tests (random pass/fail) - usually an implementation bug, not a test bug $SKILL_DIR/references/test-smells.md ## Quick Reference + ### 1. Flaky Tests
Brittle tests (break on refactor) $SKILL_DIR/references/test-smells.md ## Quick Reference + ### 2. Brittle Tests
Over-mocking / mock confusion $SKILL_DIR/references/mocking-strategies.md ## Quick Reference + ## The Mocking Decision Framework
Poor structure (no AAA, bad names) $SKILL_DIR/references/test-structure.md ## Quick Reference + ## The AAA Pattern
Missing edge/error case coverage $SKILL_DIR/references/coverage.md ## Quick Reference + ## What to Test
Over-testing trivial code $SKILL_DIR/references/coverage.md ## Quick Reference + ## What NOT to Test
Test data strategy $SKILL_DIR/references/test-data.md ## Quick Reference + ## Factories
Choosing test layer (unit/integration/system) $SKILL_DIR/references/test-layers.md ## Quick Reference + ## Choosing the Right Layer
Independence/determinism/speed/readability issues $SKILL_DIR/references/test-philosophy.md ## Quick Reference + relevant pillar section
"Why should we test this?" - stakeholder justification $SKILL_DIR/references/test-benefits.md ## Quick Reference
TDD red-green-refactor questions $SKILL_DIR/references/tdd-workflow.md ## Quick Reference + ## The Red-Green-Refactor Cycle

Read the full file on GitHub · 108 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. yesterday First seen · 108 lines · 42 tokens per session scan A e3dd163fcb2a

Subscribe to this mod's changes

testing-patterns is a skill published in the GitHub repository vladolaru/claude-code-plugins (8 stars, last pushed yesterday), licensed MIT. It adds 42 tokens to every session and 1,495 once invoked, about $0.0002 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.

Related

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.

obra/superpowers · 37 tokens

auto-perf-optimize

Run agent-driven VS Code performance or memory investigations. Use when asked to launch Code OSS, automate a VS Code scenario, run the Chat memory smoke runner, capture renderer heap snapshots, take workflow screenshots, compare run summaries, or drive a repeatable scenario before heap-snapshot analysis.

microsoft/vscode · 62 tokens

chat-perf

Run chat perf benchmarks and memory leak checks against the local dev build or any published VS Code version. Use when investigating chat rendering regressions, validating perf-sensitive changes to chat UI, or checking for memory leaks in the chat response pipeline.

microsoft/vscode · 51 tokens

chat-pet-sprite-creation

Use when creating or changing VS Code chat pet sprite art, sprite sheets, state animations, eye treatments, Stable/Insiders variants, or pet transitions under src/vs/workbench/contrib/chat/browser/widget/media/chatPet.

microsoft/vscode · 53 tokens

cpu-profile-analysis

Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…

microsoft/vscode · 71 tokens