test-writing

test-writing is a skill for Claude Code, Codex from jnMetaCode/skillet. It costs 43 tokens per session (526 once invoked), scanned A, original, MIT.

A guide to writing tests that check observable behavior and catch likely regressions. It emphasizes matching the existing test style, covering real code branches, and using mocks only at true system boundaries.

In plain words
What is it for?
Use it when adding tests for new code or creating regression tests for a bug fix, including normal, error, and edge-case behavior.
Why use it?
It helps avoid tests that merely copy implementation details or miss the errors and edge cases the code can actually encounter.

Skill for Claude CodeCodex

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

Good fit Use it when adding tests for new code or creating regression tests for a bug fix, including normal, error, and edge-case behavior.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/jnmetacode/skillet/test-writing
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 jnMetaCode/skillet --skill test-writing
Clone the repo
git clone --depth 1 https://github.com/jnMetaCode/skillet

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 test-writing

README.md
[![agentmods](https://agentmods.dev/badge/skills/jnmetacode/skillet/test-writing.svg)](https://agentmods.dev/skills/jnmetacode/skillet/test-writing)
Your own site
<a href="https://agentmods.dev/skills/jnmetacode/skillet/test-writing"><img src="https://agentmods.dev/badge/skills/jnmetacode/skillet/test-writing.svg" alt="Measured on agentmods" height="20"></a>
Per session 43 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 526 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.00043 $0.00526
Opus 5 $0.00022 $0.00263
Sonnet 5 $0.00009 $0.00105
Haiku 4.5 $0.00004 $0.00053

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

Security

Grade A, and why

test-writing 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 8d 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/test-writing/SKILL.md · 45 lines

What it actually says

test-writing

A test's value is the bug it catches later. Test behavior through the public surface, not implementation details — a good test survives a refactor; a bad one breaks with it.

Procedure

  1. Match the house style first: open 2–3 existing test files; copy their runner, naming, setup helpers and assertion idioms exactly.
  2. One behavior per test, named as a claim: install skips a broken entry and installs the rest — readable as a spec when the suite prints.
  3. Choose cases from the code's branches, not from imagination. Read the function: every if, every early return, every catch is a candidate. Priority order:
    • the happy path (one test, not five variations)
    • each error/edge branch (empty input, missing file, duplicate, too-long, zero/negative, unicode)
    • the bug you just fixed (regression test that fails without the fix — verify it actually fails by stashing the fix once)
  4. Real objects over mocks. Mock only true boundaries (network, clock, randomness). If a test needs four mocks, the unit is wrong — test one level higher. For clock/randomness, inject (now, seed) rather than patching globals.
  5. Make failure diagnosable: assert on specific values, not just truthiness; add a message when the assertion isn't self-explanatory (assert.ok(hit1 >= 0.88, 'ranking change regressed recall')).
  6. Independence: each test builds its own state (tmp dirs via mkdtemp, fresh fixtures) and cleans up. Order-dependence is a flake factory.

Anti-patterns

  • Asserting a function was called instead of what it did.
  • Snapshot tests for logic (they assert "nothing changed", not "it's correct").
  • Testing private helpers directly — route through the public API.
  • A test that can't fail (asserting the mock you just configured).
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. 8d ago First seen · 45 lines · 43 tokens per session scan A e7ec70cf8a48

Subscribe to this mod's changes

test-writing is a skill published in the GitHub repository jnMetaCode/skillet (1 stars, last pushed 2mo ago), licensed MIT. It adds 43 tokens to every session and 526 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-08-31.