test-driven-development

Enforces a test-first Red-Green-Refactor workflow requiring a failing test before code changes.

Updated Aug 20, 2022
One-click install
npx skills add https://github.com/Neroro64/dotfiles --skill test-driven-development-neroro64
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/Neroro64/dotfiles/tree/main/configs/omp/agent/skills/test-driven-development
Command: npx skills add https://github.com/Neroro64/dotfiles --skill test-driven-development-neroro64

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Writing tests after implementing code often leads to unverified assumptions, missed edge cases, and painful regressions. This Skill enforces a test-first workflow, ensuring that a failing test guides the implementation and guards against regressions.

Core Features & Use Cases

  • Enforces failing-test-first discipline for new features, bug fixes, and refactors.
  • Guides teams through the Red-Green-Refactor cycle to produce minimal, well-tested implementations.
  • Improves maintainability by documenting expected behavior via tests and reducing regressions in production.

Quick Start

Run the failing test, then implement the minimal code to satisfy it.

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 test-first workflow requiring a failing test before writing production code. It enforces correct behavior and prevents regressions by guiding implementation through the Red-Green-Refactor cycle with explicit test coverage.

How do I fix bugs using a test-first workflow?

To fix bugs using a test-first workflow, write a failing test that reproduces the specific bug, then implement minimal deterministic production code to satisfy that test and confirm the fix.

Can I use test-driven development for refactoring existing code?

Yes, test-driven development applies to refactoring by enforcing a test-first workflow. It guides you through Red-Green-Refactor to ensure correct behavior is maintained and regressions are prevented during code modifications.

What is the Red-Green-Refactor cycle in test-first software development?

The Red-Green-Refactor cycle is a test-first mechanism where you write a failing test, implement minimal code to satisfy it, and then refactor to improve maintainability while keeping explicit test coverage deterministic.

Do I need prior test coverage to apply test-driven development?

No prior test coverage is needed because test-driven development enforces a test-first workflow by requiring a failing test before any production code is written for new features, bug fixes, or refactors.