tdd

Implement a red-green-refactor workflow to drive test-driven development.

779|80|Updated Jun 20, 2025
One-click install
npx skills add https://github.com/Haohao-end/openagent --skill tdd-haohao-end
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/Haohao-end/openagent/tree/main/api/internal/core/skills/catalog/tdd
Command: npx skills add https://github.com/Haohao-end/openagent --skill tdd-haohao-end

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

TDD helps you avoid fragile implementations and unclear requirements by forcing you to define expected behavior in tests before writing production code.

Core Features & Use Cases

  • Red-Green-Refactor loop: Start from a failing test, make the smallest change to pass, then refactor while keeping tests green.
  • Regression protection: Convert specific behaviors into tests so they don’t break during future changes.
  • Thin-slice progression: Move forward one minimal capability at a time to reduce complexity and ambiguity.
  • Use case: When implementing a new feature, write a failure test for the desired behavior first, then iterate with minimal code changes until it passes and stays passing after refactors.

Quick Start

Ask me to implement a feature using TDD by first writing a failing test, then applying the smallest change to make it pass, and finally refactoring without breaking the tests.

Frequently Asked Questions about tdd

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

FAQPage Schema
How do I implement a feature using test-driven development to prevent regressions?

Test-driven development prevents regressions by defining expected behavior in a failing test first, then applying minimal code changes to pass it before refactoring. This enforces disciplined incremental delivery and ensures stable, verified behavior.

What is the red-green-refactor loop in test-driven development?

The red-green-refactor loop is a test-driven development cycle where you write a failing test, make the smallest code change to pass it, and then refactor while maintaining a green test suite. This process drives thin-slice progression for new features.

When do I need test-driven development for my software engineering workflow?

Test-driven development is needed when implementing new software features that require regression coverage and clarity about expected outcomes before coding. It helps avoid fragile implementations by forcing you to define specific behaviors as tests.

Does test-driven development work for reducing complexity in incremental feature delivery?

Yes, test-driven development reduces complexity by moving forward one minimal capability at a time. This thin-slice progression approach converts specific behaviors into tests, eliminating ambiguity and ensuring your engineering workflow maintains a green test suite.

What's the best way to write tests first for new software features?

The best way to write tests first is to start by generating a failure test for the desired behavior, iterate with minimal code changes until it passes, and finally refactor without breaking the tests. This ensures regression protection and stable outcomes.

Why does writing production code before tests lead to unclear requirements?

Writing production code before tests leads to unclear requirements because it skips defining expected behavior upfront. Test-driven development solves this by forcing you to specify expected outcomes in tests first, preventing fragile implementations and future regressions.