testing-anti-patterns

Review test changes for mock assertions and test-only production methods.

Updated May 15, 2026
One-click install
npx skills add https://github.com/JBonfim/skill-developer --skill testing-anti-patterns-jbonfim
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing-anti-patterns
Source: https://github.com/JBonfim/skill-developer/tree/main/.agents/skills/testing-anti-patterns
Command: npx skills add https://github.com/JBonfim/skill-developer --skill testing-anti-patterns-jbonfim

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Prevents developers from writing brittle or misleading tests that validate mocks instead of actual behavior, and from contaminating production code with test-only methods.

Core Features & Use Cases

  • Iron-law guidance: Enforces rules like never asserting mock existence, never adding test-only methods to production classes, and never mocking without understanding dependencies.
  • Anti-pattern breakdowns: Explains common mistakes—testing mock behavior, mock-related side effects being broken, incomplete mock data, and treating integration tests as optional.
  • Decision gate checks: Provides before-assertion and before-mocking prompts to decide whether to unmock, mock at a lower level, or use real dependencies.

Quick Start

Ask your AI assistant to review a proposed test change and identify which anti-pattern(s) it might introduce, then rewrite the test to validate real behavior without mock assertions.

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 my test suite from validating mock behavior instead of real application logic?

To stop tests validating mock behavior, apply anti-pattern gates that prohibit asserting on mock elements and require understanding real side effects before mocking. This ensures your test suite validates actual application logic rather than fragile mock interactions.

What are the most common testing anti-patterns when introducing mocks?

Common testing anti-patterns include asserting on mock existence, adding test-only methods to production code, mocking without understanding dependencies, and providing incomplete mock data that fails to mirror real response schemas.

How do I decide between unit test isolation and integration test realism?

Decide between unit isolation and integration realism by using decision gate checks before mocking. Evaluate whether to unmock, mock at a lower level, or use real dependencies across UI and service layers to maintain valid side effects.

Should I add test-only utility methods to production classes for easier mocking?

Never add test-only utility methods to production classes. Contaminating production code with test-only methods is an anti-pattern that breaks dependency-driven side effects and compromises actual behavior validation.

How do I review a test change to ensure it validates real behavior?

Review a test change by identifying which anti-patterns it might introduce, then rewrite the test to validate real behavior. Ensure mocks mirror complete response schemas and avoid asserting on mock elements directly.