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.
npx skills add mickeyyaya/refactoring-skills --skill testing-patternsgit clone --depth 1 https://github.com/mickeyyaya/refactoring-skillsWrote 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.
[](https://agentmods.dev/skills/mickeyyaya/refactoring-skills/testing-patterns)<a href="https://agentmods.dev/skills/mickeyyaya/refactoring-skills/testing-patterns"><img src="https://agentmods.dev/badge/skills/mickeyyaya/refactoring-skills/testing-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.
<a href="https://agentmods.dev/skills/mickeyyaya/refactoring-skills/testing-patterns"><img src="https://agentmods.dev/badge/skills/mickeyyaya/refactoring-skills/testing-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00048 | $0.01528 |
| Opus 5 | $0.00024 | $0.00764 |
| Sonnet 5 | $0.00010 | $0.00306 |
| Haiku 4.5 | $0.00005 | $0.00153 |
Grade A, and why
testing-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.
How it starts
The opening of the file, as written. The whole thing — 169 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Testing Patterns and Anti-Patterns
Overview
Classify test doubles, recognize test smells, apply testing strategies, and avoid TDD anti-patterns. Use when writing tests, reviewing test coverage in a PR, or diagnosing slow/fragile/misleading test suites.
Test Double Taxonomy
Google's preference order: Real > Fake > Stub > Mock
| Double | What it does | Verifies calls? | Has logic? | Use when |
|---|---|---|---|---|
| Dummy | Passed but never used | No | No | Satisfying unused required params |
| Stub | Returns preset values | No | Minimal | Controlling outputs for a specific path |
| Spy | Records calls, delegates to real | Yes (after) | Yes | Verifying call count/args without replacing behavior |
| Mock | Pre-programmed expectations | Yes (during) | No | Strict interaction verification — use sparingly |
| Fake | Simplified working impl | No | Yes | Replacing slow/external systems (in-memory DB, fake API) |
// DUMMY
const dummyLogger: Logger = {} as Logger;
// STUB
const stubUserRepo = { findById: (_id: string) => Promise.resolve({ id: "1", name: "Alice" }) };
// SPY
const sendEmailSpy = jest.spyOn(emailService, "send");
await notifyUser(user);
expect(sendEmailSpy).toHaveBeenCalledWith(user.email, expect.any(String));
// MOCK
const mockGateway = { charge: jest.fn().mockResolvedValue({ status: "ok" }) };
await checkout(cart, mockGateway);
expect(mockGateway.charge).toHaveBeenCalledWith(cart.total);
// FAKE
class FakeUserRepository implements UserRepository {
private store = new Map<string, User>();
async findById(id: string) { return this.store.get(id) ?? null; }
async save(user: User) { this.store.set(user.id, user); }
}
Test Smells
1. The Liar
Passes but does not verify claimed behavior. Assertions always evaluate to true.
// SMELL: expect(result).toBeDefined(); // FIX: expect(result).toBe(90);
2. Excessive Setup
50+ lines before first assertion. Unit under test has too many dependencies. Fix: Factory function accepting only test-relevant params.
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.
- 9d ago First seen · 169 lines · 48 tokens per session scan A 0d65af20f551
testing-patterns is a skill published in the GitHub repository mickeyyaya/refactoring-skills (6 stars, last pushed 5mo ago), licensed MIT. It adds 48 tokens to every session and 1,528 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-09-03.
Other skills, from other repositories
engram-testing-coverage
TDD and coverage standards for Engram. Trigger: When implementing behavior changes in any package.
iterative-development
TDD iteration loops using Claude Code Stop hooks - runs tests after each response, feeds failures back automatically.
python
Python development with ruff, mypy, pytest - TDD and type safety.
nw-fp-clojure
Clojure language-specific patterns, data-first modeling, REPL-driven development, and spec.
strict-tdd
Strict RED->GREEN->REFACTOR test-driven development with enforcement. Never write production code before a failing test. Atomic commits per TDD cycle.
mobiai-mobile-tdd
You MUST use this before writing any implementation code for a mobile feature, bug fix, refactor, or behavior change. Tests come before implementation — no exceptions.