test-driven-development SKILL.md skillA
test-driven-development from jnmetacode/superpowers-zh is an agent skill: a SKILL.md folder an AI agent loads when a task calls for it.
mdr add jnmetacode/superpowers-zh/test-driven-development@v1.0.0Pins v1.0.0 in mdr.lock. Pin the fingerprint instead.
- Audit grade
- A, 17 of 17 checks passed
- Kind
- SKILL.md skill
- Repository
- jnmetacode/superpowers-zh
- Path
skills/test-driven-development/SKILL.md- Versions recorded
- 4
- Latest version
- v1.0.0, committed Sep 26, 2026
- First version recorded
- Mar 20, 2026
- Size
- 10,095 bytes
- Repository stars
- 8,348
- License
- MIT
在实现任何功能或修复 bug 时使用,在编写实现代码之前.
Collected from public GitHub. Every version is saved exactly as it was and never changes. Install it at an exact version with the mdr tool, and every file is checked before it reaches your agent. The main file is checked against the SHA-256 fingerprint recorded here, and the others against the fingerprints GitHub keeps for its source commit. The automatic checks below grade the latest version, and the same checks always give the same file the same grade.
What the file says
# 测试驱动开发(TDD)
## 概述
先写测试。看它失败。写最少的代码让它通过。
**核心原则:** 如果你没有看到测试失败,你就不知道它是否测试了正确的东西。
**违反规则的字面意思就是违反规则的精神。**
## 何时使用
**始终使用:**
- 新功能
- Bug 修复
- 重构
- 行为变更
**例外(需询问你的人类伙伴):**
- 一次性原型
- 生成的代码
- 配置文件
想着"就这一次跳过 TDD"?停下来。那是在给自己找借口。
## 铁律
```
没有失败的测试,就不写生产代码
```
先写了代码再写测试?删掉它。从头来过。
**没有例外:**
- 不要保留作为"参考"
- 不要在写测试时"改编"它
- 不要看它
- 删除就是删除
从测试出发,重新实现。句号。
## 红-绿-重构
```dot
digraph tdd_cycle {
rankdir=LR;
red [label="红灯\n编写失败的测试", shape=box, style=filled, fillcolor="#ffcccc"];
verify_red [label="验证正确失败", shape=diamond];
green [label="绿灯\n最少代码", shape=box, style=filled, fillcolor="#ccffcc"];
verify_green [label="验证通过\n全部绿灯", shape=diamond];
refactor [label="重构\n清理代码", shape=box, style=filled, fillcolor="#ccccff"];
next [label="下一个", shape=ellipse];
red -> verify_red;
verify_red -> green [label="是"];
verify_red -> red [label="错误的\n失败"];
green -> verify_green;
verify_green -> refactor [label="是"];
verify_green -> green [label="否"];
refactor -> verify_green [label="保持\n绿灯"];
verify_green -> next;
next -> red;
}
```
### 红灯 - 编写失败的测试
写一个最小的测试来展示期望行为。
<Good>
```typescript
…Read the whole file at its exact version.
How to install
mdr add jnmetacode/superpowers-zh/test-driven-development@sha256:ba1e4f5d2ebc7d45The line at the top of this page pins the label v1.0.0, which is what most people want. This one pins the sha256 fingerprint of the contents instead, so it survives a label being moved. Either way the exact version is written to mdr.lock, and mdr install downloads and checks those contents again, so it installs them exactly or stops with an error.
[](https://markdownregistry.com/a/art_adsckqblkcve6mhs)
4 badge image fetches in 30 days. What the badge shows.
Versions
The registry has recorded 4 versions of this file, between Mar 20, 2026 and Sep 26, 2026, about one every 63 days.
| version | committed | commit | size | audit | |
|---|---|---|---|---|---|
| v1.0.0 latest | 2026-09-26 | 40b0d4f | 10,095 B | A | view · diff |
| v1.0.0 | 2026-08-07 | 2b1ced6 | 9,482 B | A | view · diff |
| v1.0.0 | 2026-06-16 | 952fc29 | 10,294 B | A | view · diff |
| git:20260320.80bc100 | 2026-03-20 | 80bc100 | 10,211 B | A | view |
Audit of the latest version
- pass: Frontmatter block present
- pass: Frontmatter declares a name
- pass: Frontmatter declares a description
- pass: Size between 200 bytes and 200 KB (10095 bytes)
- pass: No zero-width or bidi control characters
- pass: No instruction hidden inside an HTML comment
- pass: No link to an exfiltration or paste host
- pass: No credential-shaped string
- pass: No instruction to send local credentials anywhere
- pass: No text hidden with inline styles
- pass: No prompt-injection phrasing
- pass: No curl or wget piped into a shell
- pass: No recursive delete of root, home or parent
- pass: No instruction to read or print local credentials
- pass: No base64 blob over 200 characters
- pass: No link to a raw IP address
- pass: No script tag
Source
jnmetacode/superpowers-zh · 8,348 stars · license MIT · pushed 2026-10-19 · branch main
API
GET https://markdownregistry.com/api/v1/artifacts/art_adsckqblkcve6mhs GET https://markdownregistry.com/api/v1/resolve?ref=jnmetacode/superpowers-zh/test-driven-development GET https://markdownregistry.com/api/v1/blob/ba1e4f5d2ebc7d45f0abdbe1b852d3463ea0593eb621942dd0b45427ee9db378
Your AI assistant does the legwork. You hear about the deals worth your word. Hand yours the standing instructions at modelranch.com and it joins the network that reads files like this one.
Guides: the SKILL.md format and its required fields · what to check before you install a skill · how to pin a skill to an exact version · where to find agent skills · keeping a team on the same skills · which agent file does what.
More from jnmetacode/superpowers-zh
Every file in jnmetacode/superpowers-zh