Test driven development
Use when implementing any feature or bug fix that touches code. Enforces red-green-refactor discipline. Rigid — do not skip steps.From its SKILL.md
npx -y skills add Yoshana/supertools --skill test-driven-developmentAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
3.0 KB, as published. Nobody here has run it
Test-Driven Development
Write the failing test first. Make it pass with the minimum code. Refactor.
The cycle
For each new behavior:
-
RED — Write a failing test.
- One test, one behavior.
- The test should be small and specific.
- Use the project's existing test framework and conventions.
-
Run the test. Confirm it fails for the right reason.
- Quote the failure output.
- "Function not defined" is a valid first failure.
- "Wrong answer" means there's already code in the way — check before writing more.
-
GREEN — Write the minimum code to make the test pass.
- Don't anticipate the next test. Just pass this one.
- Inelegant code is fine here.
-
Run the test. Confirm it passes.
- Quote the success output.
-
Run the full test suite. Make sure nothing else broke.
-
REFACTOR — Improve the code without changing behavior.
- Rename for clarity. Extract duplication. Simplify.
- The tests stay green. Run them again to confirm.
-
Commit.
When to skip TDD
Almost never. Defensible exceptions:
- Pure exploratory spikes you will throw away (commit-message: spike)
- Trivial config changes with no logic
- Type-only refactors with the type-checker as the test
If you find yourself skipping for any other reason, you're rationalizing. Stop and write the test.
Common rationalizations (counter them)
These are the thoughts that mean you're about to break TDD. Each one has a counter — read both:
| Thought | Counter |
|---|---|
| "I'll just write a quick prototype first; tests can come after." | The test IS the prototype's spec. Write it first; if anything's throwaway, it's the implementation. |
| "This change is too small to need a test." | Small + uncovered = regression you won't notice. Write the test. |
| "The test is hard to write because the design is complex." | Then the design is the problem. Don't bypass with no test — redesign. |
| "I already verified it works manually." | Manual checks aren't reproducible. Codify it. |
| "I'll add the test after, in cleanup." | "Cleanup" never happens. Test now or not at all. |
| "TDD slows me down on this kind of work." | "This kind of work" is where TDD reveals the most. The slowdown is the cost of clarity — pay it. |
| "We're under time pressure; ship now, test later." | Time pressure is exactly when undetected regressions hurt most. Tests now are insurance, not overhead. |
Anti-patterns
- Writing the implementation first "just to see if it works" — write the test first; the test exists to prove the behavior.
- One giant test for many behaviors — break it up.
- Tests that test the implementation, not the behavior — refactor- resistant tests are bad tests.
- Skipping the "run and confirm fail" step — without it, you don't know the test actually exercises the new code.