test-driven-development

Enforce test-driven development with a red-green-refactor workflow.

2|1|Updated Jan 5, 2026
One-click install
npx skills add https://github.com/lagz0ne/prev-cli --skill test-driven-development-lagz0ne
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/lagz0ne/prev-cli/tree/main/.opencode/skill/test-driven-development
Command: npx skills add https://github.com/lagz0ne/prev-cli --skill test-driven-development-lagz0ne

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill promotes a test-first workflow to prevent regressions by ensuring every feature starts with a failing test.

Core Features & Use Cases

  • Enforces the Red-Green-Refactor cycle to guide development and ensure behavior tests drive implementation.
  • Applies to new features, bug fixes, refactors, and behavior changes across software projects.
  • Improves documentation of intended behavior by capturing requirements as tests.

Quick Start

Initiate a feature by writing a failing test, implement the minimal code to pass, run the test suite, and refactor for clarity. Use this pattern for all changes to ensure behavior is captured by tests.

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 it prevent regressions?

Test-driven development is a workflow where you write a failing test before implementing production code. It prevents regressions by ensuring every feature starts with a failing test that captures intended behavior.

How do I apply a red-green-refactor cycle to write new features?

To apply the red-green-refactor cycle, write a failing test first, observe the failure, implement minimal production code to pass the test, and refactor for clarity. Use this pattern to guide development and ensure behavior tests drive implementation.

Can I use this test-first workflow for bug fixes and refactoring?

Yes, this test-first workflow applies to bug fixes, refactoring, and behavior changes across software projects. You capture the required behavior as a test first, ensuring the code correctness is maintained during modifications.

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

Test-driven development requires writing a failing test first to document intended behavior and verify the test is valid. Observing the failure ensures the test actually checks the feature before minimal production code is implemented.

When do I need to refactor production code in a TDD workflow?

You need to refactor production code in a TDD workflow after the test passes. Once minimal code is implemented to turn the test green, you refactor for clarity while keeping the test suite passing to ensure code correctness.

Does test-driven development work without any specific testing framework?

Yes, this test-driven development workflow operates without specific framework dependencies. It enforces the red-green-refactor cycle to guide development across software projects, independent of specific testing platforms.