test-driven-development

test-driven-development is a skill for Claude Code from vinvcn/addyosmani-agent-skills-zh. It costs 90 tokens per session (4,148 once invoked), scanned A, original, MIT.

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

In plain words
What is it for?
They are for implementing logic, fixing bugs, changing behavior, and handling edge cases with a repeatable test-first process.
Why use it?
They provide evidence that new behavior and bug fixes work instead of relying on code that only appears correct. The tests also help protect existing behavior during changes.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: mentions subagents.

Part of the agent-skills plugin — 26 skills, 10 commands, 4 agents shipped together

Good fit They are for implementing logic, fixing bugs, changing behavior, and handling edge cases with a repeatable test-first process.

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

Made for: Claude Code.

Or install agent-skills, the plugin that ships this one along with the rest of its 26 skills, 10 commands, 4 agents.

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/vinvcn/addyosmani-agent-skills-zh/test-driven-development/github.svg)](https://agentmods.dev/skills/vinvcn/addyosmani-agent-skills-zh/test-driven-development)
Your own site
<a href="https://agentmods.dev/skills/vinvcn/addyosmani-agent-skills-zh/test-driven-development"><img src="https://agentmods.dev/badge/skills/vinvcn/addyosmani-agent-skills-zh/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/vinvcn/addyosmani-agent-skills-zh/test-driven-development"><img src="https://agentmods.dev/badge/skills/vinvcn/addyosmani-agent-skills-zh/test-driven-development.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 90 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,148 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.00090 $0.04148
Opus 5.5 $0.00036 $0.01659
Sonnet 5.5 $0.00018 $0.00830
Haiku 4.5 $0.00009 $0.00415

Measured 4d ago against content hash 5d25df49b8af, 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 4d 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 · 399 lines

How it starts

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

Test-Driven Development

概览

先写一个失败测试,再写让它通过的代码。修 bug 时,在尝试修复前先用测试复现 bug。测试是证据,“看起来对”不算完成。拥有良好测试的代码库是 AI agent 的超能力;没有测试的代码库则是一种负债。

何时使用

  • 实现任何新逻辑或行为
  • 修复任何 bug(Prove-It Pattern)
  • 修改现有功能
  • 添加边界情况处理
  • 任何可能破坏现有行为的变更

何时不要使用: 纯配置变更、文档更新,或没有行为影响的静态内容变更。

相关: 对基于浏览器的变更,将 TDD 与使用 Chrome DevTools MCP 的运行时验证结合使用。见下方 Browser Testing 部分。

先发现技术栈

TDD 循环是通用的;命令不是。在写第一个测试之前,先弄清楚这个仓库是怎么测试的,并在每个 RED、GREEN 和验证步骤使用它自己的命令:

  • 语言与构建系统 —— package.json、pom.xml/build.gradle、pyproject.toml、go.mod、Cargo.toml、Gemfile、Makefile
  • 仓库内置的 wrapper —— 优先用 ./gradlew、./mvnw、make test 或仓库脚本,而不是全局安装的工具
  • 测试框架与配置 —— 以及它如何运行单个聚焦测试 vs 完整套件
  • 现有约定 —— 测试放在哪里、文件怎么命名、相邻测试遵循什么模式
  • 已记录的命令 —— README、CONTRIBUTING 和 CI workflows 展示的是真正把关合并的命令

在循环中运行仓库的聚焦测试命令,在完成前运行它的完整套件命令。绝不要假设 npm test 这类默认值;Gradle、Cargo 或 pytest 项目都有各自的等价命令。

下面的示例用 TypeScript 演示;一旦你发现了项目自己的工具链,这个工作流在任何语言里都完全相同。

TDD 循环

    RED                GREEN              REFACTOR
 Write a test    Write minimal code    Clean up the
 that fails  ──→  to make it pass  ──→  implementation  ──→  (repeat)
      │                  │                    │
      ▼                  ▼                    ▼
   Test FAILS        Test PASSES         Tests still PASS

步骤 1:RED,编写失败测试

先写测试。它必须失败。一个立即通过的测试什么都证明不了。

// RED: This test fails because createTask doesn't exist yet
describe('TaskService', () => {
  it('creates a task with title and default status', async () => {
    const task = await taskService.createTask({ title: 'Buy groceries' });

    expect(task.id).toBeDefined();
    expect(task.title).toBe('Buy groceries');
    expect(task.status).toBe('pending');
    expect(task.createdAt).toBeInstanceOf(Date);
  });
});

步骤 2:GREEN,让它通过

编写最少代码让测试通过。不要过度工程化:

// GREEN: Minimal implementation
export async function createTask(input: { title: string }): Promise<Task> {
  const task = {
    id: generateId(),
    title: input.title,
    status: 'pending' as const,
    createdAt: new Date(),
  };
  await db.tasks.insert(task);
  return task;
}

Read the full file on GitHub · 399 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. 4d ago Changed · +34 tokens per session 5d25df49b8af
  2. 1mo ago Changed · +15 lines · +8 tokens per session 7d1bd76bad5a
  3. 1mo ago First seen · 384 lines · 48 tokens per session scan A 87051034b58d

Subscribe to this mod's changes

test-driven-development is a skill published in the GitHub repository vinvcn/addyosmani-agent-skills-zh (44 stars, last pushed 5d ago), licensed MIT. It adds 90 tokens to every session and 4,148 once invoked, about $0.0004 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 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

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

test-driven-development

Red-green-refactor cycle with meaningful coverage. Tests are written before implementation. Coverage is a side effect of good tests, not the goal.

DevelopersGlobal/ai-agent-skills · 32 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

chaos-engineering

Guides systematic fault injection and resilience testing. Use when designing for high availability, verifying disaster recovery, testing failure modes, or building fault-tolerant systems. Use when you need to prove your system survives infrastructure failures, network partitions, dependency outages, or cascading…

borhen68/SkillEngine · 59 tokens