test-driven-development

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

1|Updated Dec 11, 2025
One-click install
npx skills add https://github.com/HarmAalbers/claude-requirements-framework --skill test-driven-development-harmaalbers
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/HarmAalbers/claude-requirements-framework/tree/main/plugins/requirements-framework/skills/test-driven-development
Command: npx skills add https://github.com/HarmAalbers/claude-requirements-framework --skill test-driven-development-harmaalbers

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Code written before tests often ships unverified, and tests written after implementation pass immediately without proving they test the right behavior. This Skill enforces a strict test-first discipline so every feature and bugfix is backed by a test that was watched failing before any production code exists. ## Core Features & Use Cases - Red-Green-Refactor Cycle: Guides writing one failing test, verifying it fails for the right reason, writing minimal code to pass, then refactoring while staying green. - Rationalization Countermeasures: Provides a table of common excuses ("too simple to test", "I'll test after") with rebuttals, plus red flags that signal you must delete code and start over. - Testing Anti-Patterns Reference: Ships a references file covering mock-behavior testing, test-only production methods, and mocking without understanding dependencies. - 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 full suite passes. ## Quick Start Ask the AI to implement a new feature or bugfix using strict test-driven development, writing the failing test before any production code.

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 in Python?▼

Write one minimal failing test with pytest, run it to confirm it fails for the expected reason, then write the simplest code that makes it pass. Refactor only while all tests stay green, and repeat the cycle for each new behavior.

Why should tests be written before implementation code?▼

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 rather than a typo or existing behavior.

When is it acceptable to skip TDD?▼

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

What are common mocking anti-patterns in pytest?▼

Common anti-patterns include asserting on mock call counts instead of real behavior, adding test-only methods to production classes, and mocking methods whose side effects the test depends on. Mock minimally at the lowest level and prefer real components or fixtures.

What should I do if I already wrote code before tests?▼

Delete the implementation and start over with a failing test. Keeping it as reference or adapting it while writing tests amounts to testing after the fact, which the skill treats as a violation of the core rule.