skills sourced live from GitHub · all skills listed are free · each skill is provided under its author's license.
home / Testing & QA / Test Driven Development Skill by @obra
The skill is the skills/test-driven-development folder inside that repository. Copy it into the folder your agent loads skills from; check your agent's documentation for where that is.
Use when implementing any feature or bugfix, before writing implementation code.
Applies strict red-green-refactor: write a failing test first, then the minimum code to pass, then refactor. It has an 'iron law' that tests come before implementation.
The original SKILL.md is organised into these sections:
Written and maintained by @obra. It is published under the MIT license, which allows reuse with attribution. See the author profile. SkillDirectory does not claim authorship: this page adds our own review and links back to the original, and the skill's text belongs to its author.
------|------|-----|
| **Minimal** | One thing. "and" in name? Split it. | `test('validates email and domain and whitespace')` |
| **Clear** | Name describes behavior | `test('test1')` |
| **Shows intent** | Demonstrates desired API | Obscures what code should do |
When writing or changing any test, read [writing-good-tests.md](writing-good-tests.md) for the rules that keep tests honest:
- Name the production change that would make the test fail — before writing it
- Assert on real behavior, never on mock behavior
- Keep test-only code in test utilities, out of production classes
- Understand a dependency's side effects before mocking it
## Common Rationalizations
| Excuse | Reality |
|--------|---------|
| "Too simple to test" | Simple code breaks. Test takes 30 seconds. |
…
Excerpt only, quoted from the author's repository. Open the repository for the complete file.