testing-anti-patterns

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

Updated Jan 19, 2026
One-click install
npx skills add https://github.com/KanuToCL/SonoTag --skill testing-anti-patterns-kanutocl
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing-anti-patterns
Source: https://github.com/KanuToCL/SonoTag/tree/main/.claude/skills/testing-anti-patterns
Command: npx skills add https://github.com/KanuToCL/SonoTag --skill testing-anti-patterns-kanutocl

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps developers avoid common mistakes when writing tests, ensuring that tests verify actual behavior rather than mock implementations, and preventing the pollution of production code with test-specific methods.

Core Features & Use Cases

  • Mock Behavior Prevention: Guides users to test real component behavior instead of just verifying mock existence.
  • Production Code Purity: Discourages adding test-only methods to production classes, promoting cleaner code.
  • Informed Mocking: Emphasizes understanding dependencies before mocking to prevent tests from breaking due to incorrect mock configurations.
  • Use Case: When writing tests for a new feature, this skill ensures you're not just testing that your mock API client returns a specific JSON, but that your application correctly handles the data from a real (or realistically mocked) API response.

Quick Start

Use the testing-anti-patterns skill to review your test suite and identify any assertions made directly on mock objects.

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 testing mock behavior instead of actual system behavior?

Testing mock behavior instead of actual system behavior happens when assertions verify mock interactions rather than real component outputs. You must enforce TDD principles to ensure tests validate actual application behavior and maintain code integrity.

Should I add test-only methods to production code to make mocking easier?

Adding test-only methods to production code pollutes classes and breaks code integrity. You should prevent this anti-pattern by designing testable production code through dependency injection rather than exposing test-specific internal methods.

Why do my mocks keep breaking when I refactor my code?

Mocks break during refactoring when dependencies are mocked without understanding them. Informed mocking requires understanding dependency contracts before mocking to prevent tests from failing due to incorrect mock configurations.

What is the best way to write tests for a new feature without testing mock implementations?

The best way to write tests for new features is to verify your application correctly handles realistic data instead of just checking that a mock API client returns specific JSON. This ensures tests validate actual system behavior.

When should integration tests be written during the development process?

Integration tests should not be treated as an afterthought. Enforcing TDD principles ensures integration tests are planned during development to verify actual system behavior rather than being retrofitted later.