Skills for Real Engineers. Straight from my .agents directory.
How to install test-driven-development
install test-driven-development
# install the superpowers-zh pack with the skills CLI
npx skills add jnMetaCode/superpowers-zh# or add only this skill to Claude Code: copy the folder
skills/test-driven-development/
# into
~/.claude/skills/test-driven-development/ (all projects)
.claude/skills/test-driven-development/ (one project)
1# 测试驱动开发(TDD)23## 概述45先写测试。看它失败。写最少的代码让它通过。67**核心原则:** 如果你没有看到测试失败,你就不知道它是否测试了正确的东西。89**违反规则的字面意思就是违反规则的精神。**1011## 何时使用1213**始终使用:**14- 新功能15- Bug 修复16- 重构17- 行为变更1819**例外(需询问你的人类伙伴):**20- 一次性原型21- 生成的代码22- 配置文件2324想着"就这一次跳过 TDD"?停下来。那是在给自己找借口。2526## 铁律2728```29没有失败的测试,就不写生产代码30```3132先写了代码再写测试?删掉它。从头来过。3334**没有例外:**35- 不要保留作为"参考"36- 不要在写测试时"改编"它37- 不要看它38- 删除就是删除3940从测试出发,重新实现。句号。4142## 红-绿-重构4344```dot45digraph tdd_cycle {46 rankdir=LR;47 red [label="红灯\n编写失败的测试", shape=box, style=filled, fillcolor="#ffcccc"];48 verify_red [label="验证正确失败", shape=diamond];49 green [label="绿灯\n最少代码", shape=box, style=filled, fillcolor="#ccffcc"];50 verify_green [label="验证通过\n全部绿灯", shape=diamond];51 refactor [label="重构\n清理代码", shape=box, style=filled, fillcolor="#ccccff"];52 next [label="下一个", shape=ellipse];5354 red -> verify_red;55 verify_red -> green [label="是"];56 verify_red -> red [label="错误的\n失败"];57 green -> verify_green;58 verify_green -> refactor [label="是"];59 verify_green -> green [label="否"];60 refactor -> verify_green [label="保持\n绿灯"];61 verify_green -> next;62 next -> red;63}64```6566### 红灯 - 编写失败的测试6768写一个最小的测试来展示期望行为。6970<Good>71```typescript72test('retries failed operations 3 times', async () => {73 let attempts = 0;74 const operation = () => {75 attempts++;76 if (attempts < 3) throw new Error('fail');77 return 'success';78 };7980 const result = await retryOperation(operation);8182 expect(result).toBe('success');83 expect(attempts).toBe(3);84});85```86名称清晰,测试真实行为,只测一件事87</Good>8889<Bad>90…
Excerpt shown under the repository's MIT license.
More skills in superpowers-zh
Keep exploring
Similar skill repositories
39 skills
An agentic skills framework & software development methodology that works.
15 skills
Public repository for Agent Skills
20 skills
Makes your AI agent think like the laziest senior dev in the room. The best code is the code you never wrote.
CCCU6 skills
Production-grade engineering skills for AI coding agents.
CCCXCU25 skills
The open-source app everyone uses to manage agents at work
CCCX33 skills
