tdd

Implement test-first development with red-green-refactor cycles for features and bug fixes.

Updated Jul 2, 2026
One-click install
npx skills add https://github.com/HexSleeves/skills --skill tdd-hexsleeves
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/HexSleeves/skills/tree/main/skills/tdd
Command: npx skills add https://github.com/HexSleeves/skills --skill tdd-hexsleeves

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you build features or fix bugs test-first so you can validate behavior before implementation and avoid brittle, implementation-coupled tests.

Core Features & Use Cases

  • Red-green-refactor workflow: Write one behavior-focused test, implement the smallest change, and then refactor safely.
  • Integration-style testing guidance: Prefer public interfaces and observable outcomes over private methods or internal collaborators.
  • Mocking boundaries: Mock only external systems such as APIs, databases, time, randomness, or file systems when needed.
  • Use case: Ideal when adding a feature, repairing a regression, or validating end-to-end behavior through a stable public API.

Quick Start

Use the tdd skill to help me define the highest-priority behavior, write the first failing test, and iterate through the smallest code changes until it passes.

Frequently Asked Questions about tdd

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

FAQPage Schema
How do I write tests first when adding a new feature?

Test-first development requires writing one behavior-focused failing test, making the smallest code change to pass it, then refactoring safely. This red-green-refactor workflow validates expected behavior before implementation and prevents brittle tests.

What is the best way to fix regressions using red-green-refactor?

Fixing regressions through red-green-refactor involves writing a failing test that reproduces the bug, implementing the minimal repair to turn it green, and refactoring safely. This validates the observable outcome through public interfaces without coupling to implementation details.

When should I use mocking in integration tests?

Use mocking in integration tests only at external system boundaries like APIs, databases, time, randomness, or file systems. Boundary-only mocking verifies observable outcomes through public interfaces rather than stubbing internal collaborators or private methods.

Does test-first development work for validating integration flows through public APIs?

Test-first development applies to validating integration flows by preferring public interfaces and observable outcomes over private methods. It guides vertical red-green-refactor cycles to validate end-to-end behavior through a stable public API safely.

Why are my tests brittle and coupled to implementation details?

Tests become brittle when they assert on internal collaborators or private methods instead of observable outcomes. Behavior-focused testing through public interfaces with boundary-only mocking avoids implementation coupling and ensures stable regression validation.

Can I use TDD for both feature additions and bug fixes?

TDD implements test-first development for both adding features and repairing regressions. It requires vertical red-green-refactor cycles to define the highest-priority behavior, write the first failing test, and iterate through the smallest code changes until passing.