Agent skill

Testing Unit

by yonatangross in yonatangross/orchestkit

Unit testing patterns for isolated business logic tests — AAA pattern, parametrized tests (test.each, @pytest.mark.parametrize), fixture scoping (function/module/session), mocking with MSW/VCR at…

MITAuto-check passedTesting & QA

Install Testing Unit

skills CLI
$ npx skills add yonatangross/orchestkit --skill testing-unit -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install yonatangross/orchestkit testing-unit --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/yonatangross/orchestkit.git skills-src && mkdir -p .claude/skills && cp -r skills-src/src/skills/testing-unit .claude/skills/testing-unit && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
testing-unit
GitHub stars
288
Token cost
~2.4k tokens
SKILL.md length
672 words
Files
23 (incl. scripts, references)
Skills in repo
107
Repo updated
First seen
Licence
MIT

At a glance

Unit testing patterns for isolated business logic tests — AAA pattern, parametrized tests (test.each, @pytest.mark.parametrize), fixture scoping (function/module/session), mocking with MSW/VCR at…

  • Works in 5 steps: AAA structure: Every test MUST follow… → Parametrize, don't duplicate: Use… → Fixture scoping matters: Use… → …
  • Writing unit tests
  • SKILL.md covers Core Principles (ALWAYS apply), Quick Reference, Unit Test Structure and HTTP Mocking, plus 6 more sections
  • Calls vitest

What it does

Testing Unit is an agent skill from yonatangross/orchestkit. Unit testing patterns for isolated business logic tests — AAA pattern, parametrized tests (test.each, @pytest.mark.parametrize), fixture scoping (function/module/session), mocking with MSW/VCR at network level, and test data management with factories (FactoryBoy, faker-js). Use when writing unit tests, setting up mocks, structuring test data, optimizing test speed, choosing fixture scope, or reducing test boilerplate. Covers Vitest, Jest, pytest.

Its SKILL.md is about 2.4k tokens, which your agent loads only when the skill is triggered. The skill folder holds 26 other files, including scripts and reference files (for example `checklists/msw-setup-checklist.md`, `checklists/test-data-checklist.md` and `checklists/vcr-checklist.md`). Compatibility notes: Claude Code 2.1.277+.

It sits in Testing & QA, covering Unit testing. It works with pytest, Vitest, Jest and Python. The repository describes itself as: The Complete AI Development Toolkit for Claude Code. 106 skills, 36 agents, 171 hooks. Install ork for stable (v9.x), or ork-alpha for the v10 line, which ships daily. The licence is MIT.

When your agent uses it

  • Writing unit tests
  • Setting up mocks
  • Structuring test data
  • Optimizing test speed

Example prompts

  • “/testing-unit”

Requirements

  • Python 3
  • Compatibility (from SKILL.md): Claude Code 2.1.277+.
  • Pre-approved tools (allowed-tools): Read, Glob, Grep, WebFetch, WebSearch

Workflow steps

5 steps, taken from the first numbered list in SKILL.md.

  1. AAA structure: Every test MUST follow Arrange-Act-Assert. Use // Arrange, // Act, // Assert comments for clarity.
  2. Parametrize, don't duplicate: Use test.each (TypeScript) or @pytest.mark.parametrize (Python) when testing multiple inputs. Never…
  3. Fixture scoping matters: Use scope="function" (default) for mutable data. Use scope="module" or scope="session" ONLY for expensive…
  4. Speed target: Each unit test should run under 100ms. If it's slower, you're likely hitting I/O — mock it.
  5. Mock at the network level: Use MSW (TypeScript) or VCR.py (Python) to intercept HTTP at the network layer. Never mock fetch/axios/requests…

What it can do on your machine

Read from SKILL.md and the folder at commit 1f8d8f3. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Glob
    • Grep
    • WebFetch
    • WebSearch

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 1 file in scripts/, which the agent can run.

    Shell commands in SKILL.md call:

    • vitest

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Claude Code 2.1.277+.

    From compatibility in the SKILL.md frontmatter.

Context cost

Testing Unit loads about 2.4k tokens when it runs, and up to ~6k if it reads all its reference files. Until then it costs about 116 tokens; SKILL.md has 672 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~116
When it runs · the whole SKILL.md, loaded when a task matches
~2.4k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~6k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from yonatangross/orchestkit at commit 1f8d8f3, republished under its MIT licence (© yonatangross). 672 words, ~2,436 tokens.

Download SKILL.mdSave it as .claude/skills/testing-unit/SKILL.md (or your agent's skills folder). This skill also uses 22 other files; get the full folder from GitHub.
name
testing-unit
description
Unit testing patterns for isolated business logic tests — AAA pattern, parametrized tests (test.each, @pytest.mark.parametrize), fixture scoping (function/module/session), mocking with MSW/VCR at network level, and test data management with factories (FactoryBoy, faker-js). Use when writing unit tests, setting up mocks, structuring test data, optimizing test speed, choosing fixture scope, or reducing test boilerplate. Covers Vitest, Jest, pytest.
allowed-tools
Read, Glob, Grep, WebFetch, WebSearch
compatibility
Claude Code 2.1.277+.
license
MIT
context
fork
agent
test-generator
user-invocable
false
disable-model-invocation
false
metadata.category
document-asset-creation
metadata.version
2.1.0
metadata.author
OrchestKit
metadata.complexity
medium
metadata.tags
testing, unit, mocking, msw, vcr, fixtures, factories, vitest-4, aroundEach

Unit Testing Patterns

Focused patterns for writing isolated, fast, maintainable unit tests. Covers test structure (AAA), parametrization, fixture management, HTTP mocking (MSW/VCR), and test data generation with factories.

Each category has individual rule files in rules/ loaded on-demand, plus reference material, checklists, and scaffolding scripts.

Core Principles (ALWAYS apply)

  1. AAA structure: Every test MUST follow Arrange-Act-Assert. Use // Arrange, // Act, // Assert comments for clarity.
  2. Parametrize, don't duplicate: Use test.each (TypeScript) or @pytest.mark.parametrize (Python) when testing multiple inputs. Never copy-paste the same test body with different values.
  3. Fixture scoping matters: Use scope="function" (default) for mutable data. Use scope="module" or scope="session" ONLY for expensive read-only resources (DB engines, ML models). Mutable data with shared scope causes flaky tests.
  4. Speed target: Each unit test should run under 100ms. If it's slower, you're likely hitting I/O — mock it.
  5. Mock at the network level: Use MSW (TypeScript) or VCR.py (Python) to intercept HTTP at the network layer. Never mock fetch/axios/requests directly.

Quick Reference

CategoryRulesImpactWhen to Use
Unit Test Structure3CRITICALWriting any unit test
HTTP Mocking2HIGHMocking API calls in frontend/backend tests
Test Data Management3MEDIUMSetting up test data, factories, fixtures

Total: 8 rules across 3 categories, 4 references, 3 checklists, 1 example set, 3 scripts

Unit Test Structure

Core patterns for structuring isolated unit tests with clear phases and efficient execution.

RuleFileKey Pattern
AAA Patternrules/unit-aaa-pattern.mdArrange-Act-Assert with isolation
Fixture Scopingrules/unit-fixture-scoping.mdfunction/module/session scope selection
Parametrized Testsrules/unit-parametrized.mdtest.each / @pytest.mark.parametrize

Reference: references/aaa-pattern.md — detailed AAA implementation with checklist

HTTP Mocking

Network-level request interception for deterministic tests without hitting real APIs.

RuleFileKey Pattern
MSW 2.xrules/mocking-msw.mdNetwork-level mocking for frontend (TypeScript)
VCR.pyrules/mocking-vcr.mdRecord/replay HTTP cassettes (Python)

References:

  • references/msw-2x-api.md — full MSW 2.x API (handlers, GraphQL, WebSocket, passthrough)
  • references/stateful-testing.md — Hypothesis RuleBasedStateMachine for stateful tests

Checklists:

  • checklists/msw-setup-checklist.md — MSW installation, handler setup, test writing
  • checklists/vcr-checklist.md — VCR configuration, sensitive data filtering, CI setup

Examples: examples/handler-patterns.md — CRUD, error simulation, auth flow, file upload handlers

Test Data Management

Factories, fixtures, and seeding patterns for isolated, realistic test data.

RuleFileKey Pattern
Data Factoriesrules/data-factories.mdFactoryBoy / @faker-js builders
Data Fixturesrules/data-fixtures.mdJSON fixtures with composition
Seeding & Cleanuprules/data-seeding-cleanup.mdAutomated DB seeding and teardown

Reference: references/factory-patterns.md — advanced factory patterns (Sequence, SubFactory, Traits)

Checklist: checklists/test-data-checklist.md — data generation, cleanup, isolation verification

Quick Start

TypeScript (Vitest + MSW)
typescript
import { describe, test, expect, beforeAll, afterEach, afterAll } from 'vitest';
import { http, HttpResponse } from 'msw';
import { setupServer } from 'msw/node';
import { calculateDiscount } from './pricing';

// 1. Pure unit test with AAA pattern
describe('calculateDiscount', () => {
  test.each([
    [100, 0],
    [150, 15],
    [200, 20],
  ])('for order $%i returns $%i discount', (total, expected) => {
    // Arrange
    const order = { total };

    // Act
    const discount = calculateDiscount(order);

    // Assert
    expect(discount).toBe(expected);
  });
});

// 2. MSW mocked API test
const server = setupServer(
  http.get('/api/users/:id', ({ params }) => {
    return HttpResponse.json({ id: params.id, name: 'Test User' });
  })
);

beforeAll(() => server.listen({ onUnhandledRequest: 'error' }));
afterEach(() => server.resetHandlers());
afterAll(() => server.close());

test('fetches user from API', async () => {
  // Arrange — MSW handler set up above

  // Act
  const response = await fetch('/api/users/123');
  const data = await response.json();

  // Assert
  expect(data.name).toBe('Test User');
});
Python (pytest + FactoryBoy)
python
import pytest
from factory import Factory, Faker, SubFactory

class UserFactory(Factory):
    class Meta:
        model = dict
    email = Faker('email')
    name = Faker('name')

class TestUserService:
    @pytest.mark.parametrize("role,can_edit", [
        ("admin", True),
        ("viewer", False),
    ])
    def test_edit_permission(self, role, can_edit):
        # Arrange
        user = UserFactory(role=role)

        # Act
        result = user_can_edit(user)

        # Assert
        assert result == can_edit

Vitest 4.1 Features

Show full SKILL.md (279 more words)Show less
aroundEach / aroundAll (preferred for DB transactions)

Wraps each test in setup/teardown — cleaner than separate beforeEach/afterEach for transactions:

typescript
test.aroundEach(async (runTest, { db }) => {
  await db.transaction(runTest)  // auto-rollback on test end
})

test('insert user', async ({ db }) => {
  await db.insert({ name: 'Alice' })
  // transaction auto-rolls back — no cleanup needed
})

aroundAll wraps entire suites the same way.

mockThrow / mockThrowOnce

Replaces the verbose mockImplementation(() => { throw err }) pattern:

typescript
const fn = vi.fn()
fn.mockThrow(new Error('connection lost'))  // always throws
fn.mockThrowOnce(new Error('timeout'))      // throws once, then normal
vi.defineHelper (clean stack traces)

Custom assertion helpers that point errors to the call site, not the helper internals:

typescript
const assertPair = vi.defineHelper((a, b) => {
  expect(a).toEqual(b)  // error points to where assertPair() was CALLED
})
Test Tags

Filter tests by tags in CLI — useful for CI fast paths:

typescript
// vitest.config.ts
test: {
  tags: {
    unit: { timeout: 5000 },
    flaky: { retry: 3 },
  }
}
bash
vitest --tags-filter="unit and !flaky"
vitest --tags-filter="(unit or integration) and !slow"
Agent Reporter

Minimal output (failures only) — use in AI agent / CI contexts:

bash
AI_AGENT=copilot vitest    # auto-detect agent mode

Key Decisions

DecisionRecommendation
Test framework (TS)Vitest 4.1+ (modern, fast, aroundEach, test tags) or Jest (mature ecosystem)
Test framework (Python)pytest with plugins (parametrize, asyncio, cov)
HTTP mocking (TS)MSW 2.x at network level, never mock fetch/axios directly
HTTP mocking (Python)VCR.py with cassettes, filter sensitive data
Test dataFactories (FactoryBoy/faker-js) over hardcoded fixtures
Fixture scopescope="function" for mutable (default). module/session ONLY for expensive immutable resources
Execution timeUnder 100ms per unit test — if slower, mock external calls
Coverage target90%+ business logic, 100% critical paths

Common Mistakes

  1. Testing implementation details instead of public behavior (brittle tests)
  2. Mocking fetch/axios directly instead of using MSW at network level (incomplete coverage)
  3. Shared mutable state between tests via module-scoped fixtures (flaky tests)
  4. Hard-coded test data with duplicate IDs (test conflicts in parallel runs)
  5. No cleanup after database seeding (state leaks between tests)
  6. Over-mocking — testing your mocks instead of your code (false confidence)
  7. Verbose throw mocking — mockImplementation(() => { throw err }) instead of mockThrow(err) (Vitest 4.1+)

Scripts

ScriptFilePurpose
Create Test Casescripts/create-test-case.mdScaffold test file with auto-detected framework
Create Test Fixturescripts/create-test-fixture.mdScaffold pytest fixture with context detection
Create MSW Handlerscripts/create-msw-handler.mdScaffold MSW handler for an API endpoint

© yonatangross, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 22 other files (scripts, references) in src/skills/testing-unit of yonatangross/orchestkit.

  • SKILL.md
  • checklists/msw-setup-checklist.md
  • checklists/test-data-checklist.md
  • checklists/vcr-checklist.md
  • examples/handler-patterns.md
  • references/aaa-pattern.md
  • references/factory-patterns.md
  • references/msw-2x-api.md
  • references/stateful-testing.md
  • rules/_sections.md
  • rules/data-factories.md
  • rules/data-fixtures.md
  • rules/data-seeding-cleanup.md
  • rules/mocking-msw.md
  • rules/mocking-vcr.md
  • rules/unit-aaa-pattern.md
  • rules/unit-fixture-scoping.md
  • … and 6 more

Open the folder on GitHubat commit 1f8d8f3

Compare with similar skills

Testing Unit next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Testing Unit compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Testing Unit this skillyonatangross/orchestkit288—~2.4kAutomated safety check: PassMIT
Falsegreen Skillhashgraph-online/awesome-codex-plugins1.2k—~5.9kAutomated safety check: PassMIT
TDD Guidealirezarezvani/claude-skills28k—~3.4kAutomated safety check: PassMIT
Assertion Qualitymicrosoft/testfx1k—~4.1kAutomated safety check: PassMIT
Code Testing Agentmicrosoft/testfx1k—~2.7kAutomated safety check: PassMIT
Test Gap Analysismicrosoft/testfx1k—~4kAutomated safety check: PassMIT

Similar skills

  • Falsegreen Skill

    hashgraph-online/awesome-codex-plugins

    Analyze test files for false-positive smells, meaning tests that pass even when the code breaks.

    1.2k GitHub stars~5.9k tokensUpdated yesterday
    Testing & QAAuto-check passed
  • TDD Guide

    alirezarezvani/claude-skills

    Test-driven development skill for writing unit tests, generating test fixtures and mocks, analyzing coverage gaps, and guiding red-green-refactor workflows across Jest, Pytest, JUnit, Vitest, and…

    28k GitHub stars~3.4k tokensUpdated 1 mo ago
    Testing & QAAuto-check passed
  • Assertion Quality

    microsoft/testfx

    Official

    Analyzes the variety and depth of assertions across test suites in any language.

    1k GitHub stars~4.1k tokensUpdated today
    Testing & QAAuto-check passed
  • Code Testing Agent

    microsoft/testfx

    Official

    Generates and writes new unit tests for any programming language — scaffolds .NET test projects, pytest suites, Vitest/Jest suites, Go test files, and JUnit suites, and configures coverage tooling…

    1k GitHub stars~2.7k tokensUpdated today
    Testing & QAAuto-check passed
  • Test Gap Analysis

    microsoft/testfx

    Official

    Performs pseudo-mutation analysis on production code in any language to find gaps in existing test suites.

    1k GitHub stars~4k tokensUpdated today
    Testing & QAAuto-check passed
  • Test Tagging

    microsoft/testfx

    Official

    Analyzes test suites in any language and tags each test with a standardized set of traits (positive, negative, critical-path, boundary, smoke, regression, integration, performance, security).

    1k GitHub stars~4.3k tokensUpdated today
    Testing & QAAuto-check passed

More from yonatangross/orchestkit

All 107 skills in this repo
  • API Design

    yonatangross/orchestkit

    API contract design for REST and GraphQL, covering resource shape, URL and header versioning with deprecation windows, RFC 9457 Problem Details error handling, and OpenAPI specs.

    288 GitHub stars~2.9k tokensUpdated yesterday
    Auto-check passed
  • Architecture Decision Record

    yonatangross/orchestkit

    ADR templates in the Nygard format with context, decision, consequences, and alternatives.

    288 GitHub stars~2k tokensUpdated yesterday
    Auto-check passed
  • Audit Full

    yonatangross/orchestkit

    Single-pass codebase analysis leveraging a 1M-token context window for comprehensive security scanning, architecture review, and dependency auditing.

    288 GitHub stars~3.5k tokensUpdated yesterday
    Auto-check: notes
  • Code Review Playbook

    yonatangross/orchestkit

    Structured review processes, conventional comments, language-specific checklists, and feedback templates.

    288 GitHub stars~2.2k tokensUpdated yesterday
    Auto-check passed
  • Create PR

    yonatangross/orchestkit

    Creates GitHub pull requests with pre-flight validation, conventional title formatting, and structured summary generation.

    288 GitHub stars~4.5k tokensUpdated yesterday
    Auto-check: notes
  • Explore

    yonatangross/orchestkit

    Multi-angle codebase exploration spawning 3-5 parallel agents for code structure, data flow, architecture patterns, and health assessment.

    288 GitHub stars~3.9k tokensUpdated yesterday
    Auto-check: notes

Categories

Questions about Testing Unit

What does Testing Unit do?

Unit testing patterns for isolated business logic tests — AAA pattern, parametrized tests (test.each, @pytest.mark.parametrize), fixture scoping (function/module/session), mocking with MSW/VCR at…. Testing Unit is an agent skill from yonatangross/orchestkit.parametrize), fixture scoping (function/module/session), mocking with MSW/VCR at network level, and test data management with factories (FactoryBoy, faker-js).

When should I use Testing Unit?

Testing Unit fits situations like: writing unit tests; setting up mocks; structuring test data; optimizing test speed.

How do I install Testing Unit in Claude Code?

Run `npx skills add yonatangross/orchestkit --skill testing-unit -a claude-code`. Or copy the skill folder (src/skills/testing-unit in yonatangross/orchestkit) into .claude/skills/testing-unit in your project. Claude Code loads it when a task matches its description.

How do I install Testing Unit in Codex?

Run `npx skills add yonatangross/orchestkit --skill testing-unit -a codex`. Or copy the skill folder (src/skills/testing-unit in yonatangross/orchestkit) into .agents/skills/testing-unit in your project. Codex loads it when a task matches its description.

Can I use Testing Unit in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add yonatangross/orchestkit --skill testing-unit -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/testing-unit, .gemini/skills/testing-unit, .github/skills/testing-unit and .opencode/skills/testing-unit in your project.

What does Testing Unit need to run?

Going by SKILL.md and its folder, Testing Unit needs the command-line tools its instructions call (vitest). Our summary lists: Python 3. Its frontmatter pre-approves these tools: Read, Glob, Grep, WebFetch, WebSearch. Compatibility (from SKILL.md): Claude Code 2.1.277+..

Does Testing Unit access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Testing Unit safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Testing Unit use?

Testing Unit is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Testing Unit use?

About 2.4k tokens (SKILL.md is roughly 9.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 3.6k tokens, read only when the agent opens those files.

What are the alternatives to Testing Unit?

Skills that share tags, products or a category with Testing Unit: Falsegreen Skill (hashgraph-online/awesome-codex-plugins, 1.2k stars), TDD Guide (alirezarezvani/claude-skills, 28k stars), Assertion Quality (microsoft/testfx, 1k stars) and Code Testing Agent (microsoft/testfx, 1k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Testing Unit?

yonatangross (a GitHub user) maintains it in yonatangross/orchestkit, which has 288 GitHub stars. The repository holds 107 skills in this directory. The repository was last updated on October 6, 2026.

Source: yonatangross/orchestkit on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.