一键导入
tdd
Discipline skill — TDD red-green-refactor cycle. Use when implementing any feature or bugfix, before writing implementation code.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Discipline skill — TDD red-green-refactor cycle. Use when implementing any feature or bugfix, before writing implementation code.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Full pipeline: evaluation -> spec -> implementation -> review -> QA
Full pipeline: evaluation -> spec -> implementation -> review -> QA
Convenes multiple agents to debate an important decision
Enriches CLAUDE.md by exploring the project and specializes agents to the real stack
QA + bugfix cycle until it passes
Convenes multiple agents to debate an important decision
| name | tdd |
| description | Discipline skill — TDD red-green-refactor cycle. Use when implementing any feature or bugfix, before writing implementation code. |
| user-invocable | true |
Write the test first. Watch it fail. Write minimal code to pass.
Core principle: If you didn't watch the test fail, you don't know if it tests the right thing.
/tdd
Invoke this skill before implementing any feature or bugfix. It establishes the discipline for your implementation session.
Exceptions (ask the user): throwaway prototypes, generated code, configuration files.
NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST
Write code before the test? Delete it. Start over.
Write one minimal test showing what should happen.
Requirements:
Run the test. Confirm:
Test passes? You're testing existing behavior. Fix the test.
Write the simplest code to pass the test.
Don't add features, refactor other code, or "improve" beyond the test.
Run the test. Confirm:
Test fails? Fix code, not test.
After green only:
Keep tests green. Don't add behavior.
Next failing test for next behavior.
| Quality | Good | Bad |
|---|---|---|
| Minimal | One thing. "and" in name? Split it. | test('validates email and domain and whitespace') |
| Clear | Name describes behavior | test('test1') |
| Shows intent | Demonstrates desired API | Obscures what code should do |
| Excuse | Reality |
|---|---|
| "Too simple to test" | Simple code breaks. Test takes 30 seconds. |
| "I'll test after" | Tests passing immediately prove nothing. |
| "Tests after achieve same goals" | Tests-after = "what does this do?" Tests-first = "what should this do?" |
| "Already manually tested" | Ad-hoc is not systematic. No record, can't re-run. |
| "Deleting X hours is wasteful" | Sunk cost fallacy. Keeping unverified code is technical debt. |
| "Need to explore first" | Fine. Throw away exploration, start with TDD. |
| "Test hard = design unclear" | Listen to the test. Hard to test = hard to use. |
| "TDD will slow me down" | TDD is faster than debugging. |
All of these mean: Delete code. Start over with TDD.
Never fix bugs without a test.
| Problem | Solution |
|---|---|
| Don't know how to test | Write wished-for API. Write assertion first. |
| Test too complicated | Design too complicated. Simplify interface. |
| Must mock everything | Code too coupled. Use dependency injection. |
| Test setup huge | Extract helpers. Still complex? Simplify design. |
Before marking work complete:
Can't check all boxes? You skipped TDD. Start over.
/debug — systematic debugging when tests reveal unexpected failures/verify — verification before claiming work is complete