doughnut: Skill for Claude Code

.agents/skills/unit-testing/SKILL.md

unit-testing is a skill for Claude Code, Codex from nerds-odd-e/doughnut. It costs 38 tokens per session (1,720 once invoked), scanned A, original, MIT.

A style guide for writing small unit tests: fast tests that run code in one process through a stable public interface. Unit tests check one focused part of a program, while using realistic data and limiting mocks to outside services.

In plain words
What is it for?
Use it when adding or changing unit tests in any package, especially when testing controllers, components, command-line entry points, tools, validation, or algorithms.
Why use it?
It avoids brittle tests that depend on private implementation details or replace too much real code with mocks.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions CLAUDE.md; installed under .agents/ (shared by several agents); mentions AGENTS.md.

This is nerds-odd-e/doughnut's own configuration. It tells Claude Code and Codex how to work on doughnut itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything doughnut configures →

Reuse

Borrowing it

Nothing to install: this file belongs to nerds-odd-e/doughnut. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/nerds-odd-e/doughnut/main/.agents/skills/unit-testing/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/nerds-odd-e/doughnut

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/nerds-odd-e/doughnut/unit-testing/github.svg)](https://agentmods.dev/skills/nerds-odd-e/doughnut/unit-testing)
Your own site
<a href="https://agentmods.dev/skills/nerds-odd-e/doughnut/unit-testing"><img src="https://agentmods.dev/badge/skills/nerds-odd-e/doughnut/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/nerds-odd-e/doughnut/unit-testing"><img src="https://agentmods.dev/badge/skills/nerds-odd-e/doughnut/unit-testing.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 38 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,720 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.00038 $0.01720
Opus 5.5 $0.00015 $0.00688
Sonnet 5.5 $0.00008 $0.00344
Haiku 4.5 $0.00004 $0.00172

Measured 18d ago against content hash 1778c260cf9d, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 18d 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.

.agents/skills/unit-testing/SKILL.md · 109 lines

How it starts

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

"Small test" style

This repo’s automated tests are E2E or unit tests — nothing in between. Write unit tests in the "small test" style below.

A "small test" means: a fast, in-process unit test (JUnit, Vitest, Bach, …) that drives a stable boundary with crafted data/makeMe, exercises real lower-level production code, and mocks only external dependencies. Stack commands, entry points, and tooling stay in the package skills (frontend / frontend-testing, backend / backend-testing, cli, mcp-server).

Stable boundary

  • Drive the outermost (or domain-stable) interface. Prefer the public surface under test — e.g. a controller, mounted component, CLI run / runInteractive, MCP tool — or an interface that is itself a deliberate, domain-stable contract (pure algorithm, validation API). Do not add a test class per internal production class, and do not widen exports only so tests can reach helpers.
  • Cover lower layers with data, not with more test surfaces. Craft realistic, scenario-specific preconditions and fixtures so one boundary test exercises the real lower-level production routines. Prefer that over isolating each collaborator behind mocks or thin wrapper tests.
  • Build those fixtures with makeMe — keep construction concise (see below).
  • Do not mock unless external or exceptional. Mock only true external dependencies (third-party APIs, network services, and the like) or extremely rare special cases. Package rules name the allowed exceptions (OpenAIClient, frontend mockSdkService for the backend HTTP API, CLI spies on donut-api, etc.). Prefer the real database, real in-process collaborators, and real browser rendering inside the system under test.
  • Loud failures — Code that is allowed to fail loudly is not a unit-test subject for that failure. Policy: ADR 0006 Usage.

Focused assertions

  • One behavior per test. Assert only what this scenario uniquely establishes.
  • Canonical shape once. Shared post-conditions belong in one test. Sibling scenarios assert only their delta.
  • Different precondition ≠ re-assert unrelated post-condition. If outcome X is clearly independent of what changed in the setup, do not repeat X.
  • Prefer asserting the positive signal over “not the other message/alert” when the positive already distinguishes the case.
  • When a change removes something, the tests are those of the behavior that survives or replaces it. Write no test, assertion, fixture, or mock that observes the removed thing (not called, absent, ignored). Apply removal proof to each proof item. Rule: principle 7 in AGENTS.md / CLAUDE.md.
  • In loops (thresholds, retries, frame polls), assert the loop result, not the same intermediate outcome every iteration.

Read the full file on GitHub · 109 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. 18d ago Changed · +25 lines 1778c260cf9d
  2. 19d ago Changed · +1 lines 30f44309d27b
  3. 1mo ago First seen · 83 lines · 38 tokens per session scan A 03b5eab3467e

Subscribe to this mod's changes

unit-testing is a skill published in the GitHub repository nerds-odd-e/doughnut (50 stars, last pushed today), licensed MIT. It adds 38 tokens to every session and 1,720 once invoked, about $0.0002 per session on Opus 5.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-17.