test-driven-development

Enforces test-first development using the red-green-refactor cycle for features and bugfixes.

Updated Feb 20, 2026
One-click install
npx skills add https://github.com/gtbauke/bj-utils --skill test-driven-development-gtbauke
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/gtbauke/bj-utils/tree/main/.agent/skills/test-driven-development
Command: npx skills add https://github.com/gtbauke/bj-utils --skill test-driven-development-gtbauke

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Code written before tests often passes tests immediately, proving nothing about correctness. This Skill enforces strict test-driven development so every feature and bugfix is backed by a test that was watched failing first, eliminating unverified production code and common testing anti-patterns. ## Core Features & Use Cases - Red-Green-Refactor Enforcement: Guides writing a failing test, verifying it fails for the right reason, implementing minimal code, and refactoring while staying green. - Anti-Pattern Detection: Identifies testing mock behavior, test-only methods in production classes, incomplete mocks, and mocking without understanding dependencies. - Rationalization Countering: Provides concrete rebuttals to common excuses like "I'll test after" or "deleting code is wasteful." - Use Case: When fixing a bug where empty emails are accepted, write a failing test asserting the rejection, watch it fail, implement the minimal validation, and confirm all tests pass before refactoring. ## Quick Start Use test-driven development to implement this feature, writing a failing test first 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 for 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 to make it pass. Refactor only while all tests stay green, then repeat the cycle for the next behavior.

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

Write a test that reproduces the bug by asserting the expected correct behavior, then run it to confirm it fails. Implement the minimal fix, verify the test passes along with all other tests, and the test now prevents regression.

Why should tests be written before implementation 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 detects the missing behavior and is not biased by the existing implementation.

What are common mocking anti-patterns in unit tests?▼

Common anti-patterns include asserting on mock elements instead of real behavior, adding test-only methods to production classes, mocking without understanding side effects, and creating incomplete mocks missing fields the real API returns. Test real behavior and mock minimally at the correct level.

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

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 and rewritten test-first.