test-driven-development

Enforce red-green-refactor workflow with failing tests before implementation.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Prevents shipping unverified production code by enforcing a workflow where tests are written before implementation, ensuring behavior is specified, validated, and preserved through refactors.

Core Features & Use Cases

  • Red-Green-Refactor Workflow: Write a minimal failing test, implement the smallest change to pass it, then refactor while keeping tests green.
  • Verification Discipline: Emphasizes watching tests fail for the right reason, avoiding tests that pass immediately or validate mocks instead of real behavior.
  • Use Cases: Ideal for new feature development, bug fixes, behavior changes, and refactoring efforts where confidence and regressions prevention are priorities.

Quick Start

Write a minimal failing test that expresses the desired behavior, run the test to confirm it fails for the expected reason, implement the smallest change to make it pass, and keep the test green during refactor.

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 the red-green-refactor workflow function?

Test-driven development is a workflow where you write a minimal failing test, implement the smallest code change to pass it, then refactor while keeping tests green. This enforces behavior specification and validation before production code exists.

How do I start writing unit tests before implementation for a new feature?

To start writing unit tests before implementation, write a minimal failing test expressing desired behavior, verify it fails for the expected reason, implement the smallest change to pass, and maintain green tests throughout refactoring.

Why do my unit tests pass immediately instead of failing for the expected reason?

Unit tests passing immediately often indicate they validate mocks instead of real behavior. Verification discipline in test-driven development requires watching tests fail for the right reason to ensure they actually test production code behavior.

When should I use test-driven development for bug fixes and refactoring efforts?

Use test-driven development for bug fixes, behavior changes, and refactoring efforts where regression prevention and confidence are priorities. It targets codebases with automated test suites to ensure behavior is preserved through refactors.

Does test-driven development work for existing codebases without an automated test suite?

Test-driven development targets codebases with automated test suites. Without existing test infrastructure, the red-green-refactor workflow lacks the foundation needed to verify failures and maintain green tests during refactoring.

What's the best way to maintain green tests while refactoring production code?

The best way to maintain green tests during refactoring is following the red-green-refactor cycle: write minimal failing tests, implement the smallest change to pass, then refactor incrementally while continuously verifying tests stay green.