test-driven-development

Enforce a test-first workflow with RED-GREEN-REFACTOR cycles and bug reproduction tests.

Updated Jun 1, 2026
One-click install
npx skills add https://github.com/j-cogburn/d3 --skill test-driven-development-j-cogburn
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/j-cogburn/d3/tree/main/tests/project-t01/.d3/skills/test-driven-development
Command: npx skills add https://github.com/j-cogburn/d3 --skill test-driven-development-j-cogburn

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill eliminates the risk of shipping untested, buggy code and unexpected regressions that break existing functionality, ensuring every code change is fully verified before deployment.

Core Features & Use Cases

  • Structured TDD Workflow: Guides you through the RED-GREEN-REFACTOR cycle for all new feature implementation, with clear examples for writing failing tests first and minimal passing code.
  • Bug Fix Provenance: Implements the Prove-It Pattern to reproduce bugs with failing tests before fixing them, preventing recurring issues and guarding against regressions.
  • Test Quality Best Practices: Provides guidance on test sizing, the test pyramid, state-based assertions, DAMP test writing, and avoiding common anti-patterns like over-mocking and flaky tests.
  • Use Case: When adding a new user notification feature, use this Skill to write failing tests for email, in-app, and SMS notification triggers first, then implement the code to pass those tests, ensuring no existing notification flows break.

Quick Start

Use the test-driven-development skill to write a failing test for the new user profile update feature before implementing the corresponding code changes.

Frequently Asked Questions about test-driven-development

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

FAQPage Schema
How do I use test-driven development to prevent regressions in my code?

Test-driven development prevents regressions by enforcing a test-first workflow where you write failing tests before implementing code changes. This structured TDD cycle ensures every new feature and bug fix is fully verified before deployment.

What is the best way to reproduce a bug before applying a fix?

The best way to reproduce a bug is using the Prove-It Pattern, which involves writing a failing test that captures the exact bug behavior before you fix the underlying code. This bug reproduction workflow prevents recurring issues and guards against future regressions.

How do I apply the RED-GREEN-REFACTOR cycle when adding new features?

To apply the RED-GREEN-REFACTOR cycle, you first write a failing test for the new feature, implement the minimal code required to pass that test, and then refactor the code for quality. This test-first development workflow eliminates untested code and ensures maintainability.

What are common unit testing anti-patterns I should avoid?

Common unit testing anti-patterns to avoid include over-mocking and writing flaky tests. You can ensure code quality by following test sizing best practices, utilizing the test pyramid, and applying state-based assertions and DAMP test writing principles.

Does test-driven development work for integration and end-to-end testing?

Yes, test-driven development applies to integration and end-to-end testing, providing structured guidance for writing tests across all levels of your software project. It also includes browser runtime verification to comprehensively verify code changes and eliminate bugs.

When should I not use TDD for behavior modification tasks?

TDD is designed for all code implementation, bug fixes, and behavior modification tasks, meaning there are few limitations for software testing. However, you should avoid using it when you cannot define clear state-based assertions or when over-mocking would create flaky tests.