One-click install
npx skills add https://github.com/ethan-rio/skills --skill tdd-ethan-rio
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/ethan-rio/skills/tree/main/skills/engineering/tdd
Command: npx skills add https://github.com/ethan-rio/skills --skill tdd-ethan-rio

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill solves the common pain of writing flaky, implementation-coupled tests that break during code refactors, and the risk of shipping buggy features due to incomplete or incorrect test coverage. It enforces a disciplined test-first workflow that ensures tests verify actual user-facing behavior rather than internal implementation details.

Core Features & Use Cases

  • Vertical Slice TDD Workflow: Guides you to write one test at a time paired with minimal implementation, avoiding the common anti-pattern of writing all tests first then all code which leads to low-value, behavior-agnostic tests.
  • Behavior-Focused Test Guidelines: Provides clear rules for writing integration-style tests that survive internal refactors, plus explicit guidance on when and how to mock external system boundaries only.
  • Supporting Reference Materials: Includes quick guides on designing testable interfaces, building deep modules, identifying refactor opportunities, and distinguishing good behavior-focused tests from bad implementation-detail tests.
  • Use Case: For example, when adding a new user profile update feature to a web app, use this Skill to first write a test verifying that a user can update their email address via the public API, then implement the minimal code to pass that test, ensuring the feature works as expected without breaking existing functionality.

Quick Start

Request that the AI implement the new order cancellation feature using test-driven development, writing tests for successful cancellation and invalid order ID handling first before writing any implementation logic.

Frequently Asked Questions about tdd

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

FAQPage Schema
Why do my tests break when I refactor code, even when the feature still works?

Tests break during refactoring when they are coupled to internal implementation details rather than actual user-facing behavior. Enforcing a behavior-focused test-first workflow ensures tests verify public interfaces, making them resilient to internal code changes.

How to apply test-driven development to add a new feature without breaking existing functionality?

To apply test-driven development, write one integration test verifying the expected behavior first, implement the minimal code to pass it, and then refactor. This vertical slice approach ensures reliable coverage without writing all tests upfront.

What is the difference between good behavior-focused tests and bad implementation-detail tests?

Good behavior-focused tests validate actual user-facing outcomes via public APIs, while bad implementation-detail tests assert internal states or mock too heavily. Checking only external system boundaries ensures tests survive internal code refactors.

Can I use test-driven development for bug fixes and codebase refactoring tasks?

Yes, test-driven development is highly effective for bug fixes and codebase refactoring. By writing a failing test that reproduces the bug first, you can implement the fix and verify behavioral test coverage without introducing regressions.

When should I mock external system boundaries during integration testing?

You should mock external system boundaries only during integration testing when dealing with third-party services or I/O operations. This isolates test logic from external volatility while ensuring internal modules remain behavior-focused and refactor-proof.

Does test-driven development work for writing all tests first before implementation?

Test-driven development discourages writing all tests first before implementation, as this leads to low-value, behavior-agnostic tests. Instead, it enforces a disciplined red-green-refactor workflow, pairing one test at a time with minimal implementation.