test-driven-development

Guide test-first implementation using a Red-Green-Refactor cycle with failing and passing test verification.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/junevm/avtoolz --skill test-driven-development-junevm
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/junevm/avtoolz/tree/main/.agents/skills/test-driven-development
Command: npx skills add https://github.com/junevm/avtoolz --skill test-driven-development-junevm

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

It prevents unreliable implementation by forcing you to define the expected behavior first and prove it by seeing the test fail before writing production code.

Core Features & Use Cases

  • Failing-test-first discipline: Ensures every feature, bug fix, refactor, or behavior change starts with a test that demonstrates what’s missing.
  • Minimal, behavior-focused tests: Keeps tests precise, named for outcomes, and aligned with real code rather than mocks.
  • Red-Green-Refactor loop: Drives a tight workflow—watch fail, implement the smallest fix, verify pass, then clean up without changing behavior.
  • Anti-rationalization guardrails: Stops common failure modes like “tests after,” “test passes immediately,” and “mocking what you assert.”

Quick Start

Use the test-driven-development skill to write a failing test that captures the behavior of your intended change, then implement the smallest production code needed to make that test pass before refactoring.

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 reduce software regressions?

Test-driven development reduces regressions by forcing you to write a failing test that defines expected behavior before implementing production code. This proves the test is valid and ensures your new code works as intended.

What is the Red-Green-Refactor cycle in TDD?

The Red-Green-Refactor cycle is a TDD workflow where you write a failing test, implement the minimal production code to make it pass, and then clean up the code without changing its behavior.

How do I write minimal behavior-focused unit tests?

To write minimal behavior-focused unit tests, name tests for specific outcomes and align assertions with real production code rather than mocks. This keeps tests precise and prevents testing mock behavior instead of actual software behavior.

Why do my TDD tests pass immediately before writing code?

Tests passing immediately indicates an anti-pattern where the test fails to capture missing behavior. You must ensure the test fails first to prove it targets the intended new code before making it pass.

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

Yes, you can use test-driven development for refactoring by starting with a test that demonstrates current behavior. This ensures your refactoring maintains behavioral correctness without introducing unexpected regressions.

What are common TDD anti-patterns to avoid?

Common TDD anti-patterns to avoid include writing tests after implementation, tests that pass immediately, and mocking the exact behavior you are asserting. These undermine test reliability and behavioral correctness.