tdd

tdd is a skill for Claude Code, Codex from lexler/skill-factory. It costs 42 tokens per session (1,139 once invoked), scanned A, original, Apache-2.0.

Test-driven development, or TDD, is a way to write code by first writing a test for the desired behavior, then adding only enough code to pass it, and finally improving the design.

In plain words
What is it for?
Use it whenever you add code and want tests to guide the design and verify each small change.
Why use it?
It provides a short feedback loop and exposes design problems early, before they are buried in a larger implementation.

Skill for Claude CodeCodex

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/lexler/skill-factory/tdd
Any agent
npx skills add lexler/skill-factory --skill tdd
Clone the repo
git clone --depth 1 https://github.com/lexler/skill-factory

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 tdd

README.md
[![agentmods](https://agentmods.dev/badge/skills/lexler/skill-factory/tdd.svg)](https://agentmods.dev/skills/lexler/skill-factory/tdd)
Your own site
<a href="https://agentmods.dev/skills/lexler/skill-factory/tdd"><img src="https://agentmods.dev/badge/skills/lexler/skill-factory/tdd.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,139 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 $0.00042 $0.01139
Opus 5 $0.00021 $0.00570
Sonnet 5 $0.00008 $0.00228
Haiku 4.5 $0.00004 $0.00114

Measured 5d ago against content hash 78f373c0db75, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 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.

output_skills/testing/tdd/SKILL.md · 86 lines

How it starts

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

Test-Driven Development Process

TDD is a design technique that uses tests as a tool. Design emerges from usage, not speculation. Short feedback loops let you course-correct immediately. The resulting architecture is testable by design, not retrofitted. We are not trying to rush towards a feature completion, it's important that the code is correct and well-designed, it's crucial to be thorough and only add what tests demand.

When starting, announce: "Using TDD skill in mode: [auto|human]"

MODE (user specifies, default: auto)

  • auto: DO NOT ask for confirmation or approval. Proceed through all steps without stopping.
  • human: wait for confirmation at key points

STARTER_CHARACTER = 🔴 for red test, 🌱 for green, 🌀 when refactoring, always followed by a space

Core Rules

  1. ALL code changes follow TDD - Feature requests mid-stream are NOT exceptions. Write test first, then code.
  2. Write only one test at a time - focus on the simplest, lowest-hanging fruit test
  3. Predict failures - State what we expect to fail before running tests
  4. Two-step red phase:
    • First: Make it fail to compile (class/method doesn't exist)
    • Second: Make it compile but fail the assertion (return wrong value)
  5. Minimal code to pass - Just enough to make the test green. If no test requires it, don't write it.
  6. No comments in production code - Keep it clean unless specifically asked
  7. Run all tests every time - Not just the one you're working on
  8. Refactor at the first opportunity when the tests are green
  9. Test behavior, not implementation - check responses or state, not method calls
  10. Push back when something seems wrong or unclear

Test Planning

  1. Think about what the code you want to write should do
  2. Plan tests as single-line [TEST] comments. Example:
    [TEST] Zero plus a number is equal to that number
    [TEST] Add two positive numbers
    [TEST] Add two negative numbers
    [TEST] Adds a negative and a positive number
    [TEST] Division by zero is not allowed
    ...
    
  3. Check completeness - walk through ZOMBIES explicitly:
    • Zero/empty cases covered?
    • One item cases covered?
    • Many items cases covered?
    • Boundary transitions covered?
    • Interface clarity verified?
    • Exceptions/errors covered?
  4. If MODE is human, wait for confirmation after test planning

Read the full file on GitHub · 86 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 · 86 lines · 42 tokens per session scan A 78f373c0db75

Subscribe to this mod's changes

tdd is a skill published in the GitHub repository lexler/skill-factory (232 stars, last pushed 10d ago), licensed Apache-2.0. It adds 42 tokens to every session and 1,139 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.