testing-anti-patterns

testing-anti-patterns is a skill for Claude Code from bobmatnyc/claude-mpm-skills. It costs 41 tokens per session (1,950 once invoked), scanned A, original, MIT.

A set of rules for writing reliable software tests, especially when using mocks. Mocks are stand-ins for real dependencies, such as a database or service.

In plain words
What is it for?
It helps review tests, decide when mocking is appropriate, and find incomplete or overly complicated test setups.
Why use it?
It prevents tests from passing merely because a fake object was configured to pass, and avoids adding code to production only to help tests.

Skill for Claude Code

Written for Claude Code: disable-model-invocation in frontmatter.

Good fit It helps review tests, decide when mocking is appropriate, and find incomplete or overly complicated test setups.

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

Made for: Claude Code.

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

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/bobmatnyc/claude-mpm-skills/testing-anti-patterns"><img src="https://agentmods.dev/badge/skills/bobmatnyc/claude-mpm-skills/testing-anti-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 41 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,950 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.00041 $0.01950
Opus 5 $0.00020 $0.00975
Sonnet 5 $0.00008 $0.00390
Haiku 4.5 $0.00004 $0.00195

Measured 7d ago against content hash e30fb0928dff, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

testing-anti-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 7d 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.

universal/testing/testing-anti-patterns/SKILL.md · 192 lines

How it starts

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

Testing Anti-Patterns

Overview

Tests must verify real behavior, not mock behavior. Mocks are a means to isolate, not the thing being tested.

Core principle: Test what the code does, not what the mocks do.

Following strict TDD prevents these anti-patterns. See the Test-Driven Development skill (available in the skill library) for the complete TDD workflow.

When to Use This Skill

Activate this skill when:

  • Writing or changing tests - Verify tests cover real behavior
  • Adding mocks - Ensure mocking is necessary and correct
  • Reviewing test failures - Check if mock behavior is the issue
  • Tempted to add test-only methods - STOP and reconsider
  • Tests feel overly complex - Sign of over-mocking

The Iron Laws

1. NEVER test mock behavior
2. NEVER add test-only methods to production classes
3. NEVER mock without understanding dependencies
4. NEVER create incomplete mocks
5. NEVER treat tests as afterthought

Core Anti-Pattern Categories

1. Testing Mock Behavior

Asserting on mock elements instead of real behavior. Fix: Test real component or don't mock it. core-anti-patterns.md

2. Test-Only Methods in Production

Methods in production classes only used by tests. Fix: Move to test utilities. core-anti-patterns.md

3. Mocking Without Understanding

Mocking without understanding dependencies/side effects. Fix: Understand first, mock minimally. core-anti-patterns.md

4. Incomplete Mocks

Partial mocks missing fields downstream code needs. Fix: Mirror complete API structure. completeness-anti-patterns.md

5. Tests as Afterthought

Implementation "complete" without tests. Fix: TDD - write test first. completeness-anti-patterns.md

Read the full file on GitHub · 192 lines

Files

What ships with it

6 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. 7d ago First seen · 192 lines · 41 tokens per session scan A e30fb0928dff

Subscribe to this mod's changes

testing-anti-patterns is a skill published in the GitHub repository bobmatnyc/claude-mpm-skills (74 stars, last pushed 1mo ago), licensed MIT. It adds 41 tokens to every session and 1,950 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

JavaScript Testing Patterns

Modern JavaScript testing strategies with Jest, Mocha, and testing best practices covering unit testing, integration testing, mocking, async patterns, and DOM testing.

PramodDutta/qaskills · 36 tokens

jest-expert

Expert in Jest unit testing framework, mocks, snapshots, coverage reports, watch mode, and custom matchers. Use when the user mentions testing, unit testing, JavaScript, QA, mocking, or snapshots, or when the task involves Jest Framework, Test Structure, Advanced Features, or Basic Unit Tests.

personamanagmentlayer/pcl · 65 tokens

Jest Mocking Patterns

Teaches the agent the right way to mock in Jest — jest.fn, mockImplementation, mockResolvedValue, jest.mock factories, spyOn with restore, and isolating modules like axios.

PramodDutta/qaskills · 44 tokens

CI Test Sharding Parallelization

Teach agents to shard and parallelize Playwright, Jest, and pytest suites in CI to reduce wall-clock time while merging reports reliably.

PramodDutta/qaskills · 34 tokens

frontmcp-testing

Use for anything about testing FrontMCP servers: writing or running unit, integration, and E2E tests and reaching the 95%+ coverage bar. Covers Jest setup and coverage gating; unit-testing a ToolContext execute() with mock context, inputs, and Zod schema validation; testing resources and prompts; in-memory testing via…

agentfront/frontmcp · 175 tokens

automacao-de-testes

Automação de testes: unitários (Jest, Pytest), integração (supertest, httpx) e E2E com Playwright. Inclui estratégia de pirâmide de testes, cobertura mínima, CI/CD integration e testes para contexto brasileiro (CPF, CNPJ, CEP, PIX).

ricneves-ai/flowgrammers-skills · 67 tokens