test-driven-development

Enforce test-first development with failing tests before production code.

Updated May 15, 2026
One-click install
npx skills add https://github.com/cabezno/bmb-encover-agent --skill test-driven-development-cabezno
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/cabezno/bmb-encover-agent/tree/main/skills/software-development/test-driven-development
Command: npx skills add https://github.com/cabezno/bmb-encover-agent --skill test-driven-development-cabezno

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Test-driven development (TDD) prevents regressions and hidden bugs by forcing you to define expected behavior up front with a failing test before writing production code.

Core Features & Use Cases

  • Red-Green-Refactor discipline: Write a minimal failing test (RED), implement the smallest change to pass (GREEN), then clean up without changing behavior (REFACTOR).
  • Verification that tests fail and pass: Confirm the test fails for the right reason, then ensure it passes and that the full suite stays green.
  • Behavior-first tests: Focus tests on real outcomes and edge cases rather than implementation details or mock interactions.

Use cases: adding a new feature, fixing a bug, refactoring safely, or changing behavior while keeping confidence high with automated checks.

Quick Start

Ask the agent to help you implement your next feature strictly following RED-GREEN-REFACTOR using pytest, ensuring each new behavior starts with a failing test and ends with the full test suite passing.

Frequently Asked Questions about test-driven-development

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How does test-driven development prevent regressions when adding new features?

Test-driven development prevents regressions by requiring a failing test that defines expected behavior before writing any production code. You implement the smallest change to pass the test, ensuring repeatable verification and regression safety across the codebase.

What is the red-green-refactor cycle and how do I apply it?

The red-green-refactor cycle is a test-driven development discipline where you write a minimal failing test (RED), implement the smallest code change to pass it (GREEN), then clean up without changing behavior (REFACTOR). You repeat this for each new feature.

Can I use pytest for test-driven development on an existing codebase?

Yes, you can use pytest for test-driven development on an existing codebase. It supports applying the red-green-refactor discipline to new features, bug fixes, and refactors, providing repeatable verification and regression safety for your current code.

When should I write behavior-first tests instead of mocking implementation details?

You should write behavior-first tests when you need to focus on real outcomes and edge cases rather than implementation details or mock interactions. This approach ensures tests remain valid during refactoring and verify actual functional requirements.

How do I ensure my failing test fails for the right reason before writing code?

To ensure a failing test fails for the right reason, run it immediately after writing it to confirm the failure is due to missing production behavior, not a syntax or setup error. This verification is a core step before implementing the minimal code to pass.