test-driven-development

Enforce the RED-GREEN-REFACTOR cycle by writing failing tests before implementation.

Updated Jan 23, 2026
One-click install
npx skills add https://github.com/joshsymonds/gambit --skill test-driven-development-joshsymonds
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/joshsymonds/gambit/tree/main/skills/test-driven-development
Command: npx skills add https://github.com/joshsymonds/gambit --skill test-driven-development-joshsymonds

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill enforces the RED-GREEN-REFACTOR cycle, ensuring that tests are written before production code, guaranteeing that code is implemented only to satisfy a failing test and preventing regressions.

Core Features & Use Cases

  • Enforces Test-First Development: Mandates writing a failing test before any production code.
  • Minimal Implementation: Guides the creation of the simplest code to pass the test.
  • Safe Refactoring: Ensures code quality and maintainability by refactoring only when tests are passing.
  • Use Case: When adding a new feature, you'll first write a test that describes the desired behavior. This test will fail. Then, you'll write the minimum code necessary for that test to pass. Finally, you'll refactor the code while ensuring all tests remain green.

Quick Start

Use the test-driven-development skill to implement a new feature by writing a failing test first.

Frequently Asked Questions about test-driven-development

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

FAQPage Schema
How do I enforce test-driven development when writing production code?

Test-driven development is enforced by automating the RED-GREEN-REFACTOR cycle, ensuring a failing test is written before any implementation. This strict testing protocol prevents regressions and guarantees code is built only to satisfy tests.

What is the red-green-refactor cycle and how does it ensure code quality?

The red-green-refactor cycle requires writing a failing test, creating the minimal code to pass it, and then safely refactoring. This iterative development process ensures code quality and maintainability by only refactoring when tests are green.

Do I need to write a failing unit test before implementing a new feature?

Yes, you must write a failing unit test before implementing a new feature. This test-first approach mandates creating a test describing the desired behavior, then writing the minimum production code necessary for that test to pass.

How do I safely refactor code while maintaining passing tests?

To safely refactor code, you must only modify the implementation after all tests are passing. The test-driven development approach ensures you can refactor for code quality while the existing green tests prevent regressions.

Can I use test-driven development for any software development scenario?

Yes, test-driven development is applicable to all software development scenarios requiring robust, testable code. It enforces strict testing protocols and iterative development regardless of the specific project context.

What are the limitations of strict test-first development protocols?

Strict test-first development requires adherence to iterative protocols and writing failing tests before implementation. This mandates a disciplined approach where minimal implementation is required, which may slow initial feature prototyping.