tdd-workflow

Guide developers through the RED-GREEN-REFACTOR Test-Driven Development cycle.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It prevents unclear requirements and fragile code by guiding you to define behavior as failing tests first, then implement the smallest change to make them pass, and finally improve structure without breaking correctness.

Core Features & Use Cases

  • RED phase (Write failing tests): Capture expected behavior, edge cases, and error states so the test genuinely fails before implementation.
  • GREEN phase (Minimal passing code): Implement only the simplest production code needed to satisfy the failing test, following the RED→GREEN goal of fast feedback.
  • REFACTOR phase (Improve safely): Remove duplication, clarify naming, and simplify structure while keeping all tests green.
  • AAA test pattern: Keep tests readable and maintainable by structuring them as Arrange, Act, Assert.
  • When to use: Best for new features, bug fixes, and complex logic; less suitable for purely exploratory spikes and mostly UI layout work.

Quick Start

Ask your AI to help you write a failing test first for the behavior you want, then implement the minimal code to make that test pass, and finally refactor while keeping the tests green.

Frequently Asked Questions about tdd-workflow

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

FAQPage Schema
How do I apply test-driven development to write better software?

Test-driven development enforces a RED-GREEN-REFACTOR cycle where you write failing tests first, implement minimal passing code, and then safely improve structure. This prevents unclear requirements and fragile code by defining behavior upfront.

How do I write unit tests using the AAA pattern?

The AAA pattern structures unit tests into Arrange, Act, and Assert sections. This keeps tests readable and maintainable by clearly separating setup, execution, and verification of expected behavior.

What is the minimal code implementation needed to pass a failing test?

In the GREEN phase of TDD, you implement only the simplest production code needed to satisfy the failing test. This ensures fast feedback and strict adherence to test-first requirements before any refactoring occurs.

When should I not use test-first development for new features?

Test-first development is less suitable for purely exploratory spikes and mostly UI layout work. It is best applied to feature development, bug fixing, and complex behavior specification where clear testable outcomes are required.

Why does refactoring require keeping unit tests green?

Refactoring removes duplication, clarifies naming, and simplifies structure while keeping all tests green. This ensures you improve code design safely without breaking existing correctness or behavior.

Can I use TDD workflow for fixing bugs in existing logic?

Yes, TDD workflow applies to bug fixing by capturing expected behavior and error states as failing tests first. You then implement minimal code to pass the test, ensuring the specific bug is resolved and verifiable.