Write the test first. Watch it fail. Write the minimal code to make it pass.
Usage Instructions
- Follow the Red-Green-Refactor process to proceed
- Refer to the checklist to confirm every step is done
Iron Rules
没有失败测试,就不写生产代码
- Wrote the code first and are adding tests after?Delete it. Start over
- The test mustactually run and be seen failing, not be assumed to fail
- The failure must be due to missing functionality (not a typo, not an environment issue)
- In the GREEN phase, write onlyjust enough code to pass, do not expand functionality along the way
- REFACTOR only happens after everything is green, and adds no behavior
Core principle: If you haven't seen the test fail, you don't know whether it's testing the right thing.Violating the letter of the rules is violating the spirit of the rules.
Relationship with Other Skills
| Upstream | Current | Downstream |
|---|---|---|
| writing-plans / subagent-driven-development | test-driven-development | Implementation complete |
Every implementation task must follow this skill's Red-Green-Refactor cycle.