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.
npx skills add kid-sid/codex-spellbook --skill unit-testinggit clone --depth 1 https://github.com/kid-sid/codex-spellbookWrote 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.
[](https://agentmods.dev/skills/kid-sid/codex-spellbook/unit-testing)<a href="https://agentmods.dev/skills/kid-sid/codex-spellbook/unit-testing"><img src="https://agentmods.dev/badge/skills/kid-sid/codex-spellbook/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.
<a href="https://agentmods.dev/skills/kid-sid/codex-spellbook/unit-testing"><img src="https://agentmods.dev/badge/skills/kid-sid/codex-spellbook/unit-testing.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00044 | $0.05103 |
| Opus 5 | $0.00022 | $0.02551 |
| Sonnet 5 | $0.00009 | $0.01021 |
| Haiku 4.5 | $0.00004 | $0.00510 |
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 5d 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.
How it starts
The opening of the file, as written. The whole thing — 678 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Unit Testing
Structured guidance for writing reliable, maintainable unit tests — covering test anatomy, mocking strategies, parameterized tests, TDD workflow, coverage strategy, and test organization across Python, TypeScript, and Go.
When to Activate
- Writing tests for a function, class, or module
- Setting up a test framework for a new project
- Mocking or stubbing external dependencies in tests
- Deciding what to unit test vs integration test
- Practising TDD (test-driven development) on a new feature
- Achieving or enforcing a coverage target
- Debugging a flaky or unclear test failure
Test Anatomy
Arrange / Act / Assert (AAA)
Every test has three distinct phases:
- Arrange — set up the inputs, dependencies, and state needed for the test
- Act — call the unit under test (exactly once)
- Assert — verify the outcome matches expectations
One assertion per logical concern means each test validates one observable behaviour. Multiple assert statements are fine as long as they all verify the same thing (e.g., both fields of a returned object).
Test Naming
| Language | Convention | Example |
|---|---|---|
| Python | test_<unit>_<scenario>_<expected_result> |
test_divide_by_zero_raises_value_error |
| TypeScript | describe('Unit') / it('should ...') |
it('should throw when dividing by zero') |
| Go | TestXxx with t.Run("SubtestName", ...) |
TestDivide/ByZero |
Well-Structured Test Examples
# Python — pytest
def test_calculate_total_with_discount_returns_reduced_price():
# Arrange
cart = Cart(items=[Item(price=100)])
discount = PercentageDiscount(rate=0.10)
# Act
total = calculate_total(cart, discount)
# Assert
assert total == 90.0
// TypeScript — Jest / Vitest
describe('calculateTotal', () => {
it('should return reduced price when discount is applied', () => {
// Arrange
const cart = { items: [{ price: 100 }] };
const discount = { rate: 0.10 };
// Act
const total = calculateTotal(cart, discount);
// Assert
expect(total).toBe(90.0);
});
});
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.
- 5d ago First seen · 678 lines · 44 tokens per session scan A 35ab5012fb73
unit-testing is a skill published in the GitHub repository kid-sid/codex-spellbook (21 stars, last pushed 4mo ago), licensed MIT. It adds 44 tokens to every session and 5,103 once invoked, about $0.0002 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.
Other skills, from other repositories
write-vibe-tests
Write or refactor Mistral Vibe tests with proper decoupling. Use when adding behavior coverage, testing ports/adapters, replacing brittle mocks, creating fakes, adding characterization tests before refactors, or changing tests under tests/ for vibe/core, vibe/cli, vibe/acp, tools, config, sessions, skills, hooks, MCP…
composing-matchers
Build compound Gomega assertions by combining matchers — And/SatisfyAll (all pass), Or/SatisfyAny (any pass), Not (negate), WithTransform to map the actual before matching, Satisfy for an ad-hoc predicate, HaveValue to dereference pointers/interfaces, HaveField for struct fields and method results, HaveEach for every…
nw-fp-clojure
Clojure language-specific patterns, data-first modeling, REPL-driven development, and spec.
nw-fp-fsharp
F# language-specific patterns, Railway-Oriented Programming, and Computation Expressions.
nw-fp-kotlin
Kotlin language-specific patterns with Arrow, Raise DSL, and coroutine-based effects.
nw-hexagonal-testing
5-layer agent output validation, I/O contract specification, vertical slice development, and test doubles policy with per-layer examples.