tdd-mastering-tdd
Installation
SKILL.md
Mastering TDD
TDD is a pragmatic way to reach code you trust, not a set of rules to follow mechanically. Use the answers below to make judgment calls: pick the step size, choose what to test, read what the tests say about the design, and adopt TDD in code that already exists.
How big should the steps be?
There are two questions here: how much ground each test covers, and how many intermediate steps each refactoring takes.
- You should be able to work at either extreme, one line of logic per test or hundreds. Over time, experienced practitioners take smaller steps.
- Do manual refactorings in many tiny steps at first, because manual refactoring is error-prone. After you've done a particular refactoring many times by hand, try skipping some steps.
- Automated refactoring makes 20 manual steps one menu item. With good tool support, refactor more aggressively and try more experiments.
- If your language or environment makes the test/compile/run cycle slow, you'll be tempted to take bigger steps. Notice whether that actually makes you faster.