tdd

tdd is a skill for Claude Code from dinhnguyenngoc/spec-driven-claude-code. It costs 16 tokens per session (1,043 once invoked), scanned A, original, MIT.

A test-first development guide based on TDD, or Test-Driven Development: write a failing test, add the smallest code that passes it, then improve the code.

In plain words
What is it for?
Use it when adding features, fixing bugs, or writing tests, following the RED-GREEN-REFACTOR cycle.
Why use it?
It makes expected behavior explicit before implementation and helps prove that new features and bug fixes work.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

Not installable on its own: it reads a path above its own folder, which only exists inside its repository. The line is The pattern catalog — **Test Pyramid, AAA structure, Test Doubles preference order, naming convention, `WebApplicationFactory` integration templates, FluentAsse.

Install

Getting it into your agent

There is no command for this one: it runs only inside a plugin, and the catalogue could not identify which plugin ships it. The source is linked below.

Made for: Claude Code.

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 tdd

README.md
[![agentmods](https://agentmods.dev/badge/skills/dinhnguyenngoc/spec-driven-claude-code/tdd.svg)](https://agentmods.dev/skills/dinhnguyenngoc/spec-driven-claude-code/tdd)
Your own site
<a href="https://agentmods.dev/skills/dinhnguyenngoc/spec-driven-claude-code/tdd"><img src="https://agentmods.dev/badge/skills/dinhnguyenngoc/spec-driven-claude-code/tdd.svg" alt="Measured on agentmods" height="20"></a>
Per session 16 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,043 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.00016 $0.01043
Opus 5 $0.00008 $0.00522
Sonnet 5 $0.00003 $0.00209
Haiku 4.5 $0.00002 $0.00104

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

Security

Grade A, and why

tdd 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.

.claude/skills/tdd/SKILL.md · 201 lines

How it starts

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

Test-Driven Development Skill

Overview

TDD transforms testing from an afterthought into the foundation of development. Tests are proof that code works correctly.

When to Invoke

  • Writing new features
  • Fixing bugs (Prove-It pattern)
  • When asked to write tests
  • Before any implementation work

Core Cycle: RED-GREEN-REFACTOR

RED Phase

Write a test that describes expected behavior. It must fail.

public class DiscountCalculatorTests
{
    private readonly DiscountCalculator _sut;

    public DiscountCalculatorTests()
    {
        _sut = new DiscountCalculator();
    }

    [Fact]
    public void Calculate_WhenOrderOverThreshold_AppliesTenPercentDiscount()
    {
        // Arrange
        var orderAmount = 150m;

        // Act
        var discount = _sut.Calculate(orderAmount);

        // Assert
        discount.Should().Be(15m);
    }
}

Run: dotnet test → Should FAIL

GREEN Phase

Write minimal code to pass the test. No extras.

public class DiscountCalculator
{
    public decimal Calculate(decimal amount)
    {
        if (amount > 100)
            return amount * 0.1m;
        return 0;
    }
}

Run: dotnet test → Should PASS

REFACTOR Phase

Improve code while keeping tests green.

public class DiscountCalculator
{
    private const decimal DiscountThreshold = 100m;
    private const decimal DiscountRate = 0.1m;

    public decimal Calculate(decimal amount)
    {
        if (amount <= DiscountThreshold)
            return 0;
        
        return amount * DiscountRate;
    }
}

Run: dotnet test → Should still PASS


Prove-It Pattern (Bug Fixes)

Step 1: Write Failing Test

[Fact]
public void GetTotal_WhenCartIsEmpty_ReturnsZeroWithoutError()
{
    // Arrange — This test should FAIL with buggy code
    var cart = new Cart(items: Array.Empty<CartItem>());

    // Act
    var act = () => cart.GetTotal();

    // Assert
    act.Should().NotThrow();
    cart.GetTotal().Should().Be(0);
}

Read the full file on GitHub · 201 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 · 201 lines · 16 tokens per session scan A 587960190037

Subscribe to this mod's changes

tdd is a skill published in the GitHub repository dinhnguyenngoc/spec-driven-claude-code (20 stars, last pushed 7d ago), licensed MIT. It adds 16 tokens to every session and 1,043 once invoked, about $0.0001 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.