test-driven-development

test-driven-development is a skill for Claude Code, Codex from DevelopersGlobal/ai-agent-skills. It costs 32 tokens per session (848 once invoked), scanned A, original, MIT.

A coding method called test-driven development (TDD), where you write a test that fails, make the smallest code change to pass it, and then improve the code.

In plain words
What is it for?
Use it when adding features or functions, fixing bugs, or changing existing code.
Why use it?
It checks the intended behaviour early and provides tests that help detect regressions during bug fixes and refactoring.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when adding features or functions, fixing bugs, or changing existing code.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/developersglobal/ai-agent-skills/test-driven-development
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 DevelopersGlobal/ai-agent-skills --skill test-driven-development
Clone the repo
git clone --depth 1 https://github.com/DevelopersGlobal/ai-agent-skills

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 test-driven-development

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/developersglobal/ai-agent-skills/test-driven-development"><img src="https://agentmods.dev/badge/skills/developersglobal/ai-agent-skills/test-driven-development.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 32 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 848 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.
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.00032 $0.00848
Opus 5.5 $0.00013 $0.00339
Sonnet 5.5 $0.00006 $0.00170
Haiku 4.5 $0.00003 $0.00085

Measured 1mo ago against content hash a441fe81bb3f, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 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-driven-development/SKILL.md · 91 lines

How it starts

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

Overview

TDD is the discipline of writing a failing test before writing implementation code. It forces you to think about the interface before the internals, produces tests that actually test behavior (not just coverage), and gives you a safety net for every refactor.

AI agents skip tests constantly. This skill makes tests non-optional.

When to Use

  • Starting any new feature or function
  • Fixing any bug (write a test that reproduces the bug first)
  • Refactoring existing code (ensure test coverage before you start)

Process

Step 1: Write a Failing Test (Red)

  1. Write a test for the behavior you want — before writing implementation.
  2. The test should describe what the code does, not how:
    • ✅ test("returns 404 when user not found")
    • ❌ test("calls findById with the user id")
  3. Run the test. Confirm it fails for the right reason (not a syntax error — a missing implementation).

Verify: Test runs and fails with a clear "not implemented" or "undefined" error.

Step 2: Write Minimum Code (Green)

  1. Write the minimum implementation to make the test pass.
  2. Do not write more than the test requires — resist the urge to add logic for future cases.
  3. Run the test. Confirm it passes.

Verify: All tests pass. No new tests added yet.

Step 3: Refactor (Refactor)

  1. Now clean up the implementation — no new behavior, only improved structure.
  2. Run tests after every refactoring step — do not batch refactors.
  3. If tests break during refactor: revert immediately, refactor more carefully.

Verify: Tests still pass after refactor. Code is cleaner.

Step 4: Repeat for Each Behavior

  1. Repeat steps 1–3 for each distinct behavior of the feature.
  2. Test pyramid: many unit tests, fewer integration tests, minimal end-to-end tests.

Step 5: Coverage Sanity Check

  1. Run coverage report. Flag any critical paths with 0% coverage.
  2. Do NOT chase a coverage number — write tests for behaviors that matter.

Verify: All happy paths and key edge cases have tests. Coverage report reviewed.

Read the full file on GitHub · 91 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 · 91 lines · 32 tokens per session scan A a441fe81bb3f

Subscribe to this mod's changes

test-driven-development is a skill published in the GitHub repository DevelopersGlobal/ai-agent-skills (177 stars, last pushed 5mo ago), licensed MIT. It adds 32 tokens to every session and 848 once invoked, about $0.0001 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.

Related

Other skills, from other repositories

test-driven-development

Drives development with tests using the red-green-refactor loop. Use when implementing any logic, fixing any bug, or changing any behavior. Use when you need to prove that code works, when a bug report arrives, or when you're about to modify existing functionality. Use when asked to add tests to a function, fix a bug…

addyosmani/agent-skills · 92 tokens

constraint-driven-development

A development method for writing a project's quality standards as a lasting, checkable contract. It can cover areas such as test coverage, security, performance, accessibility, and architecture.

vinvcn/addyosmani-agent-skills-zh · 232 tokens

test-driven-development

Instructions for test-driven development, or TDD: writing a failing test first, then the smallest code that makes it pass, followed by cleanup.

vinvcn/addyosmani-agent-skills-zh · 56 tokens

tdd

Test-driven development, from unit to end-to-end tests. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration or end-to-end tests (Playwright, Cypress). Don't use to backfill tests on existing code (/refactor) or diagnose an unknown bug (/debug).

helderberto/agent-skills · 71 tokens

test-driven-development

Drives development with tests via Red-Green-Refactor and the Prove-It pattern, with hard rules against weakening assertions or faking green suites. Use when implementing any logic, fixing any bug, or changing any behavior. Triggers on "add a feature", "fix this bug", "write tests", or any task where done must be…

borhen68/SkillEngine · 79 tokens

spec-driven-development

Creates specs before coding, with hard rules against silently filled assumptions and untestable success criteria. Use when starting a new project, feature, or significant change and no specification exists yet. Triggers on "build me", "create a", "add a feature", or any requirement vague enough to need interpretation.

borhen68/SkillEngine · 66 tokens