test-driven-development

test-driven-development is a skill for Claude Code from endorphin-ai/hasbrains-agent-kit. It costs 61 tokens per session (2,944 once invoked), scanned A, original, MIT.

A test-first coding method called test-driven development (TDD). You write a test, confirm it fails, then write the smallest code that makes it pass and improve the design afterward.

In plain words
What is it for?
It guides feature work, bug fixes, refactoring, and behavior changes, including choosing suitable test layers and checking test quality.
Why use it?
It helps catch misunderstandings and regressions early by making the expected behavior explicit before implementation code exists.

Skill for Claude Code

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

Part of the agent-engineering plugin — 6 skills 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/endorphin-ai/hasbrains-agent-kit/test-driven-development
Any agent
npx skills add endorphin-ai/hasbrains-agent-kit --skill test-driven-development
Clone the repo
git clone --depth 1 https://github.com/endorphin-ai/hasbrains-agent-kit

Made for: Claude Code.

Or install agent-engineering, the plugin that ships this one along with the rest of its 6 skills.

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/endorphin-ai/hasbrains-agent-kit/test-driven-development.svg)](https://agentmods.dev/skills/endorphin-ai/hasbrains-agent-kit/test-driven-development)
Your own site
<a href="https://agentmods.dev/skills/endorphin-ai/hasbrains-agent-kit/test-driven-development"><img src="https://agentmods.dev/badge/skills/endorphin-ai/hasbrains-agent-kit/test-driven-development.svg" alt="Measured on agentmods" height="20"></a>
Per session 61 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,944 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.00061 $0.02944
Opus 5 $0.00030 $0.01472
Sonnet 5 $0.00012 $0.00589
Haiku 4.5 $0.00006 $0.00294

Measured 5d ago against content hash a7fe22aa9e69, 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 5d 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.

agent-engineering/skills/test-driven-development/SKILL.md · 395 lines

How it starts

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

Test-Driven Development (TDD)

Overview

Write the test first. Watch it fail. Write minimal code to pass.

Core principle: If you didn't watch the test fail, you don't know if it tests the right thing.

Violating the letter of the rules is violating the spirit of the rules.

This skill is language-agnostic. Wherever it says "test runner", use your stack's tool (Jest, pytest, RSpec, go test, JUnit, cargo test, …). Wherever it shows pseudocode, translate to your language's testing idiom.

When to Use

Always:

  • New features
  • Bug fixes
  • Refactoring
  • Behavior changes

Exceptions (ask your human partner):

  • Throwaway prototypes
  • Generated code (scaffolds you immediately rewrite)
  • Configuration files

Thinking "skip TDD just this once"? Stop. That's rationalization.

The Iron Law

NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST

Write code before the test? Delete it. Start over.

No exceptions:

  • Don't keep it as "reference"
  • Don't "adapt" it while writing tests
  • Don't look at it
  • Delete means delete

Implement fresh from the tests. Period.

Red-Green-Refactor

digraph tdd_cycle {
    rankdir=LR;
    red [label="RED\nWrite failing test", shape=box, style=filled, fillcolor="#ffcccc"];
    verify_red [label="Verify fails\ncorrectly", shape=diamond];
    green [label="GREEN\nMinimal code", shape=box, style=filled, fillcolor="#ccffcc"];
    verify_green [label="Verify passes\nAll green", shape=diamond];
    refactor [label="REFACTOR\nClean up", shape=box, style=filled, fillcolor="#ccccff"];
    next [label="Next", shape=ellipse];

    red -> verify_red;
    verify_red -> green [label="yes"];
    verify_red -> red [label="wrong\nfailure"];
    green -> verify_green;
    verify_green -> refactor [label="yes"];
    verify_green -> green [label="no"];
    refactor -> verify_green [label="stay\ngreen"];
    verify_green -> next;
    next -> red;
}

RED - Write Failing Test

Write one minimal test showing what should happen.

Read the full file on GitHub · 395 lines

Files

What ships with it

2 files 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. 5d ago First seen · 395 lines · 61 tokens per session scan A a7fe22aa9e69

Subscribe to this mod's changes

test-driven-development is a skill published in the GitHub repository endorphin-ai/hasbrains-agent-kit (4 stars, last pushed 1mo ago), licensed MIT. It adds 61 tokens to every session and 2,944 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-31.

Related

Other skills, from other repositories

tdd

Strict test-driven development (Beck-style). Use when writing new code, adding features, or fixing bugs with TDD discipline. TRIGGER when: user asks to use TDD, write tests first, or red/green/refactor. DO NOT TRIGGER when: writing tests after the fact, or user explicitly opts out of TDD.

patforna/auto-task · 72 tokens

klimkit-tdd

Implement behavior changes with narrow red-green-refactor loops and Klimkit proof. Use when adding features, fixing bugs with clear expected behavior, changing shared contracts, or when the user asks for TDD or test-first work.

klimentij/klimkit · 50 tokens

dare-execute

Executa uma task específica com implementação de código e testes. Use quando o usuário aprovar TASKS.md e quiser executar uma task. Implementa o código, roda testes (Ralph Loop) e valida até passar.

dewtech-technologies/dare-method · 49 tokens

writing-skills

Use when creating a new forge-skill, editing an existing skill, when planning to contribute to forge-skills, when a session has produced a one-off prompt that should be promoted to a skill, or when verifying a skill works before deployment.

aneja5/forge-skills · 53 tokens

tdd

Use when implementing features or fixing bugs test-first, when user mentions "red-green-refactor", when test discipline is required for a specific task, when incremental-implementation needs TDD enforcement, or when a behavior change needs a failing test before any code is written.

aneja5/forge-skills · 56 tokens

incremental-implementation

Use when .forge/tasks.yaml exists and implementation is starting, when executing a planned task list one task at a time, when a feature must ship in independently-verifiable slices, or when contracts in .forge/contracts/ need to be implemented against acceptance criteria.

aneja5/forge-skills · 56 tokens