Skip to content
bobmatnyc avatar

Testing Anti Patterns

Authoritative guide for avoiding testing anti-patterns, covering mock misuse, test-only production code, and incomplete mocks.

CCM score
61 of 100
skills.sh installs
398
GitHub stars
79
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers five anti-pattern categories: testing mock behavior, test-only production methods, uninformed mocking, incomplete mocks, and tests written as an afterthought
  • Includes a language-agnostic detection checklist plus TypeScript/Jest and Python/pytest examples and red-flag patterns
  • Enforces a rule that test-only methods belong in test utilities, not production classes, and that mocks must mirror the complete API
  • Designed for writing or changing tests, adding mocks, and reviewing test failures during TDD work

Install

$ npx -y skills add bobmatnyc/claude-mpm-skills --skill 'Testing Anti-Patterns' -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

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

Details

Repository
github.com/bobmatnyc/claude-mpm-skills
Category
Testing & QA
First seen
Jun 3, 2026

Questions

What does the Testing Anti-Patterns skill do?

Testing Anti-Patterns teaches an agent to avoid common testing mistakes: never test mock behavior, never add test-only methods to production classes, and understand dependencies before mocking. It covers these principles with TypeScript/Jest and Python/pytest examples.

How do I install the Testing Anti-Patterns skill?

Run npx -y skills add bobmatnyc/claude-mpm-skills --skill 'Testing Anti-Patterns' -y in your project. Once installed, the agent applies these testing principles when it writes or changes tests and adds mocks.

When should an agent use the Testing Anti-Patterns skill?

Testing Anti-Patterns applies when writing or changing tests, adding mocks, reviewing test failures, or tempted to add test-only methods to production code. It also helps when tests feel overly complex, a sign of over-mocking.

Which test frameworks does Testing Anti-Patterns cover?

Testing Anti-Patterns gives examples for TypeScript with Jest and Python with pytest, and its principles are language-agnostic. Its Python reference covers unittest.mock and pytest-mock patterns.

More from bobmatnyc/claude-mpm-skills

All 154

Similar to Testing Anti Patterns

More Testing & QA