test-first

test-first is a skill for Claude Code from duthaho/claudekit. It costs 106 tokens per session (2,457 once invoked), scanned A, original, MIT.

A test-first development skill that follows TDD, or test-driven development: write a failing test, make it pass with the smallest change, then improve the code.

In plain words
What is it for?
Use it when adding features, fixing bugs, or refactoring code with testable behavior. It is not intended for purely visual work or exploratory prototypes.
Why use it?
It makes the desired behavior explicit before implementation and provides evidence that changes work. This is especially useful for preventing bugs from returning.

Skill for Claude Code

Written for Claude Code: user-invocable in frontmatter.

Part of the claudekit plugin — 15 skills, 8 agents shipped together

Good fit Use it when adding features, fixing bugs, or refactoring code with testable behavior. It is not intended for purely visual work or exploratory prototypes.

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

Made for: Claude Code.

Or install claudekit, the plugin that ships this one along with the rest of its 15 skills, 8 agents.

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

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/duthaho/claudekit/test-first"><img src="https://agentmods.dev/badge/skills/duthaho/claudekit/test-first.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 106 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,457 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00106 $0.02457
Opus 5.5 $0.00042 $0.00983
Sonnet 5.5 $0.00021 $0.00491
Haiku 4.5 $0.00011 $0.00246

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

Security

Grade A, and why

test-first 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-first/SKILL.md · 182 lines

How it starts

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

Test First

Overview

Red-green-refactor TDD with strict evidence requirements. The skill exists because the most common testing failure isn't missing tests — it's tests written after the code, designed to pass against the implementation rather than to specify it. Test-first inverts the order: a failing test asserts the desired behavior, the smallest implementation makes it pass, and refactoring runs with the test as a safety net. Each step produces test runner output that goes into the PR. The skill is for engineers shipping production code — not a TDD evangelism doc.

When to Use

  • Implementing a new feature with a testable surface (function, endpoint, CLI command, UI behavior with a test harness)
  • Fixing a bug — the regression test is the test you write first
  • Refactoring code that has incomplete test coverage; tests come before the refactor
  • Onboarding to legacy code where you need to characterize behavior before changing it

When NOT to Use

  • Pure UX/visual work with no behavioral assertion (use visual review instead)
  • Exploratory spike work where the goal is learning, not shipping (mark spike branches and write tests when promoting to mainline)
  • Writing a one-off script that runs once and is discarded

Process

Step 1: Pick the smallest testable behavior

Goal: Identify one observable behavior to assert, smaller than the task.

Inputs: A task from your plan with an Acceptance: line.

Actions:

  1. Read the acceptance criterion. Extract one specific input/output pair you could write as a test.
  2. If the criterion is too broad ("handles user signup correctly"), narrow it to one case: "user signup with a duplicate email returns 409."
  3. Name the test in a sentence form: it <verb>s <subject> when <condition>.

Output: A test name and a one-line description of the input/output pair.

Step 2: Write the failing test (RED)

Goal: A test that currently fails for the right reason.

Inputs: The test name from Step 1.

Read the full file on GitHub · 182 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 · 182 lines · 106 tokens per session scan A 4e0c6c0ef698

Subscribe to this mod's changes

test-first is a skill published in the GitHub repository duthaho/claudekit (97 stars, last pushed 2mo ago), licensed MIT. It adds 106 tokens to every session and 2,457 once invoked, about $0.0004 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.