industrial/_project-template/skill-testing-anti-patterns
Claude Code and agent skill by industrial/_project-template
- community
Checking that the SKILL.md file is still in the repository.
Use when writing or changing tests, adding mocks, or tempted to add test-only methods to production code - prevents testing mock behavior, production pollution with test-only methods, and mocking without understanding dependencies
Install
npx vskill@latest install industrial/_project-template/skill-testing-anti-patternsSKILL.md
The same SKILL.md was published earlier as industrial/_project-template/skill-testing-anti-patterns.
Testing Anti-Patterns
Use when writing or changing tests, adding mocks, or tempted to add test-only methods to production code - prevents testing mock behavior, production pollution with test-only methods, and mocking without understanding dependencies
Overview
Tests must verify real behavior, not mock behavior. Mocks are a means to isolate, not the thing being tested.
Core principle: Test what the code does, not what the mocks do.
Following strict TDD prevents these anti-patterns.
The Iron Laws
✅ Good: ```
Anti-Pattern 1: Testing Mock Behavior
✅ Good: The violation:
✅ Good: Gate Function
Anti-Pattern 2: Test-Only Methods in Production
✅ Good: The violation:
✅ Good: Gate Function
Anti-Pattern 3: Mocking Without Understanding
✅ Good: The violation:
✅ Good: Gate Function
Anti-Pattern 4: Incomplete Mocks
✅ Good: The violation:
✅ Good: Gate Function
Anti-Pattern 5: Integration Tests as Afterthought
✅ Good: The violation:
When Mocks Become Too Complex
- Warning signs:
- Mock setup longer than test logic
- Mocking everything to make test pass
- Mocks missing methods real components have
- Test breaks when mock changes
- "Do we need to be using a mock here?"
- Integration tests with real components often simpler than complex mocks
TDD Prevents These Anti-Patterns
Why TDD helps:
- Write test first → Forces you to think about what you're actually testing
- Watch it fail → Confirms test tests real behavior, not mocks
- Minimal implementation → No test-only methods creep in
- Real dependencies → You see what the test actually needs before mocking
If you're testing mock behavior, you violated TDD - you added mocks without watching test fail against real code first.
Quick Reference
| Anti-Pattern | Fix | |
|---|---|---|
| Assert on mock elements | Test real component or unmock it | |
| Test-only methods in production | Move to test utilities | |
| Mock without understanding | Understand dependencies first, mock minimally | |
| Incomplete mocks | Mirror real API completely | |
| Tests as afterthought | TDD - tests first | |
| Over-complex mocks | Consider integration tests |
Red Flags
- Assertion checks for
*-mocktest IDs - Methods only called in test files
- Mock setup is >50% of test
- Test fails when you remove mock
- Can't explain why mock is needed
- Mocking "just to be safe"
The Bottom Line
Mocks are tools to isolate, not things to test.
If TDD reveals you're testing mock behavior, you've gone wrong.
Fix: Test real behavior or question why you're mocking at all.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryChecking.openskills/skill-testing-anti-patterns/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/industrial/_project-template/skill-testing-anti-patterns)