test-driven-development

Enforce RED→GREEN→REFACTOR micro-cycles and keep diffs minimal

⭐1stars🔀0forks📁View on GitHub🕐Updated Nov 10, 2025

When & Why to Use This Skill

This Claude skill automates and enforces the Test-Driven Development (TDD) workflow, guiding the AI to strictly follow the Red-Green-Refactor cycle. By prioritizing tests before implementation and maintaining minimal diffs, it ensures high code reliability, reduces technical debt, and facilitates incremental, verifiable software development that aligns with modern engineering best practices.

Use Cases

  • New Feature Development: Implementing complex business logic by first defining requirements through failing test cases to ensure 100% functional coverage.
  • Bug Regression Testing: Reproducing reported issues with a specific failing test case before implementing a fix to prevent future regressions.
  • Code Refactoring: Safely restructuring and optimizing existing codebases while using a green test suite as a safety net to maintain functional integrity.
  • Input Validation: Implementing intricate validation rules (e.g., financial data or user credentials) through small, deterministic increments to handle all edge cases.
nametest-driven-development
descriptionEnforce RED→GREEN→REFACTOR micro-cycles and keep diffs minimal
version0.1.0
tags[testing, quality]

Test-Driven Development

Purpose

Bias implementation to tests-first and small, verifiable changes.

Behavior

  1. RED: scaffold 1–3 failing tests targeting the smallest slice.
  2. GREEN: implement the minimum code to pass.
  3. REFACTOR: improve names/structure with tests green.
  4. Repeat in tiny increments until task acceptance criteria are met.

Guardrails

  • Block large edits unless a failing test exists.
  • Prefer small diffs spanning ≤3 files.
  • Keep test names explicit and deterministic.

Output Style

  • bullet-points for steps; markdown-focused for code blocks.

Integration

  • /lazy task-exec implementation phase; Coder/Tester agents.

Example Prompt

Apply TDD to implement input validation for prices.