testing-anti-patterns

Identify and prevent testing anti-patterns in codebases.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/withmartian-sandbox-darkside/ghrc-y-3126672651424eddb640ecc81321a665 --skill testing-anti-patterns-withmartian-sandbox-darkside
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing-anti-patterns
Source: https://github.com/withmartian-sandbox-darkside/ghrc-y-3126672651424eddb640ecc81321a665/tree/main/default/skills/testing-anti-patterns
Command: npx skills add https://github.com/withmartian-sandbox-darkside/ghrc-y-3126672651424eddb640ecc81321a665 --skill testing-anti-patterns-withmartian-sandbox-darkside

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Tests must verify real behavior and avoid mocking that pollutes production.

Core Features & Use Cases

  • Enforces testing best practices by avoiding mock-behavior assertions and ensuring tests exercise real code.
  • Guards production code by discouraging test-only methods and unclear dependencies, guiding refactors.
  • Use case: when a team discovers tests that assert on mocks rather than behavior, apply anti-pattern checks to improve reliability.

Quick Start

Audit a failing test, identify anti-patterns, and refactor one example to align with TDD practices.

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 test anti-patterns where mocks are asserting behavior instead of verifying real code?

Test anti-patterns happen when tests assert on mock behavior rather than verifying real code execution. You can identify them by auditing failing tests for mock-behavior assertions, test-only methods, and unclear dependencies, then refactoring to enforce clear separation between test utilities and production classes.

What's the best way to prevent test-only methods from creeping into production code?

Preventing test-only methods in production code requires enforcing clear separation between test utilities and production classes. Discourage adding test-only methods and unclear dependencies by applying anti-pattern checks during code reviews to guide refactors and maintain code quality.

Why does TDD help avoid mocking anti-patterns in my codebase?

TDD helps avoid mocking anti-patterns by ensuring tests exercise real code behavior rather than asserting on mocks. Enforcing TDD practices prevents mocks from polluting production code, improves test reliability, and guides refactors when unclear dependencies are discovered.

How do I refactor a failing test to align with TDD practices and remove mock dependencies?

To refactor a failing test for TDD alignment, audit the test to identify anti-patterns like mock-behavior assertions or test-only methods. Remove unclear dependencies and refactor the example to ensure tests exercise real code with complete mocks and clear separation from production classes.

When should I not use mocking in my unit tests?

You should not use mocking when it leads to asserting on mock behavior rather than verifying real code execution. Avoid mocking that pollutes production code with test-only methods or unclear dependencies, and refactor to enforce TDD practices with clear separation between test utilities and production classes.