tdd

Guide test-driven development with a RED/GREEN/REFACTOR cycle.

15|2|Updated May 23, 2026
One-click install
npx skills add https://github.com/VKirill/antigravity-for-claude-code --skill tdd-vkirill
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/VKirill/antigravity-for-claude-code/tree/main/skills/tdd
Command: npx skills add https://github.com/VKirill/antigravity-for-claude-code --skill tdd-vkirill

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

TDD prevents “tests after the fact” by forcing you to define expected behavior up front, so changes don’t silently break existing functionality.

Core Features & Use Cases

  • Behavior-first development: write a failing test that expresses the input → output behavior before implementing anything.
  • Tight RED/GREEN/REFACTOR loop: keep each cycle small (≤ 5 minutes) to maintain momentum and clarity.
  • Regression safety: when fixing bugs, reproduce the bug with a test before applying the fix.

Quick Start

Use the tdd skill to implement a feature by writing one failing test for the first acceptance criterion, then add only the minimum code needed to make that test pass, repeating until all criteria are green.

Frequently Asked Questions about tdd

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I start test-driven development for API endpoints and pure functions?

Start test-driven development by writing a single failing test that expresses the input to output behavior for your API endpoint or pure function. Add only the minimum code needed to make that test pass, repeating until all acceptance criteria are green.

What is the red-green-refactor cycle and how long should each loop take?

The red-green-refactor cycle is a test-driven development loop where you write a failing test, make it pass with minimal code, then optionally refactor. Keep each cycle small, ideally under five minutes, to maintain development momentum and clarity.

How do I fix bugs using regression tests before applying the fix?

To fix bugs using regression tests, first write a test that reproduces the exact bug and fails. Once the bug is reproduced, apply the fix to the business logic or parser until the regression test passes, ensuring the issue is permanently guarded against.

Can I use test-driven development for DB-backed logic and mocking strategies?

Yes, test-driven development applies to DB-backed logic and mocking strategies. Define the expected API behavior and business logic with meaningful assertions before implementation, ensuring your database interactions are verified through targeted unit tests.

Are snapshot tests acceptable as primary checks in test-driven development?

Snapshot tests are not acceptable as primary checks in test-driven development. You must use meaningful assertions that verify specific input to output behavior, ensuring small test sizes and precise correctness validation for validators and parsers.