test-driven-development

Enforces red-green-refactor test-first workflow for features, bugfixes, and refactoring.

Updated Aug 28, 2026
One-click install
npx skills add https://github.com/epicodic/drift --skill test-driven-development-epicodic
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/epicodic/drift/tree/main/.agents/skills/test-driven-development
Command: npx skills add https://github.com/epicodic/drift --skill test-driven-development-epicodic

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Code written before tests often ships with unverified behavior, hidden edge cases, and regressions discovered only in production. This Skill enforces a strict test-first discipline so every change is proven by a failing test before implementation begins. ## Core Features & Use Cases - Red-Green-Refactor Enforcement: Guides the full cycle of writing a failing test, verifying it fails for the right reason, writing minimal code to pass, and refactoring while staying green. - Rationalization Detection: Lists common excuses for skipping TDD ("too simple to test", "I'll test after") with concrete rebuttals and red flags that trigger a restart. - Testing Anti-Pattern Reference: Covers mock-behavior testing, test-only production methods, incomplete mocks, and over-mocking, with gate functions to catch each. - Use Case: When fixing a bug where negative session IDs are accepted, write a failing pytest case first, watch it fail, implement the validation, and confirm the suite stays green. ## Quick Start Use the test-driven-development skill to implement this feature by writing a failing test first, then the minimal code to make it pass.

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 to confirm it fails for the right reason, then write the simplest code that passes. Refactor only while all tests stay green, then repeat for the next behavior.

How do I write a failing test for a bug fix?▼

Write a test that reproduces the bug, such as asserting that a negative session ID raises ValueError, and watch it fail against current code. Then implement the fix and confirm the test passes along with the rest of the suite.

Should I write tests before or after implementation code?▼

Tests must come first. Tests written after code pass immediately, which proves nothing about whether they test the right behavior. If code already exists without a failing test, delete it and reimplement from tests.

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

Only for throwaway prototypes, generated code, or configuration files, and only with explicit approval from your human partner. Exploration is allowed, but the exploratory code must be discarded before starting the TDD cycle.

Why does my test pass immediately without any implementation?▼

An immediately passing test means it is testing existing behavior or testing a mock rather than real code. Rewrite the test to target the missing behavior, and confirm it fails for the expected reason before implementing.

What testing anti-patterns should I avoid with mocks?▼

Never assert on mock elements, never add test-only methods to production classes, and never mock without understanding side effects the test depends on. Mirror the complete real API structure in mock data to avoid silent failures.