testing-anti-patterns

Detect testing anti-patterns that verify mocks instead of real behavior.

17|Updated Oct 13, 2025
One-click install
npx skills add https://github.com/cipherstash/cipherpowers --skill testing-anti-patterns-cipherstash
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing-anti-patterns
Source: https://github.com/cipherstash/cipherpowers/tree/main/plugin/skills/testing-anti-patterns
Command: npx skills add https://github.com/cipherstash/cipherpowers --skill testing-anti-patterns-cipherstash

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill prevents common testing mistakes that lead to fragile, misleading tests that pass for the wrong reasons and fail to catch real bugs.

Core Features & Use Cases

  • Anti-Pattern Detection: Identifies when you're testing mock behavior instead of real component behavior.
  • Code Quality Enforcement: Prevents pollution of production code with test-only methods and utilities.
  • Use Case: When your team is writing unit tests and tempted to add mocks, use this Skill to ensure tests verify actual functionality rather than mock implementations.

Quick Start

Ask the testing-anti-patterns skill to review this test code and identify any anti-patterns in the mocking strategy.

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 when my unit tests are verifying mock behavior instead of real code?

Testing anti-patterns occur when tests pass because mocks behave as expected, not because production code works correctly. Look for tests that only verify mock interactions without exercising actual component logic, dependencies, or lifecycle—these miss real bugs and fail to validate genuine behavior.

What's the best way to avoid adding test-only methods to production code?

Test-only methods pollute production code and signal weak test design. Instead, refactor to test through public APIs, use dependency injection for real dependencies, and write integration tests that exercise actual behavior paths. This keeps production code clean and tests honest.

Why do mocking strategies often create fragile, misleading tests?

Mocks decouple tests from real behavior, allowing tests to pass while production code fails. Over-mocking hides integration issues, API contract violations, and lifecycle problems. Anti-pattern detection prevents tests from becoming false positives that don't catch bugs in actual usage.

How do I write unit tests that verify actual functionality rather than mock implementations?

Replace mocks with real implementations where feasible, use test doubles sparingly for external dependencies only, and verify behavior end-to-end. Enforce production code quality gates that reject test-only changes and incomplete mocks, ensuring tests reflect how code actually runs.

Can I apply anti-pattern detection across unit, integration, and end-to-end tests?

Yes. Anti-pattern detection spans all test levels to curb mocking of production code, prevent test-only methods, and eliminate misleading mocks. Apply enforcement across your test suite to ensure consistency and catch behavioral gaps that unit-test-only mocking would miss.

What happens when tests pass but production code still fails in real scenarios?

This signals mocking anti-patterns: tests verify mock behavior instead of real behavior. Identify over-mocked dependencies, test-only production methods, and incomplete mocks. Restructure tests to exercise actual code paths, use real objects where safe, and gate functions that prevent mock-only validation.