test-driven-development

Enforces red-green-refactor test-driven development workflow before writing production code.

1|Updated Aug 27, 2025
One-click install
npx skills add https://github.com/IgorGanapolsky/Random-Timer --skill test-driven-development-igorganapolsky
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/IgorGanapolsky/Random-Timer/tree/main/.cursor/skills/test-driven-development
Command: npx skills add https://github.com/IgorGanapolsky/Random-Timer --skill test-driven-development-igorganapolsky

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Developers often write production code first and bolt tests on afterward, producing tests that pass immediately and prove nothing. This Skill enforces a strict test-first discipline so every behavior is verified by a test that was watched failing before implementation. ## Core Features & Use Cases - Red-Green-Refactor Enforcement: Guides the full cycle of writing a failing test, verifying the failure, writing minimal code to pass, and refactoring while staying green. - Rationalization Countermeasures: Provides a table of common excuses for skipping TDD and the reasoning to reject each one, plus red flags that trigger starting over. - Test Quality Rules: A companion reference defines how to write honest tests that name the break they catch, assert real behavior instead of mocks, and pass a mutation check. - Use Case: When fixing a bug where an empty email is accepted, write a failing test asserting the rejection error, watch it fail, implement the minimal validation, and confirm all tests pass. ## Quick Start Ask the AI to implement a new feature or bugfix using strict test-driven development with a failing test written first.

Frequently Asked Questions about test-driven-development

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

FAQPage Schema
How do I practice test-driven development on a new feature?▼

Write one minimal failing test describing the desired behavior, run it and watch it fail for the expected reason, then write the simplest code that makes it pass. Refactor only while all tests stay green, then repeat for the next behavior.

How do I write a failing test before the code exists?▼

Write the test against the API you wish existed, starting with the assertion. Run it to confirm it fails because the feature is missing, not because of a typo or error, before writing any implementation.

Should I use mocks in unit tests?▼

Prefer real code and assert on real behavior, never on the mock itself. Mock only slow or external dependencies after learning their side effects, and mirror the complete real data structure in mock responses.

When is it acceptable to skip test-driven development?▼

Only for throwaway prototypes, generated code, or configuration files, and only with explicit approval. Exploration is fine, but the exploratory code must be discarded and the real implementation restarted with a failing test.

Why does my test pass immediately without any implementation?▼

A test that passes immediately is testing existing behavior or testing nothing, which proves it cannot catch the bug. Fix the test so it fails for the expected reason before writing any production code.