test-driven-development

Enforce a Red-Green-Refactor workflow by writing failing tests before implementation.

Updated Sep 25, 2025
One-click install
npx skills add https://github.com/iyaki/opencode-base-template --skill test-driven-development-iyaki
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/iyaki/opencode-base-template/tree/main/.agents/skills/test-driven-development
Command: npx skills add https://github.com/iyaki/opencode-base-template --skill test-driven-development-iyaki

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Helps teams ensure correct behavior by requiring a failing test before implementing code, preventing hidden defects and guiding design from the start.

Core Features & Use Cases

  • Enforces the Red-Green-Refactor cycle to improve code quality.
  • Early bug detection through tests that fail on broken features.
  • Improves documentation of intended behavior for future maintenance.

Quick Start

Write a failing test for the next feature, then implement the minimal code to make it pass.

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 process where you write failing tests before implementing code. The red-green-refactor cycle requires writing a failing test first, implementing minimal code to pass it, and then cleaning up the implementation.

How do I use test-driven development to fix bugs and verify behavior?

To fix bugs using test-driven development, write a failing test that reproduces the broken behavior first. Implement the minimal code required to make the test pass, ensuring the defect is fixed and the correct behavior is verified.

Why should I write failing tests before implementing new features?

Writing failing tests before implementing features prevents hidden defects and guides software design from the start. This early bug detection ensures correct behavior and improves the documentation of intended behavior for future maintenance.

Can I apply test-driven development when refactoring existing code?

Yes, test-driven development applies to refactors where behavior must be verified before coding. You write failing tests to confirm the expected behavior, implement the changes to pass them, and then execute subsequent cleanup safely.

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

Test-driven development does not require specific dependencies or components. It is a development process applicable across platforms, enforcing the red-green-refactor workflow to improve code quality and ensure correct behavior.