test-driven-development

Write a failing test before implementing production code in a red-green-refactor workflow.

Updated Apr 14, 2026
One-click install
npx skills add https://github.com/gerald-ica/opencode-config-snapshot --skill test-driven-development-gerald-ica
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/gerald-ica/opencode-config-snapshot/tree/main/opencode/skills/test-driven-development
Command: npx skills add https://github.com/gerald-ica/opencode-config-snapshot --skill test-driven-development-gerald-ica

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Promotes a disciplined software development approach by ensuring a failing test is written before implementing code, which improves reliability and maintainability.

Core Features & Use Cases

  • Red-Green-Refactor cycle as a standard workflow to validate behavior.
  • Mandatory tests first to catch regressions early and guide design.
  • Clear guidance for applying TDD to features, bug fixes, or refactors in real projects.

Quick Start

Write a failing test for the desired behavior, implement only enough production code to pass, then refactor for clarity.

Frequently Asked Questions about test-driven-development

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

FAQPage Schema
How do I apply test-driven development to ensure code passes before implementation?

Test-driven development requires writing a failing test first to verify desired behavior, then implementing only the minimal production code needed to pass that test. This red-green-refactor workflow catches regressions early and guides software design.

What is the red-green-refactor cycle in unit testing?

The red-green-refactor cycle is a unit testing workflow where you write a failing test, implement just enough code to make it pass, and then refactor for clarity. This disciplined approach improves software reliability and maintainability.

Can I use test-driven development for bug fixes and refactoring existing code?

Yes, test-driven development is intended for feature work, bug fixes, and refactoring. By writing a failing test that captures the desired behavior first, you create reliable guardrails that verify the fix or refactor works correctly.

Why does test-driven development require writing failing tests first?

Test-driven development requires failing tests first to validate that the test actually checks the intended behavior and to catch regressions early. This mandatory step guides code design by ensuring only minimal production code is written to pass tests.

When should I not use a test-first approach for software development?

A test-first approach is best suited for situations requiring reliable behavior and guardrails, such as feature work and bug fixes. If a task is purely exploratory or requires no verifiable behavior, the strict red-green-refactor workflow may be unnecessary overhead.

What's the best way to start unit testing with a test-first workflow?

The best way to start a test-first workflow is to write a failing test for the specific desired behavior, implement the minimum production code required to pass the test, and then refactor the code for clarity and maintainability.