test-driven-development

Create failing tests before implementing features using the red-green-refactor cycle.

8|1|Updated Feb 25, 2022
One-click install
npx skills add https://github.com/ayubun/dotfiles --skill test-driven-development-ayubun
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/ayubun/dotfiles/tree/main/configs/opencode/skills/ed3d-plan-and-execute/test-driven-development
Command: npx skills add https://github.com/ayubun/dotfiles --skill test-driven-development-ayubun

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill ensures the creation of comprehensive tests before writing code, leading to more reliable, maintainable, and bug-free software.

Core Features & Use Cases

  • Test-First Development: Encourages writing tests before implementing features or fixes.
  • Red-Green-Refactor Cycle: Provides a structured approach to development with clear steps to create, verify, and refactor code.
  • Documentation Through Tests: Helps document code behavior and usage with living documentation.
  • Use Case: Before implementing a new feature, use this Skill to create tests that define the expected behavior, ensuring that the feature is implemented correctly.

Quick Start

Implement the "Add User" feature using test-driven development (TDD).

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 improve code quality?

Test-driven development is a methodology where you write failing tests before implementation to verify behavior early. It improves code quality and reduces debugging time by ensuring robust test suites and living documentation throughout the development process.

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

Start writing tests before implementation by creating tests that define expected behavior for the new feature. Follow the red-green-refactor cycle: create a failing test, implement code to verify and pass it, then refactor while maintaining behavior verification.

Does test-driven development work for fixing bugs in existing software?

Test-driven development works for bug prevention in existing software by emphasizing the creation of failing tests that reproduce the bug before applying a fix. This behavior verification approach ensures the fix is correct and prevents regression in the test suite.

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

The red-green-refactor cycle is a structured test-driven development approach with clear steps: create a failing test, write implementation code to pass it, then refactor the code. This cycle ensures behavior verification and maintains robust test suites throughout development.

When should I not use test-driven development for my software engineering tasks?

You should avoid test-driven development when tasks lack clear behavioral expectations or require exploratory prototyping. Since this methodology prioritizes behavior verification and test creation before implementation, ambiguous requirements make writing robust test suites difficult and counterproductive.