unit-testing

unit-testing is a skill for Claude Code, Codex from JakubMikolajek/codex-skills-collection. It costs 68 tokens per session (3,203 once invoked), scanned A, original, MIT.

Guidance for unit, integration, and component tests in TypeScript and JavaScript using Vitest or Jest. Unit tests check small pieces of code, while integration tests check how connected pieces work together.

In plain words
What is it for?
Use it to write or review tests for services, utilities, domain logic, and user-interface components.
Why use it?
It helps create reliable tests, handle mocks and asynchronous code, and investigate tests that fail in continuous integration.

Skill for Claude CodeCodex

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

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is vi.mock('../lib/email', () => ({.

Good fit Use it to write or review tests for services, utilities, domain logic, and user-interface components.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/JakubMikolajek/codex-skills-collection
agentmods
npx agentmods add skills/jakubmikolajek/codex-skills-collection/unit-testing

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/jakubmikolajek/codex-skills-collection/unit-testing/github.svg)](https://agentmods.dev/skills/jakubmikolajek/codex-skills-collection/unit-testing)
Your own site
<a href="https://agentmods.dev/skills/jakubmikolajek/codex-skills-collection/unit-testing"><img src="https://agentmods.dev/badge/skills/jakubmikolajek/codex-skills-collection/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/jakubmikolajek/codex-skills-collection/unit-testing"><img src="https://agentmods.dev/badge/skills/jakubmikolajek/codex-skills-collection/unit-testing.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 68 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,203 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.
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.00068 $0.03203
Opus 5 $0.00034 $0.01602
Sonnet 5 $0.00014 $0.00641
Haiku 4.5 $0.00007 $0.00320

Measured 9d ago against content hash db7194502052, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

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

skills/unit-testing/SKILL.md · 417 lines

How it starts

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

Unit Testing (TypeScript / JavaScript)

This skill covers unit and component testing in the TypeScript/JavaScript ecosystem. It is the counterpart to e2e-testing (Playwright, full browser) and python-testing (pytest).

When to Use

  • Writing unit tests for service logic, utility functions, or domain models
  • Writing component tests with React Testing Library
  • Reviewing test code for quality, coverage gaps, or brittle patterns
  • Setting up a test framework from scratch in a new project
  • Debugging a test that passes locally but fails in CI

When NOT to Use

  • E2E tests covering full user journeys in a browser — use e2e-testing
  • Python tests — use python-testing
  • Visual regression testing — different toolchain (Chromatic, Percy)

Framework Choice

Vitest — preferred for new projects (especially Vite, Next.js App Router, Turborepo):

  • Same config as Vite (no separate babel/transform setup)
  • Faster than Jest in watch mode
  • Native ESM support
  • Drop-in Jest API compatibility

Jest — preferred when:

  • Existing project already uses Jest
  • CRA, some NestJS setups, older React Native

This skill uses Vitest syntax. Jest equivalents are identical except for vi.*jest.*.

Test Structure

src/
├── services/
│   ├── document.service.ts
│   └── document.service.test.ts    # co-located with source
├── components/
│   ├── DocumentCard.tsx
│   └── DocumentCard.test.tsx
└── utils/
    ├── slug.ts
    └── slug.test.ts

Co-location (test next to source) is preferred over a separate __tests__ directory — easier to find, easier to maintain.

Test file naming: *.test.ts or *.spec.ts — choose one convention and apply it consistently.

Test Anatomy

import { describe, it, expect, beforeEach, vi } from 'vitest';
import { DocumentService } from './document.service';

describe('DocumentService', () => {
  let service: DocumentService;

  beforeEach(() => {
    // Fresh instance per test — no shared state between tests
    service = new DocumentService(mockDb);
  });

  describe('create', () => {
    it('returns created document with generated id', async () => {
      // Arrange
      const input = { title: 'Test', content: 'Hello' };

      // Act
      const result = await service.create(input);

      // Assert
      expect(result.id).toBeDefined();
      expect(result.title).toBe('Test');
      expect(result.content).toBe('Hello');
    });

    it('throws ValidationError when title is empty', async () => {
      await expect(service.create({ title: '', content: 'x' }))
        .rejects.toThrow(ValidationError);
    });
  });
});

Read the full file on GitHub · 417 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. 9d ago First seen · 417 lines · 68 tokens per session scan A db7194502052

Subscribe to this mod's changes

unit-testing is a skill published in the GitHub repository JakubMikolajek/codex-skills-collection (5 stars, last pushed 7d ago), licensed MIT. It adds 68 tokens to every session and 3,203 once invoked, about $0.0003 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.