test-driven-development

test-driven-development is a skill for Claude Code from bostonaholic/rpikit. It costs 42 tokens per session (1,275 once invoked), scanned A, original, MIT.

Test-driven development, or TDD, is a way to build software by writing a failing test before writing the production code, then making it pass and improving the code.

In plain words
What is it for?
Use it when adding features or fixing bugs through the RED-GREEN-REFACTOR cycle: failing test, working code, and cleanup.
Why use it?
It makes the required behaviour explicit and provides evidence that the implementation works instead of only testing after the fact.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the rpikit plugin — 16 skills, 7 agents shipped together

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

Made for: Claude Code.

Or install rpikit, the plugin that ships this one along with the rest of its 16 skills, 7 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-driven-development

README.md
[![agentmods](https://agentmods.dev/badge/skills/bostonaholic/rpikit/test-driven-development.svg)](https://agentmods.dev/skills/bostonaholic/rpikit/test-driven-development)
Your own site
<a href="https://agentmods.dev/skills/bostonaholic/rpikit/test-driven-development"><img src="https://agentmods.dev/badge/skills/bostonaholic/rpikit/test-driven-development.svg" alt="Measured on agentmods" height="20"></a>
Per session 42 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,275 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.1 $0.00042 $0.01275
Opus 5 $0.00021 $0.00638
Sonnet 5 $0.00008 $0.00255
Haiku 4.5 $0.00004 $0.00128

Measured 6d ago against content hash abc04e23ad2d, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

test-driven-development 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 6d 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-driven-development/SKILL.md · 206 lines

How it starts

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

Test-Driven Development

Write tests first, then implementation. No production code without a failing test.

Purpose

TDD ensures code correctness through disciplined test-first development. Tests written after implementation prove nothing - they pass immediately, providing no evidence the code works correctly. This skill enforces the RED-GREEN-REFACTOR cycle as a non-negotiable practice.

The Iron Law

NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST.

If you write code before the test, you must delete it and start over. The test drives the implementation, not the other way around.

The Cycle

RED: Write a Failing Test

Write ONE minimal test that demonstrates the required behavior:

  1. Test the public interface, not internals
  2. Never mock what you can use for real
  3. Name the test to describe the behavior
  4. Run the test - it MUST fail

Mandatory verification:

Run the test. Confirm it fails for the RIGHT reason:
- Missing function/method (expected)
- Wrong return value (expected)
- NOT: Syntax error
- NOT: Import error
- NOT: Test framework misconfiguration

If the test passes immediately, you've written it wrong or the feature already exists. Investigate before proceeding.

GREEN: Write Minimal Code

Write the SIMPLEST code that makes the test pass:

  1. No extra features
  2. No premature optimization
  3. No "while I'm here" additions
  4. Just enough to satisfy the test

Mandatory verification:

Run the test. Confirm:
- The new test passes
- All other tests still pass
- No new warnings or errors

REFACTOR: Improve Without Breaking

Improve code quality while keeping tests green:

  1. Remove duplication
  2. Improve names
  3. Extract helpers
  4. Simplify logic

After each change:

Run all tests. They must still pass.
If any test fails, revert the refactor.

Cycle Example

Requirement: Function that validates email addresses

RED:
  Write test: expect(isValidEmail("[email protected]")).toBe(true)
  Run test: FAIL - isValidEmail is not defined
  Correct failure reason: function doesn't exist yet

GREEN:
  Write: function isValidEmail(email) { return true; }
  Run test: PASS
  All tests pass

RED:
  Write test: expect(isValidEmail("invalid")).toBe(false)
  Run test: FAIL - Expected false, got true
  Correct failure reason: no validation logic yet

GREEN:
  Write: function isValidEmail(email) { return email.includes("@"); }
  Run test: PASS
  All tests pass

REFACTOR:
  Extract regex pattern to constant
  Run tests: PASS
  Continue improving...

Read the full file on GitHub · 206 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. 6d ago First seen · 206 lines · 42 tokens per session scan A abc04e23ad2d

Subscribe to this mod's changes

test-driven-development is a skill published in the GitHub repository bostonaholic/rpikit (20 stars, last pushed 5d ago), licensed MIT. It adds 42 tokens to every session and 1,275 once invoked, about $0.0002 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

contract

Outcome-driven Cortex function development — declares a behavioral contract before generation begins, enforces evidence-tiered proof before $ship, and defends against the self-oracle evaluation failure mode.

Snowflake-Labs/cocoplus · 38 tokens

ap-policies

Attach a completion policy gate (shell check or judge-agent rubric) to a session or fan-in group so turn-end only passes when the gate is green, then optionally auto-commit pending human ack. Use when the user says "gate this session on tests passing", "attach a policy", "commit only if tests are green", "judge…

agentproto/ts · 83 tokens

pn-writing-skills

Applies TDD to skill authoring: validation scenarios first, then SKILL.md. Use when creating new skills, editing existing skills, or verifying skills work before deployment.

perniemann/pnCore · 40 tokens

pn-systematic-debugging

Root cause analysis with triage mode — Phase 0 feedback loop, investigate first, one question max, then isolate, hypothesize, confirm. Outputs TDD fix plan with RED-GREEN cycles; optional GitHub issue via GitHub MCP. Use when debugging a failure or bug.

perniemann/pnCore · 63 tokens

test-driven-development

Use when implementing any feature or bugfix, before writing implementation code.

Wide-Moat/open-computer-use · 17 tokens

pn-discipline-philosophy

Defines engineering discipline: test-first, root-cause before fix, minimal change, measure-before-optimize, review/second look, evidence over guess. Use when implementing features, debugging, planning, or establishing development practices. Aligns with TDD, systematic debugging, and RCA practices (current).

perniemann/pnCore · 66 tokens