unit-testing

unit-testing is a skill for Claude Code, Codex from OKHP3/skillz. It costs 87 tokens per session (1,147 once invoked), scanned A, original, MIT.

A guide for writing tests around existing code, focusing on cases that should fail when the code breaks. Unit tests check small pieces of code in isolation, such as a function or module.

In plain words
What is it for?
It is for choosing test cases, selecting useful points to test, and writing assertions for functions or modules, including validation, conversions, branches, and state changes.
Why use it?
It helps avoid tests that merely repeat the implementation or inflate line coverage without checking behaviour. It focuses testing effort on logic, boundaries, past bugs, and public contracts.

Skill for Claude CodeCodex

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

Good fit It is for choosing test cases, selecting useful points to test, and writing assertions for functions or modules, including validation, conversions, branches, and state changes.

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

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/okhp3/skillz/unit-testing/github.svg)](https://agentmods.dev/skills/okhp3/skillz/unit-testing)
Your own site
<a href="https://agentmods.dev/skills/okhp3/skillz/unit-testing"><img src="https://agentmods.dev/badge/skills/okhp3/skillz/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/okhp3/skillz/unit-testing"><img src="https://agentmods.dev/badge/skills/okhp3/skillz/unit-testing.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 87 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,147 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.00087 $0.01147
Opus 5 $0.00044 $0.00574
Sonnet 5 $0.00017 $0.00229
Haiku 4.5 $0.00009 $0.00115

Measured 6d ago against content hash 8a54e76c6a98, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, 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 6d 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.

community/unit-testing/SKILL.md · 102 lines

How it starts

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

Unit testing

A test earns its place by failing when something breaks and staying quiet otherwise. A test that never fails is documentation with a runtime cost; a test that fails on every refactor is a tax. Both get deleted eventually, and the second one takes the good tests' credibility with it.

Coverage is not the goal. Coverage measures which lines ran, not whether anything was checked — a suite that executes everything and asserts nothing scores beautifully and catches nothing.

1. Decide what deserves a test

In descending order of value:

  1. Logic with branches — conditionals, loops, calculations, parsing, state transitions
  2. Anything that has broken before — bugs cluster; a fixed bug without a test will return
  3. Boundaries — where data is validated, converted, or crosses a system edge
  4. Contracts other code relies on — a public API's shape and its documented failure modes

Not worth it: generated code, thin pass-throughs, framework behaviour, getters, and anything where the test would restate the implementation line for line.

Done when: you can say why each planned test exists, in terms of a failure it would catch.

2. Pick the seam

Test at the smallest stable interface that exposes the behaviour, not necessarily the smallest unit. A private function extracted for tidiness is an implementation detail; testing it directly freezes a decision you should be free to change.

If a behaviour is only reachable through six layers of setup, that is a design signal. Note it, and test at the level that is reachable rather than mocking your way down.

Done when: the seam is one a caller would actually use.

3. Enumerate cases before writing any

Go through these deliberately — the value of a test suite is mostly in the cases people forget:

  • Typical: the ordinary, realistic input
  • Empty: zero items, empty string, no match, null where permitted
  • One: the case where off-by-one hides
  • Many: enough to expose ordering, pagination, accumulation
  • Boundary: exactly at the limit, one either side
  • Invalid: wrong type, wrong shape, out of range. What should happen? Assert that.
  • Duplicate / out of order: for anything collection- or sequence-shaped
  • Failure of a dependency: timeout, error, partial result

Read the full file on GitHub · 102 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. 6d ago First seen · 102 lines · 87 tokens per session scan A 8a54e76c6a98

Subscribe to this mod's changes

unit-testing is a skill published in the GitHub repository OKHP3/skillz (3 stars, last pushed yesterday), licensed MIT. It adds 87 tokens to every session and 1,147 once invoked, about $0.0004 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

A test-writing helper that creates unit or integration tests from the code's actual behavior and contracts. Unit tests check small pieces of code, while integration tests check how real components work together.

laolaoshiren/claude-code-skills-zh · 79 tokens

111-java-maven-dependencies

Use when you need to add or evaluate Maven dependencies that improve code quality or domain modeling — including nullness annotations (JSpecify), static analysis (Error Prone + NullAway), functional programming (VAVR), architecture testing (ArchUnit), or money and currency support (JavaMoney) — and want a…

jabrena/plinth · 133 tokens

130-java-testing-strategies

Use when you need to apply testing strategies for Java code — RIGHT-BICEP to guide test creation, A-TRIP for test quality characteristics, or CORRECT for verifying boundary conditions. This should trigger for requests such as Review Java code for testing strategies; Apply RIGHT-BICEP testing strategies in Java code…

jabrena/plinth · 96 tokens

131-java-testing-unit-testing

Use when you need to review, improve, or write Java unit tests — including migrating from JUnit 4 to JUnit 5, adopting AssertJ for fluent assertions, structuring tests with Given-When-Then, ensuring test independence, applying parameterized tests, mocking dependencies with Mockito, verifying boundary conditions…

jabrena/plinth · 160 tokens

421-frameworks-quarkus-testing-unit-tests

Use when you need to write fast unit tests for Quarkus applications — including pure tests with @ExtendWith(MockitoExtension.class), @QuarkusTest with @InjectMock for full CDI mock replacement, @InjectSpy for partial CDI bean mocking, REST Assured for resource-focused tests, @ParameterizedTest with @CsvSource /…

jabrena/plinth · 205 tokens

coverage-enhancer

Analyze existing test suites and source code to suggest additional unit tests that improve test coverage. Use this skill when working with test files and source code to identify untested code paths, missing edge cases, uncovered branches, untested error conditions, and gaps in test coverage. Supports major testing…

ArabelaTso/Skills-4-SE · 84 tokens