testing-conventions

testing-conventions is a skill for Claude Code from w2ur/claude-code-setup. It costs 81 tokens per session (662 once invoked), scanned A, original, MIT.

Shared rules for testing projects, including unit tests, regression tests, and property tests. A property test checks that a rule continues to hold across many generated inputs rather than one chosen example.

In plain words
What is it for?
Use it when writing tests, adding a test for a bug fix, testing pure data transformations, or choosing generated inputs and numeric tolerances.
Why use it?
It makes bug fixes traceable and helps prevent tests from failing because of unrealistic generated values or measurement tolerances.

Skill for Claude Code

Written for Claude Code: user-invocable in frontmatter. Also seen: reads .claude/ paths; mentions CLAUDE.md.

Good fit Use it when writing tests, adding a test for a bug fix, testing pure data transformations, or choosing generated inputs and numeric tolerances.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/w2ur/claude-code-setup/testing-conventions
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 w2ur/claude-code-setup --skill testing-conventions
Clone the repo
git clone --depth 1 https://github.com/w2ur/claude-code-setup

Made for: Claude Code.

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 testing-conventions

README.md
[![agentmods](https://agentmods.dev/badge/skills/w2ur/claude-code-setup/testing-conventions/github.svg)](https://agentmods.dev/skills/w2ur/claude-code-setup/testing-conventions)
Your own site
<a href="https://agentmods.dev/skills/w2ur/claude-code-setup/testing-conventions"><img src="https://agentmods.dev/badge/skills/w2ur/claude-code-setup/testing-conventions/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 testing-conventions

Your own site · 80×15
<a href="https://agentmods.dev/skills/w2ur/claude-code-setup/testing-conventions"><img src="https://agentmods.dev/badge/skills/w2ur/claude-code-setup/testing-conventions.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 81 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 662 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.00081 $0.00662
Opus 5.5 $0.00032 $0.00265
Sonnet 5.5 $0.00016 $0.00132
Haiku 4.5 $0.00008 $0.00066

Measured 21d ago against content hash 08d0e9774574, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

testing-conventions 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 21d 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/testing-conventions/SKILL.md · 63 lines

How it starts

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

Testing conventions

The rules live in ~/.claude/CLAUDE.md. This skill holds the formats and settings.

Unit and regression

  • Unit tests for all logic.

  • A regression test alongside every bug fix, carrying the commit that fixed it:

    // Regression: <commit-hash> — <bug description>
    

    The hash makes the test self-documenting: a future reader can pull the fix and the reasoning without archaeology in the test file itself.

Property tests for pure transforms

  • TypeScript → fast-check
  • Python → hypothesis
  • File naming: foo.property.test.ts alongside the unit tests.

Financial-math arbitraries — settings tuned by measurement

setting value why
float arbitraries noNaN, noDefaultInfinity otherwise every property fails on degenerate inputs rather than on real ones
runs ≥ 1000 the default run count does not reach the interesting tail
tolerance 1e-6 not 1e-10 — measured too tight at scale. Accumulated float error over a long series exceeds 1e-10 legitimately, so the tighter tolerance reports false failures.

The 1e-10 value looks more rigorous and is the obvious thing to reach for. It was tried and it was wrong. Use 1e-6.

A test can pin a defect — read its intent before "fixing" it

When a check disagrees with what you expect, read the test's intent before assuming the code is wrong. Twice in a single day the test was the one asserting the truth:

  • test_check_ignores_generic_data_drift asserted "data is synced but not guarded" — the surprising behaviour was the deliberate one, named in the test.
  • A Python and a TypeScript implementation each pinned the other's answer as correct, so "fixing" either one to match intuition would have broken the pair.

A test whose name states an intent is evidence about the design, not just about the code path.

What a green suite does not cover

Two measured blind spots in this portfolio:

  • UI components are not unit-tested by convention. In my-fitness-app, 1,155 tests passed against a tree that would not build — a deleted module was still imported by two components. Only the build gate caught it.
  • A route-handler test never runs the middleware. A gated API route can ship 100% broken with a fully green suite. Test the middleware path separately.

Read the full file on GitHub · 63 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. 21d ago Changed · -9 lines 08d0e9774574
  2. 1mo ago First seen · 72 lines · 81 tokens per session scan A 77629ef06b48

Subscribe to this mod's changes

testing-conventions is a skill published in the GitHub repository w2ur/claude-code-setup (2 stars, last pushed 3d ago), licensed MIT. It adds 81 tokens to every session and 662 once invoked, about $0.0003 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-08-31.