test-driven-development

Write failing tests before production code using the red-green-refactor cycle.

Updated Nov 21, 2025
One-click install
npx skills add https://github.com/HaRu-LLC/ai-pm_system_notebooklmuse --skill test-driven-development-haru-llc
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/HaRu-LLC/ai-pm_system_notebooklmuse/tree/main/.agent/skills/engineering/test-driven-development
Command: npx skills add https://github.com/HaRu-LLC/ai-pm_system_notebooklmuse --skill test-driven-development-haru-llc

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Enforces the discipline of TDD by writing tests before production code to guarantee correctness.

Core Features & Use Cases

  • Red-Green-Refactor cycle as the core practice to quickly validate changes.
  • Absolute rule: never write production code before a failing test.
  • Use Cases: applying TDD to new features, refactors, and bug fixes to improve reliability.

Quick Start

Begin by writing a failing test for the desired behavior, then implement just enough code to pass the test.

Frequently Asked Questions about test-driven-development

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

FAQPage Schema
What is test-driven development and how does the red-green-refactor cycle work?

Test-driven development (TDD) is a practice where you write a failing test before implementation, run it to confirm failure (red), write just enough code to pass (green), and then refactor. This cycle validates changes and enforces coding discipline.

How do I apply TDD to refactoring and bug fixes?

To apply TDD to refactoring and bug fixes, start by writing a failing test that captures the desired behavior or the specific bug. Then implement the minimal production code required to make that test pass, ensuring the change is validated.

What's the best way to start writing tests before implementation for a new feature?

The best way to start TDD for a new feature is to write a failing test for the exact desired behavior first. You then implement only the minimum production code necessary to make that test pass, guaranteeing correctness from the start.

Why should I never write production code before tests in TDD?

You should never write production code before tests in TDD because the failing test defines the exact requirement and validates correctness. Writing code first breaks the disciplined red-green-refactor cycle and removes the guarantee that changes are tested.

Can I use strict TDD for everyday software development tasks?

Yes, you can use strict TDD for everyday software development tasks including building new features, performing refactors, and fixing bugs. It enforces the red-green-refactor cycle to ensure all code changes are validated by tests.