test-driven-development

Enforce the Red-Green-Refactor cycle by requiring a failing test before production code.

Updated Nov 3, 2025
One-click install
npx skills add https://github.com/ayourtch/kimichat --skill test-driven-development-ayourtch
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/ayourtch/kimichat/tree/main/skills/test-driven-development
Command: npx skills add https://github.com/ayourtch/kimichat --skill test-driven-development-ayourtch

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill prevents writing untested code, ensures tests actually verify behavior, and reduces bugs by forcing a "test-first" mindset. It eliminates the risk of tests passing for the wrong reasons.

Core Features & Use Cases

  • Red-Green-Refactor Cycle: Guides through the core TDD loop: write a failing test, write minimal code to pass, then refactor.
  • Iron Law Enforcement: Strictly prohibits writing production code without a failing test first, even if it means deleting existing code.
  • Bug Prevention: Catches design flaws and edge cases early in the development process, improving code quality and reducing debugging time.
  • Use Case: When implementing a new user login feature, use this skill to write a test for an invalid password before writing any login logic, ensuring the validation works as expected.

Quick Start

I'm using the test-driven-development skill to implement the new user registration feature.

Frequently Asked Questions about test-driven-development

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

FAQPage Schema
How do I implement test-driven development in my workflow?

Test-driven development enforces writing a failing test before any production code. Start by writing a test that fails, observe the failure, write minimal code to pass it, then refactor. This Red-Green-Refactor cycle ensures tests verify actual behavior and prevents untested code from reaching production.

What's the difference between writing tests first versus after coding?

Writing tests first catches design flaws and edge cases before implementation, ensuring tests verify behavior rather than passing for wrong reasons. Tests written after code often validate existing logic rather than requirements, missing bugs that test-first would surface immediately.

Can I use test-driven development for bug fixes and refactoring?

Yes. Test-driven development applies to new features, bug fixes, refactors, and behavior changes. Write a failing test that reproduces the bug or specifies the refactor's outcome first, then implement the minimal fix or change to pass it, preventing regressions and overengineering.

How does test-driven development reduce debugging time?

By enforcing failing tests before code, test-driven development catches bugs early in development rather than in production or late testing phases. This eliminates premature optimization, overengineering, and design flaws that would require extensive debugging later.

What happens if I write production code without a failing test first?

Test-driven development strictly prohibits production code without a failing test first. The workflow enforces the no-production-code-without-a-failing-test rule, ensuring code quality and preventing untested features from entering the codebase.