test-driven-development

Enforce test-first development by requiring failing automated tests before implementation.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/Whaleylaw/llm-lawyer --skill test-driven-development-whaleylaw
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/Whaleylaw/llm-lawyer/tree/main/.claude/skills.old/test-driven-development
Command: npx skills add https://github.com/Whaleylaw/llm-lawyer --skill test-driven-development-whaleylaw

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This guide eliminates uncertain or fragile development by enforcing a test-first workflow so features and bug fixes are specified by failing tests before implementation, ensuring tests actually verify behavior.

Core Features & Use Cases

  • Red-Green-Refactor workflow: Write a failing test, implement minimal code to pass, then refactor while keeping tests green.
  • Verification checklist: Watch tests fail for the expected reason, confirm passing results, and ensure no regressions across the suite.
  • Use Cases: Ideal for new features, bug fixes, refactors, and behavior changes where high confidence and repeatable validation are required.

Quick Start

Write a failing automated test that demonstrates the desired behavior, run it to confirm it fails for the expected reason, implement the minimal code to make it pass, and keep the test 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 the red-green-refactor cycle work?

Test-driven development (TDD) is a test-first workflow where you write a failing automated test, implement minimal code to pass it, then refactor while keeping tests green. This cycle is called red-green-refactor and ensures tests actually verify behavior.

How do I write a failing unit test before implementing a new feature?

To write a failing unit test for TDD, create an automated test that demonstrates the desired behavior, run it to confirm it fails for the expected reason, then implement the minimal production code required to make that specific test pass.

Can I use test-first development for bug fixes and refactoring existing code?

Yes, test-first development applies to bug fixes, refactors, and behavior changes. You write a failing automated test that reproduces the bug or specifies the new behavior, then implement minimal code to pass it and verify no regressions across the suite.

What's the best way to verify that my failing test fails for the expected reason?

The best way to verify a failing test in TDD is to run it immediately after writing it and check the failure output. Confirm the test fails specifically due to the missing implementation, not due to syntax errors or unrelated setup issues.

Why should I require failing automated tests before writing any production code?

Requiring failing automated tests before production code eliminates fragile development by ensuring the test actually validates the desired behavior. This test-first approach prevents false positives and confirms the test fails without the implementation.

How do I maintain test hygiene and prevent regressions during refactoring?

Maintain test hygiene and prevent regressions by keeping tests green throughout refactoring, running the entire test suite to verify passes explicitly, and ensuring no production code is written without a prior failing test specifying the behavior.