test-driven-development

Automate the red-green-refactor cycle by writing failing tests before implementation.

Updated Jan 12, 2021
One-click install
npx skills add https://github.com/jssee/.dotfiles --skill test-driven-development-jssee
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/jssee/.dotfiles/tree/main/.config/opencode/skill/test-driven-development
Command: npx skills add https://github.com/jssee/.dotfiles --skill test-driven-development-jssee

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill guides teams to write failing tests before implementing code, ensuring a reliable feedback loop and better design from the start.

Core Features & Use Cases

  • Red-Green-Refactor workflow: structure your work into failing test, passing code, and cleanup.
  • Quality through tests first: prevent regressions by making tests the gate for production code.
  • Use Cases: ideal for feature work, bug fixes, and refactoring where correctness matters.

Quick Start

  • Start by writing a failing test that describes the desired behavior.
  • Implement the minimal production code to make the test pass.
  • Refactor the code while keeping tests green and maintainable.

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 is a workflow where you write a failing test, implement minimal code to pass it, and then refactor while keeping tests green. This enforces a reliable feedback loop for better software design.

How do I start writing tests before implementation for a new feature?

To start writing tests before implementation, write a failing test that describes the desired behavior, implement the minimal production code to make the test pass, and refactor the code while keeping tests maintainable and green.

When should I use test-driven development for software testing?

Use test-driven development for software testing during feature development, bug fixes, and refactoring where correctness matters. It prevents regressions by making tests the gate for production code across projects where TDD is appropriate.

Can I write production code without a failing test first using this workflow?

No, the test-driven development workflow prohibits code without failing tests first. It automates the discipline of writing failing tests before implementation to ensure a reliable feedback loop and maintain code quality.

Does test-driven development work for bug fixes and refactoring existing code?

Yes, test-driven development works for bug fixes and refactoring existing code. It applies the red-green-refactor cycle across these use cases, preventing regressions by making tests the gate for production code.