test-driven-development

Guide developers through Red-Green-Refactor cycles with test-first practices.

3|Updated May 31, 2024
One-click install
npx skills add https://github.com/hugo-berendi/yomi --skill test-driven-development-hugo-berendi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/hugo-berendi/yomi/tree/main/.opencode/skills/test-driven-development
Command: npx skills add https://github.com/hugo-berendi/yomi --skill test-driven-development-hugo-berendi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill reinforces a disciplined development approach by ensuring tests guide implementation, reducing regression risk, and speeding up debugging.

Core Features & Use Cases

  • Test-first workflow: write a failing test before coding to define expected behavior.
  • Red-Green-Refactor cycle: iterate quickly from failing test to passing code to cleaner design.
  • Quality assurance mindset: promotes maintainable, well-tested code across features, bug fixes, and refactors.

Quick Start

Create a failing test for the feature you plan to implement, then write the minimal code to make it pass, and finally refactor for clarity and simplicity.

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 workflow where you write a failing test first, implement minimal code to pass it, then refactor. The Red-Green-Refactor cycle iterates through these three phases to ensure reliable behavior and reduce regression risk.

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

To start test-driven development, create a failing test that defines the expected behavior for your planned feature. Next, write the minimal production code required to make that test pass, then refactor the code for clarity and simplicity.

Can I apply test-driven development to bug fixes and refactoring existing code?

Yes, test-driven development applies to bug fixes and refactoring. You write a failing test that reproduces the bug or verifies the current behavior, then implement the fix or refactor the code to ensure regression-free, maintainable software.

Why should I write failing tests before writing production code?

Writing failing tests before production code reduces regression risk and speeds up debugging. This test-first approach ensures your implementation is guided by expected behavior, promoting a quality assurance mindset and maintainable code.

Do I need any specific testing frameworks or dependencies to follow this TDD workflow?

No specific testing frameworks or dependencies are required. This test-driven development workflow is framework-agnostic, focusing on the iterative practice of writing failing tests, minimal implementation code, and refactoring across any software engineering environment.