testing-anti-patterns

Identify common testing anti-patterns in test suites during reviews.

Updated Dec 14, 2025
One-click install
npx skills add https://github.com/pproenca/dot-claude --skill testing-anti-patterns-pproenca
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing-anti-patterns
Source: https://github.com/pproenca/dot-claude/tree/main/plugins/super/skills/testing-anti-patterns
Command: npx skills add https://github.com/pproenca/dot-claude --skill testing-anti-patterns-pproenca

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Poorly written tests can give false confidence, test mock behavior instead of real code, or pollute production code, leading to unreliable test suites and missed bugs.

Core Features & Use Cases

  • Identify Mocking Issues: Prevents testing mock behavior and over-mocking that breaks test logic, ensuring tests verify real code.
  • Clean Production Code: Guides against adding test-only methods to production classes, maintaining code integrity.
  • Complete Mocks: Ensures mocks accurately reflect real API structures to prevent silent failures in integration.
  • Use Case: When reviewing a test suite or writing new tests, this skill helps you identify and correct common anti-patterns like incomplete mocks or testing mock internals, ensuring your tests are robust and reliable.

Quick Start

I'm writing a new test that uses mocks. Use the testing-anti-patterns skill to ensure I avoid common pitfalls.

Frequently Asked Questions about testing-anti-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I identify testing anti-patterns in my test suite?

Testing anti-patterns include mocking real behavior instead of verifying it, incomplete mocks that don't reflect actual APIs, and adding test-only methods to production code. Review test design to ensure mocks are complete, tests verify real code paths, and production remains clean.

What's the difference between testing mock behavior and testing real code?

Testing mock behavior verifies how your mock works, not whether your real code functions correctly. Effective tests verify real code by using mocks only to isolate external dependencies, ensuring tests catch actual bugs rather than passing falsely.

Why do incomplete mocks cause test failures?

Incomplete mocks don't mirror the real API structure, so tests pass in isolation but fail in production when code encounters missing methods or properties. Complete mocks prevent silent failures by accurately reflecting real dependencies.

Can I add test-only methods to production classes?

No. Adding test-only methods pollutes production code and masks design issues. Instead, refactor code to be testable through public APIs and use proper mocking to isolate external dependencies without modifying production classes.

How do mocking practices affect test reliability?

Over-mocking or poorly aligned mocks hide real failures and create false confidence in your test suite. Strict mocking practices—complete, accurate mocks used only for external dependencies—ensure tests reliably verify production behavior.

What are best practices for writing tests with mocks?

Follow TDD principles: mock only external dependencies, ensure mocks match real API signatures exactly, verify real code behavior not mock internals, and keep production code free of test-specific logic. This produces robust, maintainable tests.