unit-testing

unit-testing is a skill for Claude Code, Codex from williamzujkowski/standards. It costs 37 tokens per session (4,203 once invoked), scanned A, original, MIT.

A guide to unit testing, where small pieces of code are checked separately from databases, APIs, and other outside systems. It covers test-driven development (TDD), meaning writing a failing test before the code, followed by implementation and cleanup.

In plain words
What is it for?
Use it to write tests with pytest or Jest, structure them with arrange-act-assert steps, use mocks and fixtures, measure coverage, and run checks automatically in continuous integration.
Why use it?
It helps catch mistakes early with fast, repeatable tests and reduces dependence on external systems. It also provides patterns for organizing test data, replacing outside dependencies, and checking many inputs.

Skill for Claude CodeCodex

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

Good fit Use it to write tests with pytest or Jest, structure them with arrange-act-assert steps, use mocks and fixtures, measure coverage, and run checks automatically in continuous integration.

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

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

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/williamzujkowski/standards/unit-testing"><img src="https://agentmods.dev/badge/skills/williamzujkowski/standards/unit-testing.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 37 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,203 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. 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.00037 $0.04203
Opus 5.5 $0.00015 $0.01681
Sonnet 5.5 $0.00007 $0.00841
Haiku 4.5 $0.00004 $0.00420

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

Security

Grade A, and why

unit-testing scanned grade A with 1 finding 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 2mo ago.

The scan reads SKILL.md. This mod also ships 6 executable files (config/jest.config.js, resources/configs/jest.config.js, templates/example.test.js, …), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

@patch('requests.get')
skills/testing/unit-testing/SKILL.md · 631 lines

How it starts

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

Unit Testing Standards

Quick Navigation: Level 1: Quick Start (5 min) → Level 2: Implementation (30 min) → Level 3: Mastery (Extended)


Level 1: Quick Start (<2,000 tokens, 5 minutes)

Core Principles

  1. Test-Driven Development (TDD): Write tests before implementation (Red-Green-Refactor)
  2. Test Pyramid: 70% unit tests, 20% integration, 10% E2E
  3. Fast and Isolated: Tests run in milliseconds, no external dependencies
  4. Comprehensive Coverage: Aim for 80-90% code coverage minimum
  5. Clear and Maintainable: Tests serve as living documentation

Essential Checklist

  • TDD workflow: Write failing test → Implement → Refactor
  • Coverage targets: 80%+ overall, 95%+ for critical paths
  • Naming convention: test_<function>_<scenario>_<expected_result>
  • AAA pattern: Arrange, Act, Assert structure in every test
  • Mocking: Mock external dependencies (database, APIs, filesystem)
  • Fixtures: Reusable test data and setup/teardown
  • Parametrized tests: Test multiple inputs efficiently
  • CI integration: Tests run automatically on every commit

Quick Example

# pytest unit testing example
import pytest
from datetime import datetime

def calculate_discount(user_age: int, purchase_amount: float) -> float:
    """Calculate discount based on age and purchase amount."""
    if user_age < 18:
        return 0.0
    elif user_age >= 65:
        return purchase_amount * 0.15
    elif purchase_amount >= 100:
        return purchase_amount * 0.10
    return 0.0

# Unit tests following TDD
def test_calculate_discount_no_discount_for_minors():
    """Test that users under 18 receive no discount."""
    # Arrange
    user_age = 16
    purchase_amount = 100.0

    # Act
    discount = calculate_discount(user_age, purchase_amount)

    # Assert
    assert discount == 0.0

def test_calculate_discount_senior_discount():
    """Test that seniors (65+) receive 15% discount."""
    assert calculate_discount(65, 100.0) == 15.0
    assert calculate_discount(70, 200.0) == 30.0

def test_calculate_discount_large_purchase():
    """Test that purchases >= $100 receive 10% discount."""
    assert calculate_discount(30, 100.0) == 10.0
    assert calculate_discount(30, 150.0) == 15.0

@pytest.mark.parametrize("age,amount,expected", [
    (16, 100, 0.0),   # Minor
    (30, 50, 0.0),    # No discount
    (30, 100, 10.0),  # Large purchase
    (65, 50, 7.5),    # Senior
    (70, 200, 30.0),  # Senior large purchase
])
def test_calculate_discount_parametrized(age, amount, expected):
    """Test multiple discount scenarios."""
    assert calculate_discount(age, amount) == expected

Read the full file on GitHub · 631 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. 2mo ago First seen · 631 lines · 37 tokens per session scan A 070b7896964e

Subscribe to this mod's changes

unit-testing is a skill published in the GitHub repository williamzujkowski/standards (22 stars, last pushed 3mo ago), licensed MIT. It adds 37 tokens to every session and 4,203 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-29.

Related

unit-testing compared with skills from other repositories

unit-testing next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
unit-testingwilliamzujkowski/standardsSkill223mo agoMITA37Claude Code, Codex
rust-testingaffaan-m/ECCSkill313k7d agoMITA31Claude Code, Kiro
cpp-testingaffaan-m/ECCSkill313k7d agoMITA34Claude Code, Kiro
write-vibe-testsmistralai/mistral-vibeSkill5.5k2d agoApache-2.0A80Claude Code, Codex
nw-fp-haskellnWave-ai/nWaveSkill63611d agoMITA22Claude Code
nw-fp-clojurenWave-ai/nWaveSkill63611d agoMITA25Claude Code
nw-fp-fsharpnWave-ai/nWaveSkill63611d agoMITA21Claude Code