test-driven-development

Enforces a test-first workflow with red-green-refactor for software projects.

Updated Nov 2, 2025
One-click install
npx skills add https://github.com/dheerkt/dotfiles --skill test-driven-development-dheerkt
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/dheerkt/dotfiles/tree/main/opencode-work/skill/test-driven-development
Command: npx skills add https://github.com/dheerkt/dotfiles --skill test-driven-development-dheerkt

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Test-driven development (TDD) prescribes writing a failing test before production code to define and validate the intended behavior and catch regressions early.

Core Features & Use Cases

  • Red-Green-Refactor cycle to drive implementation with tests.
  • Clear guardrails: never write production code until a test fails, ensuring alignment with requirements.
  • Suitable for new features, bug fixes, and refactors to maintain code quality and design.

Quick Start

Write a failing test for the next feature, run tests to see the failure, implement the minimal production code to make tests pass, then refactor while keeping all tests green.

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 is a workflow where you write a failing test before production code. The red-green-refactor cycle means writing a failing test, implementing minimal code to pass it, then refactoring while keeping tests green.

How do I use test-driven development for bug fixes and refactoring?

Test-driven development for bug fixes involves writing a test that captures the bug's failure first. For refactoring, you rely on existing tests to validate behavior remains unchanged while improving code design.

Can I use test-driven development for any software engineering project without dependencies?

Yes, test-driven development applies across software projects without specific dependencies. It enforces a deterministic, minimal implementation guided by tests for feature development, bug fixes, and refactors.

What's the best way to start writing unit tests first in a development process?

The best way to start writing unit tests first is to define the next feature's intended behavior, write a failing test, run it to confirm failure, implement minimal code to pass, then refactor.

Why does test-first development require capturing a failing test before implementation?

Test-first development requires a failing test to ensure production code aligns with requirements. This guardrail prevents writing unnecessary code and validates that the test actually checks the intended behavior.