test-writer

A coding aid for creating or expanding automated tests, including tests of individual units, connected parts, full user journeys, and agreements between services.

In plain words
What is it for?
Use it to write tests for a function or module, add coverage, set up a testing framework, create cases from existing code, or check behaviour automatically.
Why use it?
It helps catch broken behaviour, error cases, and regressions before they reach users. It also reduces the risk of tests passing while important problems remain unchecked.

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/code-saurabh/openskills/test-writer
Any agent
npx skills add CODE-SAURABH/OpenSkills --skill test-writer
Clone the repo
git clone --depth 1 https://github.com/CODE-SAURABH/OpenSkills

Made for: Claude Code, Codex.

Per session 67 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,026 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.00067 $0.03026
Opus 5 $0.00034 $0.01513
Sonnet 5 $0.00013 $0.00605
Haiku 4.5 $0.00007 $0.00303

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

Security

Grade A, and why

test-writer 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 2d 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.

test-writer/SKILL.md · 343 lines

How it starts

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

Test Writing

Approach every test as a senior engineer who has been burned by tests that passed but shipped broken software. Tests are not a checkbox — they are executable specifications of what the code must do. A test suite that gives false confidence is worse than no tests at all.

Your job is not to maximize line coverage. Your job is to make it impossible for a regression to ship undetected.


Test Writing Principles

  • Tests are specifications, not afterthoughts. A test describes a contract: given this input, this system must produce this output. Write the contract clearly before implementing it.
  • Test behaviour, not implementation. Tests that know how a function works internally are brittle. Tests that only know what a function does are durable. Never test private methods directly.
  • One concept per test. A test that asserts three things is three tests. When it fails, you will not know which of the three broke.
  • The sad path deserves equal effort. Most bugs live in error paths, edge cases, and boundary conditions — not in the happy path that the developer thought about when writing the code.
  • Tests must be independent. No test should depend on the execution order of other tests, or on shared mutable state. Every test sets up its own data and tears it down.
  • Fast tests run. Slow tests get skipped. Keep unit tests under 50ms each. Isolate anything slow (DB, network, filesystem) behind mocks or test containers.
  • A flaky test is a lie. A test that sometimes passes and sometimes fails provides no signal. Fix or delete it — never commit a known-flaky test.

Step 0: Before Writing Any Test

  1. Read the code under test — understand the function's contract: what does it take, what does it return, what side effects does it have?
  2. Identify all exit paths — draw a mental decision tree: every if, every try/catch, every early return is a branch that needs coverage
  3. Name the test cases first — list every scenario you will test in plain English before writing a single line of test code
  4. Identify dependencies — what does this code call externally (DB, API, filesystem, clock, random)? These must be controlled in tests
  5. Choose the right test type — not everything needs a unit test; decide whether this is a unit, integration, E2E, or contract test before starting

Read the full file on GitHub · 343 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. 2d ago First seen · 343 lines · 67 tokens per session scan A b93347450fe2

Subscribe to this mod's changes

test-writer is a skill published in the GitHub repository CODE-SAURABH/OpenSkills (2 stars, last pushed 1mo ago), licensed MIT. It adds 67 tokens to every session and 3,026 once invoked, about $0.0003 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.

Related

Other skills, from other repositories