write-tests

write-tests is a skill for Claude Code, Codex from edimuj/tokenlean. It costs 52 tokens per session (679 once invoked), scanned A, original, MIT.

A workflow for writing tests after studying the codebase’s existing test style, public interfaces, dependencies, and likely edge cases. It covers normal inputs, invalid data, errors, empty values, and boundaries.

In plain words
What is it for?
Use it to add test files, expand coverage, test exported functions, match the project’s test runner and assertions, and validate the new tests.
Why use it?
It avoids tests that merely follow implementation details or conflict with the project’s established testing conventions.

Skill for Claude CodeCodex

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

Good fit Use it to add test files, expand coverage, test exported functions, match the project’s test runner and assertions, and validate the new tests.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/edimuj/tokenlean/write-tests
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 edimuj/tokenlean --skill write-tests
Clone the repo
git clone --depth 1 https://github.com/edimuj/tokenlean

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/edimuj/tokenlean/write-tests/github.svg)](https://agentmods.dev/skills/edimuj/tokenlean/write-tests)
Your own site
<a href="https://agentmods.dev/skills/edimuj/tokenlean/write-tests"><img src="https://agentmods.dev/badge/skills/edimuj/tokenlean/write-tests/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 write-tests

Your own site · 80×15
<a href="https://agentmods.dev/skills/edimuj/tokenlean/write-tests"><img src="https://agentmods.dev/badge/skills/edimuj/tokenlean/write-tests.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 52 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 679 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.00052 $0.00679
Opus 5.5 $0.00021 $0.00272
Sonnet 5.5 $0.00010 $0.00136
Haiku 4.5 $0.00005 $0.00068

Measured 1mo ago against content hash cb0761184b5d, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

write-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 1mo 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/claude/write-tests/SKILL.md · 93 lines

How it starts

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

Write Tests

Write tests that match project conventions and cover real edge cases.

Workflow

Discover → Understand → Design → Write → Validate

1. Discover

Find the testing landscape:

tl parallel \
  "testmap=tl test-map <file>" \
  "coverage=tl coverage <file>" \
  "example=tl example '*.test.*'" \
  "style=tl style"

2. Understand

Know the code before testing it:

tl parallel \
  "symbols=tl symbols <file>" \
  "exports=tl exports <file>" \
  "deps=tl deps <file>"
tl snippet <function> <file>   # Read each function to understand branches and edge cases

3. Design

For each exported function, identify:

  • Happy path (normal input, expected output)
  • Error cases (invalid input, missing data, exceptions)
  • Edge cases (empty input, boundary values, null/undefined)
tl parallel "flow=tl flow <function> <file>" "types=tl types <file>"

4. Write

  • Follow the pattern from existing test files found in step 1
  • Match the project's test runner, assertion style, and file naming
  • Colocate test files with source (or match existing convention)
  • Mock external dependencies identified by tl deps, not internal functions

5. Validate

tl parallel \
  "new=tl run '<test command> <new-test-file>'" \
  "coverage=tl coverage <file>" \
  "full=tl run '<full test suite>'"

Decision tree

Write tests → Do tests already exist for this file?
  ├─ Yes (extend) → tl test-map to find the test file
  │   → tl symbols on the test file to see what's covered
  │   → tl coverage to find gaps
  │   → Add missing cases following existing patterns
  ├─ No (create) → tl example "*.test.*" to learn project patterns
  │   → tl exports on source to prioritize public API
  │   → tl deps to identify what to mock
  │   → Create test file matching project conventions
  └─ Coverage target → tl coverage for current numbers
      → tl symbols to list all functions
      → Prioritize: exported > complex > simple
      → Write tests until target met

Read the full file on GitHub · 93 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. 1mo ago First seen · 93 lines · 52 tokens per session scan A cb0761184b5d

Subscribe to this mod's changes

write-tests is a skill published in the GitHub repository edimuj/tokenlean (13 stars, last pushed 3mo ago), licensed MIT. It adds 52 tokens to every session and 679 once invoked, about $0.0002 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-30.

Related

Other skills, from other repositories

idor-testing

This skill should be used when the user asks to "test for insecure direct object references," "find IDOR vulnerabilities," "exploit broken access control," "enumerate user IDs or object references," or "bypass authorization to access other users' data." It provides comprehensive guidance for detecting, exploiting, and…

zebbern/claude-code-guide · 75 tokens

playwright-cli

Automates browser interactions for web testing, form filling, screenshots, and data extraction using playwright-cli. Use when the user needs to navigate websites, interact with web pages, fill forms, take screenshots, test web applications, extract information from web pages, mock network requests, manage browser…

zebbern/claude-code-guide · 67 tokens

playwright-skill

Battle-tested Playwright patterns for E2E, API, component, visual, accessibility, and security testing. Covers locators, fixtures, POM, network mocking, auth flows, debugging, CI/CD (GitHub Actions, GitLab, CircleCI, Azure, Jenkins), framework recipes (React, Next.js, Vue, Angular), and migration guides from…

zebbern/claude-code-guide · 87 tokens

playwright-core

Battle-tested Playwright patterns for E2E, API, component, visual, accessibility, and security testing. Covers locators, assertions, fixtures, network mocking, auth flows, debugging, and framework recipes for React, Next.js, Vue, and Angular. TypeScript and JavaScript.

zebbern/claude-code-guide · 62 tokens

playwright-ci

Production-ready CI/CD configurations for Playwright — GitHub Actions, GitLab CI, CircleCI, Azure DevOps, Jenkins, Docker, parallel sharding, reporting, code coverage, and global setup/teardown.

zebbern/claude-code-guide · 48 tokens

playwright-migration

Step-by-step migration guides for moving to Playwright from Cypress or Selenium/WebDriver — command mappings, architecture changes, and incremental adoption strategies.

zebbern/claude-code-guide · 33 tokens