testing-anti-patterns

Guide developers in preventing mocking and test-only method anti-patterns.

567|82|Updated Mar 15, 2026
One-click install
npx skills add https://github.com/pedronauck/skills --skill testing-anti-patterns-pedronauck
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing-anti-patterns
Source: https://github.com/pedronauck/skills/tree/main/skills/test-antipatterns
Command: npx skills add https://github.com/pedronauck/skills --skill testing-anti-patterns-pedronauck

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps developers write more effective and reliable tests by identifying and preventing common anti-patterns that lead to brittle, misleading, or unmaintainable test suites.

Core Features & Use Cases

  • Identify Mocking Issues: Prevents testing mock behavior, over-mocking, and incomplete mocks.
  • Production Code Integrity: Discourages adding test-only methods to production classes.
  • Test Strategy: Encourages treating tests as an integral part of implementation, not an afterthought.
  • Use Case: When writing tests for a new feature, use this Skill to ensure your mocks accurately reflect real dependencies and that your assertions target actual behavior, not just mock implementations.

Quick Start

Review the provided documentation to understand and avoid common testing anti-patterns.

Frequently Asked Questions about testing-anti-patterns

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

FAQPage Schema
What are common unit testing anti-patterns related to mocking?

Common mocking anti-patterns include testing mock behavior instead of real dependencies, over-mocking, and creating incomplete mocks. This Skill guides developers to prevent these issues and ensure mocks accurately reflect actual dependency behavior.

How do I stop polluting production code with test-only methods?

To stop polluting production code, avoid adding test-only methods to production classes. This Skill discourages the practice of injecting test utilities into production code, promoting separation of test logic and production implementation.

Why does my test suite break when I refactor code?

Test suites often break during refactoring due to brittle tests that assert on mock implementations rather than actual behavior. This Skill helps identify these anti-patterns so you can write robust tests that survive code refactoring.

What is the best way to write effective unit tests for new features?

The best way to write effective unit tests is treating tests as an integral part of implementation rather than an afterthought. This Skill helps ensure your assertions target actual behavior and that mocks accurately reflect real dependencies.

When should I avoid using mocks in my testing strategy?

You should avoid mocking when it leads to testing mock behavior rather than real dependency interactions, or when you lack sufficient understanding of the dependencies being mocked. This Skill guides you in identifying these constraint scenarios.