tdd-zh

tdd-zh is a skill for Claude Code, Codex from gongyijie85/mattpocock-skills-dsh-zh. It costs 54 tokens per session (957 once invoked), scanned A, original, MIT.

A test-first development guide for building features or fixing bugs. Test-driven development, or TDD, means writing a test that fails, making it pass with the smallest change, and then improving the code.

In plain words
What is it for?
Use it to choose test boundaries, write behaviour-focused tests, follow the red-green-refactor cycle, and avoid fragile or self-confirming tests.
Why use it?
It helps tests describe user-visible behaviour instead of internal code details. This makes the tests more useful during refactoring and reduces tests that pass without checking anything meaningful.

Skill for Claude CodeCodex

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

Good fit Use it to choose test boundaries, write behaviour-focused tests, follow the red-green-refactor cycle, and avoid fragile or self-confirming tests.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/gongyijie85/mattpocock-skills-dsh-zh/tdd-zh
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 gongyijie85/mattpocock-skills-dsh-zh --skill tdd-zh
Clone the repo
git clone --depth 1 https://github.com/gongyijie85/mattpocock-skills-dsh-zh

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-zh

README.md
[![agentmods](https://agentmods.dev/badge/skills/gongyijie85/mattpocock-skills-dsh-zh/tdd-zh/github.svg)](https://agentmods.dev/skills/gongyijie85/mattpocock-skills-dsh-zh/tdd-zh)
Your own site
<a href="https://agentmods.dev/skills/gongyijie85/mattpocock-skills-dsh-zh/tdd-zh"><img src="https://agentmods.dev/badge/skills/gongyijie85/mattpocock-skills-dsh-zh/tdd-zh/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 tdd-zh

Your own site · 80×15
<a href="https://agentmods.dev/skills/gongyijie85/mattpocock-skills-dsh-zh/tdd-zh"><img src="https://agentmods.dev/badge/skills/gongyijie85/mattpocock-skills-dsh-zh/tdd-zh.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 54 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 957 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.00054 $0.00957
Opus 5 $0.00027 $0.00478
Sonnet 5 $0.00011 $0.00191
Haiku 4.5 $0.00005 $0.00096

Measured yesterday against content hash 90b272a0b5a1, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

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

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/tdd-zh/SKILL.md · 39 lines

What it actually says

测试驱动开发(Test-Driven Development)

TDD 就是 red → green(红 → 绿)循环。本技能是让这一循环产出值得保留的测试的参考:什么样的测试是好测试、测试放在哪里、有哪些反模式,以及循环的规则。每个小节在每一轮循环中都适用——在循环开始前和进行中查阅它们,而不是事后才看。

在探索代码库时,阅读 CONTEXT.md(如果存在),让测试名称和接口词汇与项目的领域语言保持一致,并尊重你所触及区域的 ADR。

什么是好的测试

测试通过公共接口验证行为,而不是实现细节。代码可以彻底改变;测试不应随之改变。好的测试读起来就像一份规格说明——"用户可以用有效的购物车完成结账"准确告诉你存在什么能力——而且它不在乎内部结构,所以能扛住重构。

示例参见 tests.md,mock 指南参见 mocking.md

Seam(接缝)——测试放在哪里

seam(接缝) 是你进行测试的公共边界:在不深入内部的情况下观察行为的接口。测试放在 seams 上,绝不针对内部实现。

只在你预先约定的 seams 上测试。 在编写任何测试之前,写下将要测试的 seams 并与用户确认。未经确认的 seam 上不写任何测试。你不可能测试所有东西——提前约定 seams,才能让测试精力落在关键路径和复杂逻辑上,而不是撒在每个边界情况上。

询问:"公共接口是什么,我们应该测试哪些 seam?"

当接口本身的形态存疑时——模块该有多深、seam 该放在哪里、接口应暴露什么——调用 skill tool,使用 "codebase-design" 获取相关词汇。它是 module、interface、depth、seam、adapter、leverage 和 locality 这些术语的共同来源,是一份供查阅的参考,而不是要运行的一次会话。

反模式

  • Implementation-coupled(实现耦合)——mock 内部协作者、测试私有方法,或通过旁路通道验证(直接查询数据库而不是使用接口)。典型特征:重构时测试破裂,但行为并没有变化。
  • Tautological(同义反复)——断言用与代码相同的方式重新计算期望值(expect(add(a, b)).toBe(a + b)、以同样方式手工推导出的 snapshot、断言常量等于自身),因此它凭构造就能通过,永远不可能与代码产生分歧。期望值必须来自独立的真值来源——已知正确的字面量、手算示例、spec。
  • Horizontal slicing(水平切片)——先写完所有测试,再写全部实现。批量测试验证的是_想象中的_行为:你测试的是事物的_形状_而不是面向用户的行为,测试对真实变化不敏感,而且你在理解实现之前就锁定了测试结构。改为按 vertical slices(垂直切片) 工作——一个测试 → 一个实现 → 重复,每个测试都是一颗 tracer bullet(曳光弹),对上一轮循环教给你的东西做出回应。

循环的规则

  • Red before green(先红后绿)。 先写失败的测试,然后只写足以让它通过的代码。不要预想未来的测试,也不要添加投机性的功能。
  • One slice at a time(一次一个切片)。 每轮循环一个 seam、一个测试、一个最小实现。
  • Refactoring is not part of the loop(重构不属于循环)。 它属于 review 阶段(参见 code-review 技能),而不是 red → green 实现循环。
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. yesterday First seen · 39 lines · 54 tokens per session scan A 90b272a0b5a1

Subscribe to this mod's changes

tdd-zh is a skill published in the GitHub repository gongyijie85/mattpocock-skills-dsh-zh (5 stars, last pushed 2d ago), licensed MIT. It adds 54 tokens to every session and 957 once invoked, about $0.0003 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-09-11.

Related

Other skills, from other repositories

test-first

A test-first development guide, where tests are written before the code they check. TDD, or test-driven development, means first writing a test that fails, then writing the simplest code that makes it pass.

pingfanfan/hello-dsh · 48 tokens

red-green-tdd

Red/green test discipline for implementation work. Use once a doublecheck spec is on record and implementation is about to start — write a test that fails for the missing behavior, run it to see it fail (red), make the change, run again to see it pass (green).

PerryLink/dsh-doublecheck · 62 tokens

dsh-test-first

A test-first process for fixing bugs or adding features: write a failing test, make the smallest change that passes it, then improve the code.

hackerFish/awesome-dsh-skills · 28 tokens

django-tdd

Django testing strategies with pytest-django, TDD methodology, factoryboy, mocking, coverage, and testing Django REST Framework APIs. Use when writing Django or DRF tests with pytest-django, or driving a Django feature test-first.

gongyijie85/dsh-ecc · 53 tokens

laravel-tdd

Laravel testing strategies with PHPUnit, Pest, model factories, HTTP tests, Sanctum authentication testing, mocking, and coverage. Use when writing Laravel tests with PHPUnit or Pest, or driving a Laravel feature test-first.

gongyijie85/dsh-ecc · 47 tokens

golang-testing

Go testing patterns including table-driven tests, subtests, benchmarks, fuzzing, and test coverage. Follows TDD methodology with idiomatic Go practices. Use when writing Go tests — table-driven cases, subtests, benchmarks, fuzzing, or coverage.

gongyijie85/dsh-ecc · 56 tokens