Spaces:
Running
Running
docs(skills): drop broken links in tdd (synced from wiki)
Browse files
.claude/skills/tdd/SKILL.md
CHANGED
|
@@ -13,8 +13,6 @@ description: Test-driven development with red-green-refactor loop. Use when the
|
|
| 13 |
|
| 14 |
**Bad tests** are coupled to implementation. They mock internal collaborators, test private methods, or verify through external means (like querying a database directly instead of using the interface). The warning sign: your test breaks when you refactor, but behavior hasn't changed. If you rename an internal function and tests fail, those tests were testing implementation, not behavior.
|
| 15 |
|
| 16 |
-
See [tests.md](tests.md) for examples and [mocking.md](mocking.md) for mocking guidelines.
|
| 17 |
-
|
| 18 |
## Anti-Pattern: Horizontal Slices
|
| 19 |
|
| 20 |
**DO NOT write all tests first, then all implementation.** This is "horizontal slicing" - treating RED as "write all tests" and GREEN as "write all code."
|
|
@@ -48,8 +46,8 @@ Before writing any code:
|
|
| 48 |
|
| 49 |
- [ ] Confirm with user what interface changes are needed
|
| 50 |
- [ ] Confirm with user which behaviors to test (prioritize)
|
| 51 |
-
- [ ] Identify opportunities for
|
| 52 |
-
- [ ] Design interfaces for
|
| 53 |
- [ ] List the behaviors to test (not implementation steps)
|
| 54 |
- [ ] Get user approval on the plan
|
| 55 |
|
|
@@ -86,7 +84,7 @@ Rules:
|
|
| 86 |
|
| 87 |
### 4. Refactor
|
| 88 |
|
| 89 |
-
After all tests pass, look for
|
| 90 |
|
| 91 |
- [ ] Extract duplication
|
| 92 |
- [ ] Deepen modules (move complexity behind simple interfaces)
|
|
|
|
| 13 |
|
| 14 |
**Bad tests** are coupled to implementation. They mock internal collaborators, test private methods, or verify through external means (like querying a database directly instead of using the interface). The warning sign: your test breaks when you refactor, but behavior hasn't changed. If you rename an internal function and tests fail, those tests were testing implementation, not behavior.
|
| 15 |
|
|
|
|
|
|
|
| 16 |
## Anti-Pattern: Horizontal Slices
|
| 17 |
|
| 18 |
**DO NOT write all tests first, then all implementation.** This is "horizontal slicing" - treating RED as "write all tests" and GREEN as "write all code."
|
|
|
|
| 46 |
|
| 47 |
- [ ] Confirm with user what interface changes are needed
|
| 48 |
- [ ] Confirm with user which behaviors to test (prioritize)
|
| 49 |
+
- [ ] Identify opportunities for deep modules (small interface, deep implementation)
|
| 50 |
+
- [ ] Design interfaces for testability
|
| 51 |
- [ ] List the behaviors to test (not implementation steps)
|
| 52 |
- [ ] Get user approval on the plan
|
| 53 |
|
|
|
|
| 84 |
|
| 85 |
### 4. Refactor
|
| 86 |
|
| 87 |
+
After all tests pass, look for refactor candidates:
|
| 88 |
|
| 89 |
- [ ] Extract duplication
|
| 90 |
- [ ] Deepen modules (move complexity behind simple interfaces)
|