test-driven-development

Guide developers through the Red-Green-Refactor cycle for test-first development.

5|Updated Feb 6, 2026
One-click install
npx skills add https://github.com/FaisalAlqarni/sp-ecc --skill test-driven-development-faisalalqarni
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/FaisalAlqarni/sp-ecc/tree/main/skills/test-driven-development
Command: npx skills add https://github.com/FaisalAlqarni/sp-ecc --skill test-driven-development-faisalalqarni

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill enforces a rigorous Test-Driven Development (TDD) methodology to ensure code quality, prevent regressions, and build robust software by writing tests before implementation.

Core Features & Use Cases

  • Mandatory Test-First Approach: Guarantees that no production code is written without a preceding failing test.
  • Red-Green-Refactor Cycle: Guides developers through the iterative process of writing tests, minimal code, and cleaning up.
  • Use Case: When developing a new user authentication feature, you would first write a test that fails because the authentication logic doesn't exist, then write the minimal code to pass that test, and finally refactor the code while ensuring tests remain green.

Quick Start

Follow the Red-Green-Refactor cycle for all new features and bug fixes.

Frequently Asked Questions about test-driven-development

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

FAQPage Schema
What is the red-green-refactor cycle in test-driven development?

The red-green-refactor cycle in test-driven development is an iterative process where you write a failing test, create minimal code to pass it, and then refactor the implementation while ensuring tests remain green.

How do I prevent code regressions when adding new software features?

To prevent code regressions, you should enforce a test-first approach by writing failing unit, integration, or E2E tests before implementing the new feature, ensuring all existing tests remain green during refactoring.

When do I need to write unit tests versus integration or E2E tests?

You need to write unit tests for isolated logic, integration tests for module interactions, and E2E tests for full system flows to establish comprehensive coverage standards and prevent regressions across your software architecture.

What are common TDD anti-patterns I should avoid during refactoring?

Common TDD anti-patterns to avoid include writing implementation code before a failing test exists, skipping the refactoring phase, and over-complicating initial code beyond what is required to make the test pass.

Can I apply TDD principles to fix existing bugs in my code?

Yes, you can apply TDD principles to fix existing bugs by first writing a regression test that reproduces the specific failure, then writing the minimal code to make that test pass, and finally refactoring the solution.