test-writer

test-writer is a skill for Claude Code, Codex from chandrudp29/skillhub. It costs 40 tokens per session (887 once invoked), scanned A, original, MIT.

A testing guide for writing checks that verify functions, modules, and APIs behave correctly, including expected inputs, edge cases, and failures.

In plain words
What is it for?
Use it when adding tests, improving test coverage, testing before a refactor, or deciding what cases an implementation should handle.
Why use it?
It helps prevent tests that pass without detecting broken code and provides a clear order for covering important behavior.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions Codex.

Good fit Use it when adding tests, improving test coverage, testing before a refactor, or deciding what cases an implementation should handle.

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

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

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/chandrudp29/skillhub/test-writer"><img src="https://agentmods.dev/badge/skills/chandrudp29/skillhub/test-writer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 40 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 887 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.00040 $0.00887
Opus 5.5 $0.00016 $0.00355
Sonnet 5.5 $0.00008 $0.00177
Haiku 4.5 $0.00004 $0.00089

Measured 1mo ago against content hash c6cd6872bc23, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 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/test-writer/SKILL.md · 130 lines

How it starts

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

Test Writer

Writes tests that actually catch bugs — not tests that just run green.

When to Use

  • "Write tests for this function"
  • "Add tests before I refactor this"
  • "What should I test here?"
  • "My coverage is low — where do I start?"

What Makes a Test Valuable

A test is valuable if it would fail when the code is wrong and pass when the code is correct. A test that always passes regardless of the implementation has negative value — it creates false confidence.

Before writing any test, ask: "If I deleted the function body and replaced it with return null, would this test fail?" If no, the test is measuring nothing.

Test Categories (write in this order)

1. Happy Path

The expected behavior with valid inputs. Should be the first test, simplest to write.

2. Edge Cases

The boundaries where behavior changes:

  • Empty inputs (empty string, empty array, null, undefined)
  • Zero and negative numbers
  • Single-element collections
  • Maximum/minimum values
  • Boundary conditions (n=0, n=1, n=N, n=N+1)

3. Error Cases

What happens when things go wrong:

  • Invalid input types
  • Missing required fields
  • Values out of range
  • External service failures (mocked)
  • Concurrent access

4. Integration Points

Where this code meets other systems:

  • Database reads/writes produce expected results
  • External API calls are made with correct parameters
  • Events are emitted in the right order
  • State is cleaned up after use

Test Structure

Every test follows Arrange → Act → Assert:

def test_descriptive_name_of_what_is_being_verified():
    # Arrange — set up the exact state needed
    user = User(id=1, email="[email protected]", role="admin")
    
    # Act — run exactly one thing
    result = can_delete_post(user, post_id=42)
    
    # Assert — verify the specific outcome
    assert result is True

One assertion per test is a guideline, not a rule. Multiple assertions are fine when they verify a single behavior. Multiple behaviors in one test = split into multiple tests.

Read the full file on GitHub · 130 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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 · 130 lines · 40 tokens per session scan A c6cd6872bc23

Subscribe to this mod's changes

test-writer is a skill published in the GitHub repository chandrudp29/skillhub (14 stars, last pushed 3mo ago), licensed MIT. It adds 40 tokens to every session and 887 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

test-generator

Generate comprehensive unit, integration, and end-to-end tests. Use when adding test coverage, writing tests for new features, or improving existing test suites.

asgarovf/locusai · 33 tokens

caliber-testing

Writes Vitest tests following project patterns: tests/ directories, vi.mock() for module mocking with vi.hoisted() for test-time factories, global LLM mock from src/test/setup.ts, environment variable save/restore in beforeEach/afterEach, vi.clearAllMocks() lifecycle, and test file organization. Use when user says…

caliber-ai-org/ai-setup · 0 tokens

testing-expert

Expert-level software testing with unit tests, integration tests, E2E tests, TDD/BDD, and testing best practices. Use when the user mentions TDD, BDD, unit tests, integration tests, or end-to-end tests, or when the task involves Testing Fundamentals, Unit Testing, Integration Testing, or End-to-End Testing.

personamanagmentlayer/pcl · 73 tokens

ralphctl-debugging-and-error-recovery

Systematic root-cause debugging. Use when tests fail, builds break, something that worked before broke, or behaviour does not match expectations — when you need to figure out what broke and why. Follow stop-the-line → reproduce → localize → reduce → root-cause → guard-with-regression-test → verify, not guessing; the…

lukas-grigis/ralphctl · 95 tokens

test-driven-development

TDD workflow — Red, Green, Refactor cycle with practical examples.

furkangonel/cowrangler · 19 tokens

testing

Test writing SOP for unit, integration, and e2e tests (TDD) plus exploratory QA for web apps — find bugs, gather evidence, write reports.

furkangonel/cowrangler · 35 tokens