test-driven-development

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

2|Updated Oct 20, 2017
One-click install
npx skills add https://github.com/rbudiharso/dotfiles --skill test-driven-development-rbudiharso
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/rbudiharso/dotfiles/tree/main/hermes/.hermes/skills/software-development/test-driven-development
Command: npx skills add https://github.com/rbudiharso/dotfiles --skill test-driven-development-rbudiharso

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: Guides the AI through writing a failing test, verifying the failure, writing minimal passing code, and refactoring safely. - Rationalization Detection: Lists common excuses for skipping TDD ("too simple to test", "I'll test after") and counters each with concrete reasoning. - Subagent Integration: Provides templates for delegating implementation tasks to subagents with TDD requirements embedded in the goal. - Use Case: When fixing a bug, the Skill requires writing a failing test that reproduces the bug first, then implementing the fix, guaranteeing the regression is covered permanently. ## 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. Finally refactor while keeping all tests green, and repeat the cycle for each new 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 code to make that test pass, even with hardcoded values. Refactor means cleaning up duplication and names while keeping all tests passing.

Why should tests be written before production code?▼

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

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

The Skill allows exceptions only for throwaway prototypes, generated code, and configuration files, and only after asking the user explicitly. Exploratory coding is fine, but the exploration must be discarded and rewritten with TDD.

What should I do if a 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.

Should I write all tests first and then all implementation?▼

No, that horizontal slicing produces brittle tests designed before the implementation reveals the real interface. Use vertical tracer bullets instead: complete one red-green cycle per behavior before starting the next test.