test-driven-development

Enforces red-green-refactor TDD workflow with failing tests before production code.

1|Updated Jun 24, 2026
One-click install
npx skills add https://github.com/maopujie10-sys/Bailongma --skill test-driven-development-maopujie10-sys
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/maopujie10-sys/Bailongma/tree/main/skills/hermes-skills/software-development/test-driven-development
Command: npx skills add https://github.com/maopujie10-sys/Bailongma --skill test-driven-development-maopujie10-sys

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Developers often write code first and add tests afterward, which produces tests that pass immediately and prove nothing about correctness. This Skill enforces a strict test-first discipline so every piece of production code is backed by a test that was watched failing before implementation. ## Core Features & Use Cases - Red-Green-Refactor Enforcement: Guides the AI through writing one failing test, verifying the failure, writing minimal code to pass, and refactoring only while tests stay green. - Rationalization Detection: Lists common excuses ("too simple to test", "I'll test after") and red flags that trigger deleting code and restarting with TDD. - Subagent Integration: Shows how to dispatch implementation tasks via delegate_task with TDD requirements embedded, and how to run tests through the terminal tool. - Use Case: When fixing a bug, the Skill requires writing a failing test that reproduces the bug first, then implementing the fix, guaranteeing the test proves the fix and prevents regression. ## Quick Start Ask the agent to implement a new feature or bug fix using strict test-driven development with the red-green-refactor cycle.

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 with pytest?

Write one minimal failing test for a single behavior, run it with pytest to confirm it fails for the expected reason, then write the simplest code to make it pass. After green, refactor while keeping all tests passing, and repeat one cycle at a time.

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 code to make that test pass, even with hardcoded values. Refactor means cleaning up duplication and names while keeping every test green.

Should I write tests before or after writing code?

Write tests before code. Tests written after implementation pass immediately, which proves nothing—they may test the wrong thing or mirror the implementation rather than the required behavior. Watching a test fail first proves it actually tests something.

When is it acceptable to skip TDD?

Only for throwaway prototypes, generated code, or configuration files, and only after asking the user first. Exploration is allowed, but the exploratory code must be discarded and the real implementation restarted with a failing test.

Why does my test pass immediately on the first run?

An immediately passing test means you are testing existing behavior, not new functionality. Fix the test so it targets the missing feature, run it again, and confirm it fails for the expected reason before writing any implementation code.

What are common TDD anti-patterns to avoid?

Avoid testing mock behavior instead of real code, testing implementation details rather than behavior, covering only the happy path, and writing all tests upfront in a horizontal slice. Use vertical tracer bullets: one test and its implementation per cycle.