testing-anti-patterns

Identify and prevent testing anti-patterns in unit and integration tests.

Updated Nov 14, 2025
One-click install
npx skills add https://github.com/Donaldshen27/xtrend-vanilla --skill testing-anti-patterns-donaldshen27
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing-anti-patterns
Source: https://github.com/Donaldshen27/xtrend-vanilla/tree/main/.claude/skills/testing-anti-patterns
Command: npx skills add https://github.com/Donaldshen27/xtrend-vanilla --skill testing-anti-patterns-donaldshen27

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Tests often verify the behavior of mocks rather than real code, causing brittle tests and production pollution with test-only constructs. This skill helps teams enforce testing real behavior and avoid anti-patterns.

Core Features & Use Cases

  • Identify and eliminate patterns that test mock behavior instead of real functionality.
  • Promote adherence to TDD, ensuring tests fail when real code changes without corresponding tests.
  • Provide guidance for refactoring tests to remove test-only methods and reduce dependency on mocks.

Quick Start

Review your test suites to identify and remove mocks that simulate real behavior and replace them with real interactions.

Frequently Asked Questions about testing-anti-patterns

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

FAQPage Schema
Why are my unit tests brittle when I use mocks to validate behavior?

Testing mocks instead of real code creates brittle tests that fail to catch production issues. This skill identifies and eliminates these anti-patterns by enforcing strict TDD practices and promoting real interactions over mock behavior validation.

How do I remove test-only methods from production code?

To remove test-only methods from production code, review your test suites to identify mocks simulating real behavior, then replace them with real interactions. This skill guides refactoring tests to eliminate test-only constructs and reduce dependency on mocks.

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

Common testing anti-patterns include verifying mock behavior instead of real code, introducing test-only production constructs, and incomplete mocking. This skill prevents these patterns by enforcing strict TDD practices and proper dependency understanding.

How do I enforce strict TDD practices in an existing test suite?

Enforce strict TDD by ensuring tests fail when real code changes lack corresponding test updates. This skill prohibits testing mock behavior and forbids test-only production code to maintain robust tests and production safety.

When should I avoid using mocks in unit testing?

Avoid using mocks when they simulate real behavior rather than verifying actual code interactions, leading to brittle tests. This skill guides refactoring to reduce mock dependency and replace simulated behavior with real interactions.