TDD

Guide feature implementation through RED-GREEN-REFACTOR cycles with automated verification.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/RyoMa99/dotfiles --skill tdd-ryoma99
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: TDD
Source: https://github.com/RyoMa99/dotfiles/tree/main/dot_claude/skills/TDD
Command: npx skills add https://github.com/RyoMa99/dotfiles --skill tdd-ryoma99

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Ensures features are implemented with tests first to prevent requirement drift, context contamination, and brittle test suites by enforcing a disciplined RED-GREEN-REFACTOR workflow and clear verification steps.

Core Features & Use Cases

  • Structured TDD phases: Defines planning, test design (write failing tests first), iterative RED-GREEN-REFACTOR cycles, and final verification to deliver features reliably.
  • Automated VERIFY loop: Runs type checks, linters, and related tests after GREEN with up to three auto-retries and a defined blocked state if verification repeatedly fails.
  • Commit and quality rules: Encourages separate test/feat/refactor commits, evidence-based final verification (build/type/lint/tests), and integration with testing principles for legacy and new code.
  • Use cases: Implementing incremental features, adding tests to legacy code safely, and enforcing consistent CI-local verification prior to completion.

Quick Start

Write a failing acceptance test for the next requirement, implement the minimal code to make it pass, run verification (type checks and linters) until green, then refactor and commit following test/feat/refactor rules.

Frequently Asked Questions about TDD

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

FAQPage Schema
How do I implement test-driven development to prevent requirement drift?

Test-driven development prevents requirement drift by enforcing a RED-GREEN-REFACTOR workflow: write failing tests first, implement minimal code to pass them, then refactor with automated verification to ensure correctness.

What is the RED-GREEN-REFACTOR cycle and how does it work with automated verification?

The RED-GREEN-REFACTOR cycle involves writing a failing test first, implementing minimal code to pass it, then refactoring. Automated verification runs type checks, linters, and related tests with up to three auto-retries before committing.

How do I structure commits when doing test-driven development?

Structure commits in test-driven development by producing separate test, feat, and refactor commits. This convention isolates test creation, feature implementation, and code refactoring into distinct, verifiable version control steps.

Can I use test-driven development for adding tests to legacy code safely?

Yes, you can apply test-driven development to add tests to legacy code safely. Structured TDD phases integrate testing principles for both legacy and new code, ensuring incremental changes do not break existing behavior.

What happens when automated verification repeatedly fails during the TDD cycle?

When automated verification repeatedly fails during the TDD cycle after up to three auto-retries, the process enters a defined blocked state. This prevents brittle test suites and context contamination by halting progression until issues are resolved.