Skip to content
Development
Skill

/tdd

测试驱动开发(红绿循环)— 来自 superpowers 体系。本 skill 是桥接层,先写失败测试再写实现,完整纪律见 <SUPERPOWERS_SKILL_ROOT>/tdd/。

From plugin
analysis-to-delivery
2626 skills

Claude Code

$ npx -y skills add BlueprintOS/analysis-to-delivery --skill tdd --agent claude-code

SKILL.md

tdd.SKILL.md
name: tdd
description: 测试驱动开发(红绿循环)— 来自 superpowers 体系。本 skill 是桥接层,先写失败测试再写实现,完整纪律见 <SUPERPOWERS_SKILL_ROOT>/tdd/。
version: 4.0.0

TDD(桥接到 superpowers)

Contract

  • Inputs: executable task from writing plan, test target, acceptance criteria
  • Outputs: RED test, GREEN implementation, refactor notes
  • Gates: RED observed before implementation; GREEN observed after implementation
  • Required disciplines: `stage-gate`
  • Next: `/executing-plans`

> **本仓库不维护此 skill 的内容**。完整纪律请读: > `<SUPERPOWERS_SKILL_ROOT>/tdd/SKILL.md`

何时调

  • writing-plans 之后
  • 每个子任务开始时(红绿循环)

衔接点

  • **产出**:RED 测试 + GREEN 实现 + REFACTOR
  • **下一步**:`/executing-plans`(commit + 下一任务)
  • **门控**:`disciplines/stage-gate` 第 3 层(RED 必须确认失败才能写实现)

降级方案(superpowers 未装时)

如果 `<SUPERPOWERS_SKILL_ROOT>/tdd/` 不存在,严格按以下 4 步红绿循环:

1. RED — 写失败测试

  • 在 `src/test/` 写测试,**只测一个最小行为**
  • 跑测试 → 必须**确认失败**(看到红色 / FAILURE,不是 BUILD SUCCESS)
  • ❌ 跳过 RED = 你不知道测试到底在测什么

2. 最小实现

  • 写**最少量**代码让测试通过(可以丑 / 可以硬编码)
  • 不优化、不重构、不扩展

3. GREEN — 跑通

  • 再跑测试 → 必须**确认通过**(看到 BUILD SUCCESS / PASSED)
  • ❌ 测试莫名通过 = 测试没断言你想要的东西

4. REFACTOR — 重构

  • 改进实现 / 抽取方法 / 命名优化
  • **每次重构后必须重跑测试**确认仍 GREEN
  • 改完再跑 = 唯一能防止重构破坏功能的方法

最小纪律摘要

  • **RED 必须亲眼看到失败**:写测试 → 跑 → 看 stack trace → 才写实现
  • **GREEN 后才能 REFACTOR**:实现未通过前重构 = 在错的地基上盖楼
  • **测试一次只测一个行为**:堆叠断言 = 失败时不知道哪个挂了
  • **不 mock 你要测的东西**:只 mock 边界 IO

安装提示

npx skills@latest add obra/superpowers-tdd
Read more
@blueprintos
Ships withanalysis-to-delivery

通用需求分析到开发实施工作流 — 26 个独立可组合 skill、3 个完整行业示例、13 个 CI workflow、26 个自动化脚本、15 个 pytest 测试。

Stars on GitHub

Momentum

stars in total
26
Star history of BlueprintOS/analysis-to-delivery on GitHub, a chart by star-history.com

Other skills on analysis-to-delivery.

ask-delivery

ask-delivery

分析到交付的入口 — 根据你的目标(配置/澄清/BRD/PRD/合规/开发/审计/交接)路由到正确的 user-invoked skill。不确定该用哪个 analysis-to-delivery skill 时,从此入口进入。

ascii-flowchart

ascii-flowchart

**Deprecated**: 此 Skill 是 `rules/ascii-flowchart.md` 的兼容壳。 新代码 / 新文档应直接加载 `rules/ascii-flowchart.md`,不要继续依赖本 Skill。

context-pointer

context-pointer

**Deprecated**: 此 Skill 是 `rules/context-pointer.md` 的兼容壳。 新代码 / 新文档应直接加载 `rules/context-pointer.md`,不要继续依赖本 Skill。

doc-numbering

doc-numbering

**Deprecated**: 此 Skill 是 `rules/doc-numbering.md` 的兼容壳。 新代码 / 新文档应直接加载 `rules/doc-numbering.md`,不要继续依赖本 Skill。

no-field-guessing

no-field-guessing

**Deprecated**: 此 Skill 是 `rules/no-field-guessing.md` 的兼容壳。 新代码 / 新文档应直接加载 `rules/no-field-guessing.md`,不要继续依赖本 Skill。

no-self-invent

no-self-invent

**Deprecated**: 此 Skill 是 `rules/no-self-invent.md` 的兼容壳。 新代码 / 新文档应直接加载 `rules/no-self-invent.md`,不要继续依赖本 Skill。

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills10d309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc11d293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react1d252k
@facebook@facebookInstall Skill

Questions about tdd.

Which coding agents can use tdd?
tdd installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.