一键导入
tdd
Trigger: writing new production code, RED-GREEN-REFACTOR, failing test first. Enforces the Three Laws of TDD before any implementation.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Trigger: writing new production code, RED-GREEN-REFACTOR, failing test first. Enforces the Three Laws of TDD before any implementation.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | tdd |
| description | Trigger: writing new production code, RED-GREEN-REFACTOR, failing test first. Enforces the Three Laws of TDD before any implementation. |
Load this skill before writing ANY production code change — new feature, bug fix, or refactor. If there is no failing test yet, write one first; do not skip straight to implementation.
Cycle: RED → GREEN → REFACTOR, always in that order, never skipped:
Sad-path scenarios (invalid input, boundary conditions, partial failures, contract violations) are first-class RED cases — not an afterthought once the happy path passes.
Adding input validation to a Withdraw(amount int) error method that must
reject a negative amount:
TestWithdraw_RejectsNegativeAmount asserting
Withdraw(-10) returns a non-nil error and the balance is unchanged.
Run it — it fails because Withdraw currently accepts any amount.if amount < 0 { return ErrNegativeAmount } — nothing else. Run the
test again — it passes.validateAmount helper if
a second validation rule is about to land, rename ErrNegativeAmount
for clarity if needed. Re-run the full test suite — still green.Only after this cycle completes does the next behavior (e.g. rejecting an amount above the available balance) get its own RED step.