test-driven-development

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

Updated Jul 3, 2026
One-click install
npx skills add https://github.com/CHENHUI-X/toolbox --skill test-driven-development-chenhui-x
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/CHENHUI-X/toolbox/tree/main/official-skills/software-development/test-driven-development
Command: npx skills add https://github.com/CHENHUI-X/toolbox --skill test-driven-development-chenhui-x

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 strict test-driven development so every piece of production code is backed by a test that was watched failing first. ## Core Features & Use Cases - Red-Green-Refactor Enforcement: Mandates writing one failing test, verifying the failure, writing minimal code to pass, then refactoring with tests green. - Rationalization Detection: Lists common excuses ("too simple to test", "I'll test after") and red flags that signal TDD is being skipped, with instructions to delete code and restart. - Subagent Integration: Provides templates for delegating implementation tasks to subagents with TDD requirements embedded in the goal. - Use Case: When fixing a bug, write a failing test that reproduces it first, verify the failure, implement the minimal fix, and confirm the full test suite passes without regressions. ## Quick Start Ask the agent to implement a new feature using strict test-driven development with the red-green-refactor cycle and pytest.

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. Finally refactor while keeping all tests green, and repeat one cycle at a time.

Why should tests be written before code in TDD?

Tests written after code pass immediately, which proves nothing about whether they test the right behavior. Watching a test fail first confirms it actually exercises the missing feature and catches real bugs.

When is it acceptable to skip test-driven development?

Exceptions are limited to throwaway prototypes, generated code, and configuration files, and only with explicit user permission. Exploration is allowed, but the exploratory code must be discarded before restarting with TDD.

What should I do if my test passes 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, verify it fails for the expected reason, then proceed with implementation.

How does TDD handle bug fixes and regressions?

Write a failing test that reproduces the bug before fixing it, then implement the minimal fix until the test passes. The test proves the fix works and permanently guards against the regression returning.