testing-anti-patterns

Detect testing anti-patterns in mock assertions and test-only production methods.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/withmartian-sandbox/ghrc-x-3126672651424eddb640ecc81321a665 --skill testing-anti-patterns-withmartian-sandbox
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: testing-anti-patterns
Source: https://github.com/withmartian-sandbox/ghrc-x-3126672651424eddb640ecc81321a665/tree/main/default/skills/testing-anti-patterns
Command: npx skills add https://github.com/withmartian-sandbox/ghrc-x-3126672651424eddb640ecc81321a665 --skill testing-anti-patterns-withmartian-sandbox

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Tests that assert mock existence, introduce test-only production methods, or mock dependencies without understanding them produce fragile, misleading, or unsafe test suites; this Skill helps reviewers and developers identify and correct those anti-patterns to keep production code and tests meaningful and maintainable.

Core Features & Use Cases

  • Detect mock-focused assertions: Flags tests that assert mock elements instead of real behavior and suggests asserting on real components or roles.
  • Prevent test-only production methods: Identifies methods used solely by tests and recommends moving them to test utilities to avoid production pollution.
  • Guide safe mocking: Provides gates to evaluate side effects, completeness of mock data structures, and when to prefer integration tests over complex mocks.
  • Use Case: During a code review, run this Skill to find assertions targeting "*-mock" test IDs, locate methods only referenced in tests, and highlight mocks that omit required fields from real API responses.

Quick Start

Run a testing anti-pattern review on the modified test files and report assertions that depend on mocks, test-only production methods, or incomplete mock structures.

Frequently Asked Questions about testing-anti-patterns

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

FAQPage Schema
How do I detect unit testing anti-patterns where assertions target mocks instead of real behavior?▼

Unit testing anti-patterns are detected by flagging assertions that depend on mock elements, such as test IDs ending in "-mock", and suggesting that tests assert on real components or roles instead to prevent validating mock existence rather than actual system behavior.

Why does adding test-only methods to production code cause maintainability issues?▼

Test-only methods in production code cause maintainability issues by polluting the production API with logic used solely by tests. Identifying these methods and moving them to dedicated test utilities keeps production code clean and prevents unnecessary public surface area expansion.

What is the best way to handle complex mocks that omit required fields from real API responses?▼

The best way to handle complex mocks omitting required fields is to evaluate mock completeness against real data structures and recommend integration tests. Applying gates during test reviews ensures mocks accurately reflect dependencies or are replaced by appropriate integration tests.

When should I prefer integration tests over complex unit test mocks?▼

You should prefer integration tests over complex unit test mocks when mocks become overly complex or omit required fields from real API responses. Recommending integration tests in these scenarios ensures that tests validate actual side effects and dependency interactions accurately and safely.

Can I use TDD workflows to prevent unsafe mock usage and flawed test structures?▼

You can use TDD workflows to prevent unsafe mock usage by applying gates that check mock completeness, evaluate side effects, and suggest moving test-only logic to test utilities. This applies during test authoring, mocking decisions, and test modifications to maintain meaningful test suites.