tdd

Guide development through the RED-GREEN-REFACTOR cycle for TDD workflows.

1|Updated Jan 3, 2022
One-click install
npx skills add https://github.com/daikichiba9511/dotfiles --skill tdd-daikichiba9511
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/daikichiba9511/dotfiles/tree/main/private_dot_codex/skills/tdd
Command: npx skills add https://github.com/daikichiba9511/dotfiles --skill tdd-daikichiba9511

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

TDD workflow facilitation reduces cycle time and improves software reliability by enforcing a test-first approach and structured refactoring.

Core Features & Use Cases

  • Provides a repeatable RED-GREEN-REFACTOR pattern for feature development.
  • Encourages small, incremental changes with fast feedback from tests.
  • Use Case: When adding a new feature, start by writing a failing test, implement the simplest code to pass, then refactor while keeping tests green.

Quick Start

Start a RED-GREEN-REFACTOR cycle for a feature by writing a failing test, implementing the minimal code to pass, and then refactoring while keeping all tests green.

Frequently Asked Questions about tdd

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

FAQPage Schema
How do I start a test-driven development cycle for a new feature?

To start test-driven development, write a failing test first, implement the minimal code required to pass it, then refactor while keeping tests green. This RED-GREEN-REFACTOR cycle enforces small incremental changes with fast feedback.

How do I structure unit tests using Arrange-Act-Assert guidance?

Arrange-Act-Assert guidance structures unit tests into three phases: set up preconditions, execute the behavior, and verify outcomes. This pattern integrates into the RED-GREEN-REFACTOR cycle to keep test logic compact and maintainable.

Does this TDD workflow work with Bash-based test execution?

Yes, this TDD workflow is compatible with Bash-based test execution and common tooling. It provides procedural guidance for RED, GREEN, and REFACTOR steps that integrate with standard command-line test runners.

What is the best way to refactor code while keeping unit tests green?

The best way to refactor while keeping unit tests green is to make small, incremental changes after achieving a passing test. Run the test suite frequently to ensure the refactoring preserves behavior without breaking existing test coverage.

When should I use the RED-GREEN-REFACTOR cycle instead of writing tests after implementation?

Use the RED-GREEN-REFACTOR cycle when adding new features or modifying existing code to ensure reliability. Writing tests first forces minimal implementations and immediate feedback, whereas testing afterward often misses edge cases and design flaws.