test-driven-development

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

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

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 Detection: Lists common excuses for skipping TDD (such as "too simple to test" or "I'll test after") and explains why each one fails, with red flags that trigger a restart. - Test Quality Rules: A companion reference defines how to write honest tests that name the break they catch, exercise real code 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 the suite passes. ## Quick Start Ask the AI to implement a new feature or bugfix using strict test-driven development with a failing test written and verified 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 step by step?

Write one minimal failing test for a single behavior, run it and confirm it fails for the expected reason, then write the simplest code that passes. After the test passes, refactor while keeping all tests green, then repeat for the next behavior.

What is the red-green-refactor cycle in TDD?

Red means writing a failing test that defines the desired behavior. Green means writing the minimal implementation to make it pass. Refactor means cleaning up duplication and names while keeping every test passing.

When is it acceptable to skip test-driven development?

Exceptions are limited to throwaway prototypes, generated code, and configuration files, and only with explicit approval. Exploration is allowed, but the exploratory code must be discarded and the real implementation restarted with a failing test.

Should tests assert on mocks or real code?

Tests should assert on real component behavior, never on the mock itself. Mock only slow or external dependencies after learning their side effects, mirror the complete real data structure, and switch to integration tests when mock setup outgrows the test logic.

Why do tests written after the code provide less value?

Tests written after pass immediately, so they never prove they can catch a bug. They are biased by the existing implementation, verifying remembered cases rather than discovered ones, and may test the implementation instead of the intended behavior.