test-driven-development

Enforce test-first workflows through Red-Green-Refactor cycles.

1|Updated Jul 11, 2019
One-click install
npx skills add https://github.com/crsiebler/dotfiles --skill test-driven-development-crsiebler
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/crsiebler/dotfiles/tree/main/ai/opencode/skills/test-driven-development
Command: npx skills add https://github.com/crsiebler/dotfiles --skill test-driven-development-crsiebler

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Writing production-ready code without tests often leads to brittle features and regression bugs. TDD advocates starting with a failing test to clarify expected behavior, then implementing the minimal code needed to pass, ensuring the codebase evolves with verifiable guarantees.

Core Features & Use Cases

  • Red-Green-Refactor cycle: write a failing test, observe failure, implement just enough production code to pass, then refactor for clarity and maintainability.
  • Behavior-driven safety: tests document intended behavior and guard against regressions during refactors or feature changes.
  • Applicable to features, bug fixes, and architectural changes across software projects, keeping code cohesive and testable.

Quick Start

Start by writing a failing test for the feature you intend to implement, then write the minimal production code to pass.

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 requires writing a failing test, implementing minimal production code to pass it, then refactoring for clarity. This test-first workflow ensures code evolves with verifiable guarantees.

How do I start writing unit tests before production code?

To start writing unit tests before production code, write a failing test for the feature you intend to implement, observe the failure, then write just enough production code to pass. This clarifies expected behavior upfront.

When should I use a test-first workflow for bug fixes and refactoring?

You should use a test-first workflow for bug fixes and refactoring to guard against regressions and document intended behavior. Writing failing tests first ensures architectural changes keep code cohesive and testable.

Does test-driven development require specific testing frameworks or dependencies?

Test-driven development does not require specific testing frameworks or dependencies. It is an intermediate-level workflow applicable across software projects, relying on behavior-driven safety rather than specialized external libraries.

Why write minimal production code to pass a failing test?

Writing minimal production code to pass a failing test prevents over-engineering and ensures every line of code is backed by a verifiable guarantee. This behavior-driven safety keeps features robust and prevents regression bugs.