unit-test-author

unit-test-author is a skill for Claude Code, Codex from JayRHa/AgentSkills. It costs 141 tokens per session (1,750 once invoked), scanned A, original, MIT.

A unit-testing assistant that writes tests for individual functions, classes, or modules across common programming languages and test frameworks. It focuses on checking observable behavior, including errors and side effects.

In plain words
What is it for?
Use it to add or strengthen unit tests, create table-driven or parameterized cases, and set up suitable mocks, stubs, spies, fakes, and fixtures.
Why use it?
It helps cover edge cases without creating fragile tests tied to private implementation details. It also avoids common sources of flaky tests, such as real clocks, randomness, networks, and file systems.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/jayrha/agentskills/unit-test-author
Any agent
npx skills add JayRHa/AgentSkills --skill unit-test-author
Clone the repo
git clone --depth 1 https://github.com/JayRHa/AgentSkills

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-author

README.md
[![agentmods](https://agentmods.dev/badge/skills/jayrha/agentskills/unit-test-author.svg)](https://agentmods.dev/skills/jayrha/agentskills/unit-test-author)
Your own site
<a href="https://agentmods.dev/skills/jayrha/agentskills/unit-test-author"><img src="https://agentmods.dev/badge/skills/jayrha/agentskills/unit-test-author.svg" alt="Measured on agentmods" height="20"></a>
Per session 141 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,750 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00141 $0.01750
Opus 5 $0.00071 $0.00875
Sonnet 5 $0.00028 $0.00350
Haiku 4.5 $0.00014 $0.00175

Measured yesterday against content hash bb15d49c61f9, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

unit-test-author 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 yesterday.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/check_tests.py), 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.

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.

unit-test-author/SKILL.md · 99 lines

How it starts

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

Unit Test Author

Overview

This skill produces unit tests that are correct, behavior-focused, exhaustive on edge cases, and resistant to brittleness. It applies across languages and frameworks and emphasizes testing observable behavior over implementation details.

Keywords: unit test, test coverage, edge cases, table-driven, parametrize, mock, stub, spy, fake, fixture, AAA arrange-act-assert, flaky test, property-based, snapshot, regression test, pytest, Jest, Vitest, Go test, JUnit, RSpec, xUnit, NUnit, Rust test.

Use this skill whenever the goal is to create or strengthen unit tests for a specific function, class, or module — not for end-to-end or load testing.

Core Principles

  1. Test behavior, not implementation. Assert on outputs, return values, raised errors, and observable side effects — never on private internals that can change without breaking the contract.
  2. One logical concept per test. A test may have several assertions, but they should all verify a single behavior. If a test name needs "and", split it.
  3. Deterministic always. No real clocks, randomness, network, filesystem, or ordering assumptions unless explicitly under test. Inject or freeze them.
  4. Arrange-Act-Assert (AAA). Visually separate setup, the single action, and verification. Keep the "act" to one call.
  5. Fail for one reason. When a test fails the message should point to the cause. Prefer precise assertions over assertTrue(x == y).
  6. Cover the contract, then the edges. Happy path first, then boundaries, then error/exception paths.

Workflow

Follow these steps in order. Do not skip step 1 — understanding the unit under test prevents tautological tests.

  1. Identify the unit and its contract. Read the function/class. List: inputs (types, ranges), outputs, raised errors, side effects, and dependencies (collaborators to mock).
  2. Detect the framework and conventions. Inspect the repo: test directory layout, existing test files, the runner (package.json scripts, pytest.ini/pyproject.toml, go.mod, pom.xml, Cargo.toml), assertion library, and mocking library already in use. Match existing conventions. See references/frameworks.md.
  3. Enumerate test cases using the edge-case checklist in references/edge-cases.md. Produce a short list before writing code (happy path, boundaries, empties, nulls, errors, concurrency if relevant).
  4. Choose a structure. When many inputs map to one behavior, use table-driven / parametrized tests (see references/table-driven.md). Otherwise, individual named tests.
  5. Plan the test double strategy for each dependency (mock vs stub vs fake vs spy) using the decision guide in references/mocking.md. Mock at architectural boundaries (network, DB, time, randomness), not internal pure functions.
  6. Write the tests with descriptive names (method_condition_expectedResult), AAA layout, and precise assertions.
  7. Add error-path and edge tests explicitly — these are most often missing.
  8. Run the tests and ensure they pass. Then sanity-check quality with scripts/check_tests.py (heuristic linter for missing assertions, skipped tests, sleep-based timing, etc.).
  9. Verify they actually test something: mentally (or literally) mutate the implementation and confirm a test would fail. Tests that pass against a broken implementation are worthless.

Read the full file on GitHub · 99 lines

Files

What ships with it

7 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. yesterday First seen · 99 lines · 141 tokens per session scan A bb15d49c61f9

Subscribe to this mod's changes

unit-test-author is a skill published in the GitHub repository JayRHa/AgentSkills (4 stars, last pushed 1mo ago), licensed MIT. It adds 141 tokens to every session and 1,750 once invoked, about $0.0007 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.