Test driven development

From metaspartan/cybara · View interactive version

Test driven development is an AI agent skill from the GitHub repository metaspartan/cybara. Test-driven development discipline — write a failing test, implement the minimum to pass, then refactor. Use when adding a feature or fixing a bug where correctness matters.

How to use this skill

Skill file

Test-Driven Development (TDD)

Write the test first. It forces precise specifications and gives a free regression net.

Red → Green → Refactor

  1. Red. Write ONE small test for the behavior you want. Run it. It must FAIL (and fail for the right reason — an assertion, not a compile error in unrelated code).
  2. Green. Write the minimum code to make that test pass. No more, no less. Run it.
  3. Refactor. Clean up duplication while keeping tests green. Re-run after each change.

Repeat with the next smallest increment.

Rules of thumb

Running tests

When TDD is overkill

TDD pays off most for: parsers, state machines, financial/permission logic, and anything with many edge cases.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.