Unit Test Writer

Unit Test Writer is a skill for Claude Code, Codex from Notysoty/openagentskills. It costs 18 tokens per session (1,574 once invoked), scanned A, original, MIT.

A guide for writing unit tests for a function, class, or module. Unit tests check small pieces of code in isolation, including normal inputs, unusual cases, errors, and limits.

In plain words
What is it for?
Use it to create tests in frameworks such as Jest, Vitest, or Mocha, with mocks for required dependencies.
Why use it?
It helps reveal cases that are easy to miss and produces tests that check whether the implementation behaves as intended.

Skill for Claude CodeCodex

Which agent this was written for is unclear — built for cline. Also seen: positional $N argument; mentions Claude Code; mentions Codex.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is import { parsePriceString } from '../utils/parsePriceString';.

Good fit Use it to create tests in frameworks such as Jest, Vitest, or Mocha, with mocks for required dependencies.

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/Notysoty/openagentskills
agentmods
npx agentmods add skills/notysoty/openagentskills/unit-test-writer

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 Test Writer

README.md
[![agentmods](https://agentmods.dev/badge/skills/notysoty/openagentskills/unit-test-writer.svg)](https://agentmods.dev/skills/notysoty/openagentskills/unit-test-writer)
Your own site
<a href="https://agentmods.dev/skills/notysoty/openagentskills/unit-test-writer"><img src="https://agentmods.dev/badge/skills/notysoty/openagentskills/unit-test-writer.svg" alt="Measured on agentmods" height="20"></a>
Per session 18 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,574 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.00018 $0.01574
Opus 5 $0.00009 $0.00787
Sonnet 5 $0.00004 $0.00315
Haiku 4.5 $0.00002 $0.00157

Measured 4d ago against content hash 47c675ec3cfd, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

Unit Test Writer 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 4d 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-test-writer/SKILL.md · 183 lines

How it starts

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

Unit Test Writer

What this skill does

This skill directs the agent to write a thorough unit test suite for a given function, class, or module. It systematically identifies happy paths, edge cases, error paths, and boundary conditions — then writes tests in your chosen framework (Jest, Vitest, Mocha, etc.) with proper mocking where needed.

Use this when you have a function that needs test coverage or when you want to verify your implementation handles edge cases you might not have thought of.

How to use

Claude Code / Cline

Copy this file to .agents/skills/unit-test-writer/SKILL.md in your project root.

Then ask the agent:

  • "Write unit tests for src/utils/formatCurrency.ts using the Unit Test Writer skill."
  • "Use the Unit Test Writer skill to generate Vitest tests for this function."

Paste the function code into the chat, or reference the file path.

Cursor

Add the instructions from the "Prompt / Instructions" section below to your .cursorrules, or paste them into the Cursor AI pane before asking for tests.

Codex

Paste your function and the instructions below into the Codex chat. Specify your test framework explicitly (Jest, Vitest, etc.) since Codex does not infer it from the project.

The Prompt / Instructions for the Agent

When asked to write unit tests, follow these steps:

  1. Read the code. Understand the function's:

    • Inputs (types, shapes, constraints)
    • Outputs (return type, side effects)
    • Dependencies (external calls, imports that may need mocking)
    • Error conditions (what throws, what returns null/undefined)
  2. Identify test cases in this order:

    • Happy path — typical valid inputs that produce the expected output
    • Boundary values — min/max numbers, empty strings, empty arrays, zero
    • Type coercions — what happens with null, undefined, 0, "", false
    • Error paths — inputs that should throw or return an error state
    • Async edge cases (if async) — resolved values, rejected promises, race conditions
    • Mocked dependencies — external calls (API, DB, filesystem) must be mocked; never make real calls in unit tests

Read the full file on GitHub · 183 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. 4d ago First seen · 183 lines · 18 tokens per session scan A 47c675ec3cfd

Subscribe to this mod's changes

Unit Test Writer is a skill published in the GitHub repository Notysoty/openagentskills (9 stars, last pushed 24d ago), licensed MIT. It adds 18 tokens to every session and 1,574 once invoked, about $0.0001 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.

Related

Other skills, from other repositories

test-generator

Generate comprehensive unit, integration, and end-to-end tests. Use when adding test coverage, writing tests for new features, or improving existing test suites.

asgarovf/locusai · 33 tokens

nextjs-testing

Write Jest or Vitest unit tests with React Testing Library and Playwright E2E tests for Next.js projects. Use when testing components with RTL, mocking APIs with MSW, or creating Playwright user flow tests.

FilippoDeSilva/skills · 48 tokens

review-ugc-render

Mandatory pre-publish review gate for a UGC video render. Transcribes the finished render's AUDIO with Whisper and word-diffs it against the approved spoken script, then gates setfinalrender — blocking a render whose generated audio mis-voices a word (e.g. the approved "human-vetted" spoken as "human witted"), drops…

gooseworks-ai/goose-skills · 116 tokens

JavaScript Testing Patterns

Modern JavaScript testing strategies with Jest, Mocha, and testing best practices covering unit testing, integration testing, mocking, async patterns, and DOM testing.

PramodDutta/qaskills · 36 tokens

Code Coverage Analysis

Measure and enforce test coverage with Istanbul/nyc, c8, Jest, and Vitest. Covers branch versus line coverage, per-directory thresholds, CI gates, and correctly excluding generated code from reports.

PramodDutta/qaskills · 45 tokens

iterate-agent-harness

Turn an agent failure—premature stop, false completion, gamed check, missed file, broken handoff—into a durable rule/skill/hook/CI guard plus regression test. Use when "the agent stopped early again", "it gamed the test", or "add a guard so this doesn't recur". App bugs → workflow-fix-and-ship.

kensaurus/cursor-kenji · 79 tokens