eng-testing-anti-patterns

eng-testing-anti-patterns is a skill for Claude Code from tjboudreaux/cc-plugin-engineering-excellence. It costs 44 tokens per session (764 once invoked), scanned A, original, MIT.

A set of rules for avoiding common mistakes when writing software tests or using mocks, which are substitutes for real dependencies.

In plain words
What is it for?
Use it when adding or changing tests, deciding what to mock, checking integration coverage, or reviewing assertions about mocked components.
Why use it?
It keeps tests focused on actual product behavior instead of on the substitutes used during testing. It also prevents test helpers from unnecessarily changing production code.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the engineering-excellence plugin — 13 skills, 4 agents shipped together

Good fit Use it when adding or changing tests, deciding what to mock, checking integration coverage, or reviewing assertions about mocked components.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/tjboudreaux/cc-plugin-engineering-excellence/eng-testing-anti-patterns
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add tjboudreaux/cc-plugin-engineering-excellence --skill eng-testing-anti-patterns
Clone the repo
git clone --depth 1 https://github.com/tjboudreaux/cc-plugin-engineering-excellence

Made for: Claude Code.

Or install engineering-excellence, the plugin that ships this one along with the rest of its 13 skills, 4 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for eng-testing-anti-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/tjboudreaux/cc-plugin-engineering-excellence/eng-testing-anti-patterns/github.svg)](https://agentmods.dev/skills/tjboudreaux/cc-plugin-engineering-excellence/eng-testing-anti-patterns)
Your own site
<a href="https://agentmods.dev/skills/tjboudreaux/cc-plugin-engineering-excellence/eng-testing-anti-patterns"><img src="https://agentmods.dev/badge/skills/tjboudreaux/cc-plugin-engineering-excellence/eng-testing-anti-patterns/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for eng-testing-anti-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/tjboudreaux/cc-plugin-engineering-excellence/eng-testing-anti-patterns"><img src="https://agentmods.dev/badge/skills/tjboudreaux/cc-plugin-engineering-excellence/eng-testing-anti-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 44 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 764 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00044 $0.00764
Opus 5 $0.00022 $0.00382
Sonnet 5 $0.00009 $0.00153
Haiku 4.5 $0.00004 $0.00076

Measured 9d ago against content hash 49c2e0fcb521, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

eng-testing-anti-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/eng-testing-anti-patterns/SKILL.md · 77 lines

How it starts

The opening of the file, as written. The whole thing — 77 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Testing Anti-Patterns

Overview

Tests must validate real behavior, not mock behavior. Mocks are isolation tools; they are never the subject under test. Follow these guardrails whenever you touch tests or mocks.

Iron Laws

1. NEVER test mock behavior
2. NEVER add test-only methods to production classes
3. NEVER mock without understanding dependencies
4. NEVER ship incomplete mocks
5. NEVER treat integration tests as an afterthought

Anti-Pattern 1: Testing Mock Behavior

  • ❌ Example: asserting getByTestId('sidebar-mock') exists after mocking <Sidebar/>.
  • Why wrong: proves mock works, says nothing about component.
  • ✅ Fix: test the real component (or mock only for isolation but assert behavior, not mock internals).

Gate: Before asserting on a mock, ask “Am I testing actual behavior or just the mock?” If it’s the mock, delete the assertion or unmock.

Anti-Pattern 2: Test-Only Methods in Production

  • ❌ Example: adding Session.destroy() only used in tests.
  • Why wrong: pollutes prod API, dangerous if called live.
  • ✅ Fix: move cleanup helpers to test utils; production classes expose only real lifecycle.

Gate: Before adding a method, ask “Is this only for tests?” and “Does this class own the lifecycle?” If “yes” or “no” respectively, stop.

Anti-Pattern 3: Mocking Without Understanding

  • ❌ Mocking a high-level method that also writes config, causing duplicate detection to fail.
  • ✅ Mock only the slow/external portion (e.g., server startup) so necessary side effects remain.

Gate: Before mocking, answer:

  1. What side effects does the real method have?
  2. Does the test rely on them?
  3. Do I fully understand the dependency chain? If unsure, run with real implementation first, observe, then mock minimally.

Anti-Pattern 4: Incomplete Mocks

  • ❌ Mock response with only fields you use; downstream needs metadata.requestId.
  • ✅ Mirror the full real schema (status, data, metadata, etc.).

Gate: Examine real API/docs, include every field consumers might touch. If uncertain, copy the full structure.

Read the full file on GitHub · 77 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 77 lines · 44 tokens per session scan A 49c2e0fcb521

Subscribe to this mod's changes

eng-testing-anti-patterns is a skill published in the GitHub repository tjboudreaux/cc-plugin-engineering-excellence (4 stars, last pushed 7mo ago), licensed MIT. It adds 44 tokens to every session and 764 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

research-engineer

An uncompromising Academic Research Engineer. Operates with absolute scientific rigor, objective criticism, and zero flair. Focuses on theoretical correctness, formal verification, and optimal implementation across any required technology.

davila7/claude-code-templates · 43 tokens

tika-eval-compare

Compare extracts from two Tika builds over a corpus to detect regressions in content, encoding, exceptions, and embedded-document handling. Use for "compare before/after extracts", "eval this change against the corpus".

apache/tika · 50 tokens

neuron-evaluation-engineer

Create and run AI evaluations with datasets, assertions, and output drivers in Neuron AI. Use this skill whenever the user mentions evaluation, testing AI systems, creating evaluators, dataset-driven testing, assertion-based validation, or wants to measure AI system performance. Also trigger for tasks involving…

neuron-core/neuron-ai · 77 tokens

jetson-validate-image

Use after jetson-flash-image to run static BSP checks, on-target smoke/regression tests on a flashed DUT, or both. Not for build or flash steps. Triggers: validate bsp, on-target validation.

NVIDIA/skills · 50 tokens

atmos-validation

Validate Atmos projects, components, arbitrary JSON Schema inputs, EditorConfig, and GitHub Actions; use affected-file selection and native CI annotations.

cloudposse/atmos · 31 tokens

skill-benchmark

Benchmark AI skill effectiveness by measuring implementation quality against legacy constraints.

HoangNguyen0403/agent-skills-standard · 16 tokens