tdd

Guide test-driven development with red-green-refactor loops and behavior-focused validation.

484|76|Updated Oct 23, 2025
One-click install
npx skills add https://github.com/bastani-inc/atomic --skill tdd-bastani-inc
Or copy as Structured Prompt for Agentā–¼
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/bastani-inc/atomic/tree/main/packages/subagents/skills/tdd
Command: npx skills add https://github.com/bastani-inc/atomic --skill tdd-bastani-inc

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you build features and fix bugs with a disciplined test-first workflow, so you can verify behavior early and avoid brittle implementation-driven tests.

Core Features & Use Cases

  • Behavior-focused testing: Write tests against public interfaces and observable outcomes instead of private methods or internal collaborators.
  • Incremental red-green-refactor loops: Add one test at a time, implement the minimum needed to pass, then refactor safely after everything is green.
  • Practical test design: Decide what behaviors matter most, identify boundary dependencies to mock, and keep tests resilient through refactors.
  • Use case: When adding checkout logic, you can define the user-visible behavior first, prove the path works end to end, and expand coverage without overbuilding.

Quick Start

Ask for a test-driven plan for your feature or bug fix, starting with the first public behavior that should pass.

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 a new software feature?ā–¼

Test-driven development begins by defining the first public behavior your feature must exhibit. You write a failing test against the public interface, implement the minimal code to pass it, and then refactor safely while keeping the behavior validated.

What is the red-green-refactor loop and how does it improve code reliability?ā–¼

The red-green-refactor loop is a test-driven cycle where you write a failing test, implement minimal code to pass it, then refactor safely. It improves reliability by verifying observable behavior early and preventing overbuilt, brittle implementation logic.

Should I mock dependencies when writing integration-style tests?ā–¼

You should mock dependencies at boundary limits during integration-style tests. Deciding what behaviors matter most and mocking only external collaborators keeps tests resilient through refactors and focused on observable public outcomes.

How do I write behavior-focused tests without testing private methods?ā–¼

Behavior-focused testing targets public interfaces and observable outcomes instead of private methods. You validate user-visible behavior through integration-style tests, ensuring your test suite remains resilient during post-green refactoring and internal implementation changes.

Can I use test-driven development to fix existing bugs safely?ā–¼

Test-driven development effectively fixes bugs by writing a failing test that reproduces the incorrect behavior first. You then apply minimal incremental code changes to correct the logic and ensure the behavior-focused validation passes before refactoring.

When should I not use test-driven development for refactoring?ā–¼

You should avoid test-driven development for refactoring when existing tests are tightly coupled to private implementation details rather than public interfaces. Refactoring requires behavior-focused validation, so brittle implementation-driven tests will break during structural changes.