testing-anti-patterns

Detect and remedy testing anti-patterns in unit and integration tests.

3|1|Updated Nov 5, 2025
One-click install
npx skills add https://github.com/carlopezzuto/agents --skill testing-anti-patterns-carlopezzuto
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing-anti-patterns
Source: https://github.com/carlopezzuto/agents/tree/main/.claude/skills/testing-anti-patterns
Command: npx skills add https://github.com/carlopezzuto/agents --skill testing-anti-patterns-carlopezzuto

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Tests can drift into anti-patterns that validate mocks, pollute production code with test-only methods, or rely on misunderstood dependencies. This Skill helps enforce confrontation of real behavior over mocked details and promotes a disciplined TDD approach.

Core Features & Use Cases

  • Detect and remedy common anti-patterns (mock behavior testing, test-only production code, incomplete mocks, over-mocking) to improve test reliability.
  • Promote TDD cycles with failing tests first, minimal production changes, and appropriate levels of mocking.
  • Provide concrete gate-logic recommendations to decide when to mock and what to mock, ensuring tests reflect real behavior.
  • Apply across unit and integration tests to guard against brittle tests.

Quick Start

Follow a TDD cycle: write a failing test for the intended behavior, implement just enough production code to pass, and use minimal, well-scoped mocks at the appropriate level.

Frequently Asked Questions about testing-anti-patterns

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

FAQPage Schema
How do I stop unit tests from validating mock behavior instead of real logic?

To stop unit tests from validating mock behavior, enforce guidelines that prevent mock behavior testing and ensure mocks mirror real data structures. This approach shifts focus back to validating actual system behavior rather than mocked implementation details.

What are common testing anti-patterns that degrade test quality?

Common testing anti-patterns include mock behavior testing, test-only production code, incomplete mocks, and over-mocking. These anti-patterns degrade test quality by creating brittle tests that validate mock details rather than real behavior.

How do I apply TDD cycles to avoid over-mocking during test development?

Apply TDD cycles by writing a failing test first, implementing minimal production code to pass, and using well-scoped mocks at the appropriate level. This disciplined approach prevents over-mocking by ensuring tests reflect real behavior.

When should I use mocks in integration testing versus unit testing?

Use mocks in integration testing and unit testing by following concrete gate-logic recommendations to decide when and what to mock. This ensures mocks are applied at appropriate levels to guard against brittle tests across both test types.

Why does test-only production code pollute my codebase and how do I remove it?

Test-only production code pollutes your codebase by adding methods solely for test access, which degrades test reliability. Remove this anti-pattern by enforcing guidelines that eliminate test-only production code and prevent misunderstood dependencies.