Test-Driven Development (TDD)

Enforces red-green-refactor test-first workflow for writing production code.

Updated Dec 4, 2025
One-click install
npx skills add https://github.com/dallascrilley/dowser --skill test-driven-development-tdd-dallascrilley
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: Test-Driven Development (TDD)
Source: https://github.com/dallascrilley/dowser/tree/main/skills/test-driven-development
Command: npx skills add https://github.com/dallascrilley/dowser --skill test-driven-development-tdd-dallascrilley

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Code written before tests cannot be trusted, and tests written after implementation only verify what was built rather than what was required. This Skill enforces a strict test-first discipline so every behavior is proven by a failing test before any production code exists. ## Core Features & Use Cases - Red-Green-Refactor Cycle: Guides writing one failing test, verifying it fails for the right reason, implementing minimal code to pass, then refactoring while staying green. - Rationalization Detection: Lists common excuses for skipping TDD (manual testing, sunk cost, "test after") with direct rebuttals and red flags that trigger starting over. - Bug Fix Workflow: Reproduces bugs as failing tests first so fixes are proven and regressions are prevented. - Use Case: When fixing a bug where empty emails are accepted, write a failing test asserting the rejection, watch it fail, add the minimal validation, and confirm the suite stays green. ## Quick Start Ask the AI to implement a new feature or bug fix using strict test-driven development with a failing test written first.

Frequently Asked Questions about Test-Driven Development (TDD)

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

FAQPage Schema
How do I practice test-driven development step by step?▼

Follow the red-green-refactor cycle: write one minimal failing test, run it to confirm it fails for the expected reason, write the simplest code that passes, verify all tests pass, then refactor while keeping tests green. Repeat for each new behavior.

What is the red-green-refactor cycle in TDD?▼

Red means writing a failing test that defines desired behavior. Green means writing the minimal code to make it pass. Refactor means cleaning up duplication and names while keeping all tests passing, without adding new behavior.

Should I write tests before or after writing code?▼

Write tests before code. Tests written after implementation pass immediately, which proves nothing about whether they test the right thing. Watching a test fail first confirms it actually exercises the missing behavior.

When is it acceptable to skip TDD?▼

Exceptions are limited to throwaway prototypes, generated code, and configuration files, and only with explicit agreement from your human partner. Exploration is fine, but the exploratory code should be discarded and rewritten test-first.

Why does my test pass immediately when doing TDD?▼

An immediately passing test means you are testing existing behavior or the test is wrong. Fix the test so it fails for the expected reason, such as a missing feature, before writing any implementation code.

How do I fix a bug using test-driven development?▼

Write a failing test that reproduces the bug first, then implement the minimal fix until the test passes. This proves the fix works and creates a regression test that prevents the bug from returning.