test-driven-development

Guide red-green-refactor cycles with minimal failing tests before implementation.

Updated Apr 24, 2026
One-click install
npx skills add https://github.com/otto-poblysh/pedagemy-early-access --skill test-driven-development-otto-poblysh
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/otto-poblysh/pedagemy-early-access/tree/main/.agents/skills/test-driven-development
Command: npx skills add https://github.com/otto-poblysh/pedagemy-early-access --skill test-driven-development-otto-poblysh

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It prevents unreliable code changes by ensuring you prove behavior with a failing test before writing production implementation, reducing regressions and guesswork.

Core Features & Use Cases

  • Test-first workflow: Force the “red” step by writing a minimal failing test that demonstrates the missing behavior.
  • Mandatory verification loop: Confirm the test fails for the expected reason, then implement the smallest “green” change and re-check that it passes.
  • Disciplined refactoring: Refactor only after green while keeping behavior covered by tests, for features, bugfixes, and safe iteration.

Use case: Fix a bug where an empty email is incorrectly accepted by writing a failing test for the expected validation behavior, then implementing the minimal validation logic and ensuring the full test suite stays green.

Quick Start

Use the test-driven-development skill when you need to implement a new feature or bugfix by starting with a minimal failing test, confirming failure, writing the smallest production code to pass, and then re-running tests to verify everything stays green.

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 minimal failing test before implementation to prove behavior, reducing regressions and guesswork by verifying the test fails for the expected reason first.

How do I fix a bug using the red-green-refactor cycle?

To fix a bug using the red-green-refactor cycle, write a failing test demonstrating the incorrect behavior, implement the smallest code change to make it pass, then refactor safely while keeping the test suite green.

When should I write unit tests before implementation instead of after?

You should write unit tests before implementation when adding new behavior, fixing bugs, or refactoring, requiring a minimal failing test first to observe the red-green-refactor cycle and ensure reliable code changes.

Does test-driven development work for software design refactoring tasks?

Yes, test-driven development supports disciplined refactoring of software design by keeping behavior covered by tests, allowing you to refactor only after reaching green without adding new behavior.

Why do I need to verify a test fails before writing implementation code?

You must verify a test fails before writing implementation code to confirm the test fails for the right reason, ensuring the minimal production code you write actually addresses the missing behavior and prevents regressions.

What's the best way to implement new features without introducing bugs?

The best way to implement new features without introducing bugs is writing a minimal failing test first, confirming the failure, writing the smallest production code to pass, and re-running tests to verify everything stays green.