add-tests

A guide for generating tests for existing code, including normal behavior, errors, and unusual inputs.

In plain words
What is it for?
Use it to test functions, methods, or classes, covering successful results, invalid input, dependency failures, empty values, boundaries, and other edge cases.
Why use it?
It reduces the work of planning test cases and keeps new tests aligned with the project's testing framework and conventions.

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/soulcodex/agentic/add-tests
Any agent
npx skills add soulcodex/agentic --skill add-tests
Clone the repo
git clone --depth 1 https://github.com/soulcodex/agentic

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 462 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.00462
Opus 5 $0.00034 $0.00231
Sonnet 5 $0.00013 $0.00092
Haiku 4.5 $0.00007 $0.00046

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

Security

Grade A, and why

add-tests 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.

skills/development/add-tests/SKILL.md · 70 lines

What it actually says

Add Tests Skill

Generate comprehensive tests for the specified code.

Step 1 — Read the Target Code

Read the file(s) the user specifies. If no file is specified, ask which code to test.

Identify:

  • The public API (exported functions, public methods)
  • Dependencies (what should be mocked vs real)
  • Return types and error types
  • Preconditions and postconditions

Step 2 — Identify Test Cases

For each public function/method, identify:

Happy path

  • Standard input → expected output

Error cases

  • Invalid input → expected error
  • Dependency failure → expected error propagation

Edge cases

  • Empty collections, zero values, null/undefined
  • Boundary values (min, max)
  • Concurrent access (if applicable)

Step 3 — Write the Tests

Follow the project's existing test file conventions:

  • Use the same test framework already in use (detect from package.json / go.mod / pyproject.toml)
  • Mirror the source file structure: user-service.tsuser-service.test.ts
  • Use AAA structure (Arrange / Act / Assert)
  • Name tests as behavior descriptions: it("returns null when user is not found")

Each test must:

  • Cover exactly one behavior
  • Be deterministic (freeze time, mock randomness)
  • Clean up any side effects

Step 4 — Output

Write the test file. If it already exists, add the new test cases without breaking existing ones.

After writing, list the test cases added and any coverage gaps that remain.

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 · 70 lines · 67 tokens per session scan A 6466da46e5b7

Subscribe to this mod's changes

add-tests is a skill published in the GitHub repository soulcodex/agentic (10 stars, last pushed 2d ago), licensed MIT. It adds 67 tokens to every session and 462 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

design-debt-audit

Inventory and prioritise accumulated design inconsistencies across a product. Use when drift has built up over time. For token coverage specifically use design-token-audit (designer-toolkit); for WCAG gaps use accessibility-audit (design-systems).

Owl-Listener/designer-skills · 59 tokens

design-impact-reporting

Communicate design's contribution to business and user outcomes in stakeholder language. Use when reporting results upward. For choosing the metrics in the first place, use metrics-definition (ux-strategy).

Owl-Listener/designer-skills · 44 tokens

research-repository

Build a repository that makes findings findable, reusable, and cumulative across teams. Use when the same research keeps getting redone. For synthesising one study, use affinity-diagram.

Owl-Listener/designer-skills · 43 tokens

survey-design

Design unbiased survey instruments — question wording, scales, and sampling — to measure attitudes at scale. Use when you need quantitative breadth. For behavioural experiments, use a-b-test-design (prototyping-testing).

Owl-Listener/designer-skills · 47 tokens

design-system-governance

Define how the system evolves — contribution model, versioning, deprecation, and change management. Use when multiple teams contribute. For driving uptake use design-system-adoption (designer-toolkit); for design file history use version-control-strategy (design-ops).

Owl-Listener/designer-skills · 62 tokens

localization-design

Design for multiple languages, writing directions, and cultural contexts — text expansion, RTL mirroring, and locale formats. Use when shipping beyond one locale. For the words themselves, use ux-writing (designer-toolkit).

Owl-Listener/designer-skills · 49 tokens