testing-patterns

testing-patterns is a skill for Claude Code, Codex from klh/speedy-claude. It costs 40 tokens per session (1,407 once invoked), scanned A, a copy of testing-patterns, MIT.

A collection of Jest testing patterns, test factories, mocking methods, and a TDD workflow. TDD, or test-driven development, means writing a failing test before the code that makes it pass.

In plain words
What is it for?
Writing unit tests, creating reusable mock data, testing components with their required providers, and following the test-fail, code, refactor cycle.
Why use it?
It helps keep tests focused on observable behavior and reduces repeated setup code.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Writing unit tests, creating reusable mock data, testing components with their required providers, and following the test-fail, code, refactor cycle.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/klh/speedy-claude/testing-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 klh/speedy-claude --skill testing-patterns
Clone the repo
git clone --depth 1 https://github.com/klh/speedy-claude

Made for: Claude Code, Codex.

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 testing-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/klh/speedy-claude/testing-patterns/github.svg)](https://agentmods.dev/skills/klh/speedy-claude/testing-patterns)
Your own site
<a href="https://agentmods.dev/skills/klh/speedy-claude/testing-patterns"><img src="https://agentmods.dev/badge/skills/klh/speedy-claude/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.

agentmods 80×15 button for testing-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/klh/speedy-claude/testing-patterns"><img src="https://agentmods.dev/badge/skills/klh/speedy-claude/testing-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 40 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,407 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin 89% copy Near-identical to another mod 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.00040 $0.01407
Opus 5.5 $0.00016 $0.00563
Sonnet 5.5 $0.00008 $0.00281
Haiku 4.5 $0.00004 $0.00141

Measured 3mo ago against content hash 44e731624aad, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

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 3mo 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.

Origin

This is a copy

89% identical to testing-patterns — 68 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

skills-available/testing-patterns/SKILL.md · 263 lines

How it starts

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

Testing Patterns and Utilities

Testing Philosophy

Test-Driven Development (TDD):

  • Write failing test FIRST
  • Implement minimal code to pass
  • Refactor after green
  • Never write production code without a failing test

Behavior-Driven Testing:

  • Test behavior, not implementation
  • Focus on public APIs and business requirements
  • Avoid testing implementation details
  • Use descriptive test names that describe behavior

Factory Pattern:

  • Create getMockX(overrides?: Partial<X>) functions
  • Provide sensible defaults
  • Allow overriding specific properties
  • Keep tests DRY and maintainable

Test Utilities

Custom Render Function

Create a custom render that wraps components with required providers:

// src/utils/testUtils.tsx
import { render } from '@testing-library/react-native';
import { ThemeProvider } from './theme';

export const renderWithTheme = (ui: React.ReactElement) => {
  return render(
    <ThemeProvider>{ui}</ThemeProvider>
  );
};

Usage:

import { renderWithTheme } from 'utils/testUtils';
import { screen } from '@testing-library/react-native';

it('should render component', () => {
  renderWithTheme(<MyComponent />);
  expect(screen.getByText('Hello')).toBeTruthy();
});

Factory Pattern

Component Props Factory

import { ComponentProps } from 'react';

const getMockMyComponentProps = (
  overrides?: Partial<ComponentProps<typeof MyComponent>>
) => {
  return {
    title: 'Default Title',
    count: 0,
    onPress: jest.fn(),
    isLoading: false,
    ...overrides,
  };
};

// Usage in tests
it('should render with custom title', () => {
  const props = getMockMyComponentProps({ title: 'Custom Title' });
  renderWithTheme(<MyComponent {...props} />);
  expect(screen.getByText('Custom Title')).toBeTruthy();
});

Data Factory

interface User {
  id: string;
  name: string;
  email: string;
  role: 'admin' | 'user';
}

const getMockUser = (overrides?: Partial<User>): User => {
  return {
    id: '123',
    name: 'John Doe',
    email: '[email protected]',
    role: 'user',
    ...overrides,
  };
};

// Usage
it('should display admin badge for admin users', () => {
  const user = getMockUser({ role: 'admin' });
  renderWithTheme(<UserCard user={user} />);
  expect(screen.getByText('Admin')).toBeTruthy();
});

Read the full file on GitHub · 263 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. 3mo ago Changed · +3 lines 44e731624aad
  2. 3mo ago First seen · 260 lines · 40 tokens per session scan A 20ac6875fbbd

Subscribe to this mod's changes

testing-patterns is a skill published in the GitHub repository klh/speedy-claude (11 stars, last pushed 2mo ago), licensed MIT. It adds 40 tokens to every session and 1,407 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. It is 89% identical to testing-patterns, differing in 68 lines, and is treated as a copy.

Related

testing-patterns compared with skills from other repositories

testing-patterns next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
testing-patternsklh/speedy-claudeSkill112mo agoMITA40Claude Code, Codex
cpp-testingaffaan-m/ECCSkill315kyesterdayMITA34Claude Code, Kiro
rust-testingaffaan-m/ECCSkill315kyesterdayMITA31Claude Code, Kiro
write-vibe-testsmistralai/mistral-vibeSkill5.6k2d agoApache-2.0A80Claude Code, Codex
composing-matchersonsi/gomegaSkill2.4kyesterdayMITA136Claude Code
nw-fp-clojurenWave-ai/nWaveSkill63814d agoMITA25Claude Code
nw-fp-fsharpnWave-ai/nWaveSkill63814d agoMITA21Claude Code