test-driven-development

Guide red-green-refactor cycles from failing test to minimal implementation.

1.5k|257|Updated Nov 19, 2018
One-click install
npx skills add https://github.com/adobe/spectrum-web-components --skill test-driven-development-adobe
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/adobe/spectrum-web-components/tree/main/.ai/skills/test-driven-development
Command: npx skills add https://github.com/adobe/spectrum-web-components --skill test-driven-development-adobe

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

The Mindset and practice of test-driven development help teams define desired behavior before implementing code, reducing defects and rework.

Core Features & Use Cases

  • Red-Green-Refactor workflow: write a failing test first, verify it fails, write minimal production code to pass, then refactor for clarity and maintainability.
  • Guided decision-making: clarifies when to apply TDD to new features, bug fixes, refactoring, or behavior changes.
  • Education and discipline: emphasizes discipline, maintainable tests, and safe code evolution in software projects.

Quick Start

Provide a failing test for the feature, then implement the minimal code to satisfy it.

Frequently Asked Questions about test-driven-development

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

FAQPage Schema
How does the red-green-refactor workflow improve unit-testing outcomes?

The red-green-refactor workflow drives unit-testing by first writing a failing test, implementing minimal code to pass it, then refactoring for maintainable behavior. This reduces defects and rework by defining expected behavior before production code execution.

How do I start test-driven development for a new feature?

Start test-driven development by providing a failing test for the desired feature, then implement the minimal production code to satisfy it. This structured workflow defines behavior first, verifies the failure, and ensures safe code evolution.

When should I apply test-driven development in my software engineering process?

Apply test-driven development during feature development, bug fixes, refactors, and behavior changes across codebases. This test-first thinking clarifies decision-making and emphasizes discipline for safe code evolution in software engineering projects.

What's the best way to use TDD for refactoring existing code?

Use TDD for refactoring by writing a failing test that captures desired behavior, implementing minimal code to pass, then refactoring for clarity. This ensures maintainable tests and safe code evolution during structural changes.

Does test-driven development work for both bug fixes and new feature development?

Test-driven development works for both bug fixes and new feature development by guiding teams through test-first thinking. It defines desired behavior before implementing code, reducing defects and ensuring reliable, maintainable software.

Why does writing a failing test first help ensure code quality?

Writing a failing test first helps ensure code quality by defining desired behavior before implementation, reducing defects and rework. This discipline verifies the test fails for the right reason, then guides minimal code to pass it.