test-write

test-write is a skill for Claude Code, Codex from kazdenc/builder-skills. It costs 63 tokens per session (2,065 once invoked), scanned A, original, MIT.

A guide for generating tests for existing code. It covers unit tests for small pieces of code, integration tests for connected parts, and end-to-end tests for complete user flows.

In plain words
What is it for?
It helps write tests for functions, React components, hooks, and other existing code, using Vitest and Testing Library by default.
Why use it?
It helps find real bugs by checking normal results, side effects, edge cases, and errors instead of testing only the happy path.

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/kazdenc/builder-skills/test-write
Any agent
npx skills add kazdenc/builder-skills --skill test-write
Clone the repo
git clone --depth 1 https://github.com/kazdenc/builder-skills

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-write

README.md
[![agentmods](https://agentmods.dev/badge/skills/kazdenc/builder-skills/test-write.svg)](https://agentmods.dev/skills/kazdenc/builder-skills/test-write)
Your own site
<a href="https://agentmods.dev/skills/kazdenc/builder-skills/test-write"><img src="https://agentmods.dev/badge/skills/kazdenc/builder-skills/test-write.svg" alt="Measured on agentmods" height="20"></a>
Per session 63 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,065 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.00063 $0.02065
Opus 5 $0.00032 $0.01033
Sonnet 5 $0.00013 $0.00413
Haiku 4.5 $0.00006 $0.00206

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

Security

Grade A, and why

test-write 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 4d 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.

.claude/skills/dev/test/test-write/SKILL.md · 240 lines

How it starts

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

Write Tests

Generate tests that catch real bugs and survive refactors. Every test should answer: what behavior breaks if this test fails?

Step 1: Read the Code

Before writing any test, understand the code under test. If the user provides a file or function, read it first.

What to identify Why it matters Watch out for
Inputs These become your test parameters Assuming only happy-path inputs
Outputs / return values These are your assertions Testing internal state instead of outputs
Side effects These need mocking or verification Missing async side effects, event emissions
Edge cases These are where bugs hide null, undefined, empty arrays, boundary values, concurrent calls
Error paths These need explicit test coverage Only testing success cases

Step 2: Determine Test Type

Match the code to the right kind of test.

Code under test Test type Tools
Pure function (util, helper, transformer) Unit test Vitest
React component Component test Vitest + @testing-library/react + @testing-library/user-event
React hook Hook test Vitest + @testing-library/react (renderHook)
API route / server handler Integration test Vitest + supertest or direct handler invocation
Full user flow (multi-page, auth) E2E test Playwright
Redux / Zustand store Unit test Vitest

Step 3: Write Tests Using the AAA Pattern

Structure every test as Arrange, Act, Assert. This keeps tests readable and intention-revealing.

describe('functionName', () => {
  it('should [expected behavior] when [condition]', () => {
    // Arrange — set up inputs and dependencies
    const input = { name: 'test', value: 42 };

    // Act — call the code under test
    const result = functionName(input);

    // Assert — verify the output
    expect(result).toEqual({ processed: true, name: 'test' });
  });
});

Read the full file on GitHub · 240 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. 4d ago First seen · 240 lines · 63 tokens per session scan A be575228c2e2

Subscribe to this mod's changes

test-write is a skill published in the GitHub repository kazdenc/builder-skills (44 stars, last pushed 5mo ago), licensed MIT. It adds 63 tokens to every session and 2,065 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-30.

Related

Other skills, from other repositories

saas-testing

SaaS uygulaması için test stratejisi kur. Vitest ile birim test, Playwright ile E2E test, API route testi, webhook mock, Stripe test modu ve CI entegrasyonu. Bu skill'i kullanıcı test, test yazma, E2E, birim test, Playwright, Vitest, coverage veya kalite güvencesi ile ilgili bir şey istediğinde kullan. "Test yaz"…

komunite/tezgah · 115 tokens

testing-conventions

Testing conventions covering unit tests, component tests, and E2E tests. Auto-triggers when writing or modifying test files. Uses Vitest for unit/component tests and Playwright for E2E tests.

yend724/agent-skills · 45 tokens

designing-tests

Designs and implements testing strategies for any codebase. Use when adding tests, improving coverage, setting up testing infrastructure, debugging test failures, or when asked about unit tests, integration tests, or E2E testing.

CloudAI-X/claude-workflow-v2 · 48 tokens

verify

Build/launch/drive recipe for verifying apps/docs changes at runtime (demos, docs pages, llms.txt).

meursyphus/ssgoi · 26 tokens

prd-auto-test-loop

PRD 驱动的自动化测试编排技能。用于把每版 PRD 的测试计划、AI 自测与自修复、测试报告标准化落地;适用于按验收标准拆分 Unit/Integration/E2E、划分自动化与人工边界、生成版本化 TESTPLAN/TESTREPORT 的场景。.

yunshu0909/yunshu_skillshub · 79 tokens

tanstack-start

Record and replay TanStack Start SSR with test-proxy-recorder. Tag server-side fetches (route loaders, server functions, server routes) with the x-test-rcrd-id session header so parallel replay stays correct. Lead with registerProxyFetch (patch global fetch once at the top of src/router.tsx)…

asmyshlyaev177/test-proxy-recorder · 194 tokens