tdd

Guide test-driven development with red-green-refactor loops and public API design.

6.3k|548|Updated Jan 18, 2017
One-click install
npx skills add https://github.com/sanity-io/sanity --skill tdd-sanity-io
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/sanity-io/sanity/tree/main/.agents/skills/tdd
Command: npx skills add https://github.com/sanity-io/sanity --skill tdd-sanity-io

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Test-driven development helps teams build robust software by guaranteeing behavior through tests and letting the public API define requirements.

Core Features & Use Cases

  • Public-interface-driven design through tracer-bullets
  • End-to-end testing of features and bug fixes with red-green-refactor loops
  • Guidance on planning, incremental design, and safe refactoring

Quick Start

Start with one end-to-end test and implement the minimal code to pass, then repeat.

Frequently Asked Questions about tdd

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

FAQPage Schema
What is the red-green-refactor cycle in test-driven development?

Test-driven development uses integration-style tests to validate feature behavior and bug fixes end-to-end. By relying on public APIs rather than internal implementation details, tests remain resilient during safe refactoring and incremental design.

How do I start test-driven development for a new feature?

Public-interface-driven design uses tracer bullets to define requirements through public APIs rather than internal details. This approach allows teams to validate end-to-end behavior early while keeping the architecture flexible for incremental design and safe refactoring.

Can I use test-driven development for fixing bugs in an existing codebase?

Yes, you can use test-driven development for bug fixing in real-world codebases. Write an integration-style test that reproduces the specific bug, confirm it fails, then apply the red-green-refactor loop to implement and verify the minimal fix.

What are tracer bullets and how do they relate to incremental design?

Tracer bullets are end-to-end tests that validate a thin slice of functionality through the public API. They guide incremental design by proving the architectural path works early, enabling safe refactoring and reliable feature delivery.

When should I avoid test-driven development?

You should avoid test-driven development when requirements are completely undefined or the public API cannot be determined upfront. Without a clear interface to test against, the red-green-refactor loop and tracer-bullet planning cannot effectively guide incremental design.