test-driven-development

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

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/developersglobal/ai-agent-skills/test-driven-development
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.

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. 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.00032 $0.00848
Opus 5 $0.00016 $0.00424
Sonnet 5 $0.00006 $0.00170
Haiku 4.5 $0.00003 $0.00085

Measured 3d ago against content hash a441fe81bb3f, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 3d 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. 3d 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 (65 stars, last pushed 4mo ago), licensed MIT. It adds 32 tokens to every session and 848 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

test-driven-development

Drives development with tests. 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.

addyosmani/agent-skills · 50 tokens

tdd

Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.

helderberto/agent-skills · 33 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

test-driven-development

用测试驱动开发。用于实现任何逻辑、修复任何 bug,或改变任何行为。用于需要证明代码能工作、收到 bug 报告,或即将修改现有功能时。.

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

code-review-and-quality

Conducts multi-axis code review. Use before merging any change. Use when reviewing code written by yourself, another agent, or a human. Use when you need to assess code quality across multiple dimensions before it enters the main branch.

addyosmani/agent-skills · 51 tokens

constraint-driven-development

Establishes a project's quality bar as a written contract and stops agents quietly lowering it. Interviews the user on which dimensions matter, supplies sane default thresholds when they have no number in mind, records everything in CONSTRAINTS.md, and watches the diff for a weakened bar — new @ts-ignore or…

addyosmani/agent-skills · 154 tokens