tdd

Guides test-driven development using the red-green-refactor loop with behavior-focused tests.

6|2|Updated May 6, 2026
One-click install
npx skills add https://github.com/sek788432/Stock-Back-Test-System --skill tdd-sek788432
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/sek788432/Stock-Back-Test-System/tree/main/.agents/skills/tdd
Command: npx skills add https://github.com/sek788432/Stock-Back-Test-System --skill tdd-sek788432

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing tests after implementation often produces brittle tests coupled to internal structure that break during refactors and fail to verify real behavior. This Skill enforces a disciplined red-green-refactor loop so every test verifies observable behavior through public interfaces. ## Core Features & Use Cases - Red-Green-Refactor Discipline: Enforces writing a failing test first, then the minimal implementation, then refactoring only while green. - Test Quality Standards: Defines what a good test is, where tests belong (seams at public interfaces), and anti-patterns to avoid such as tautological assertions and implementation-coupled mocks. - Mocking Guidance: Explains when to mock real system boundaries (external APIs, databases, time, file system) versus testing project logic directly, with dependency injection patterns in C++. - Use Case: When adding a new feature to a C++ module, use this Skill to drive the work one vertical slice at a time — one failing test, one minimal implementation, one refactor — producing tests that survive refactors. ## Quick Start Use the tdd skill to implement this feature test-first, starting with a failing test through the public interface.

Frequently Asked Questions about tdd

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I practice test-driven development with red-green-refactor?▼

Write one failing test that describes the desired behavior through a public interface, then write only enough code to make it pass, then refactor while tests stay green. Repeat this loop one vertical slice at a time rather than writing all tests upfront.

What makes a good unit test versus a bad test?▼

A good test verifies behavior through public interfaces, reads like a specification, and survives refactors. Bad tests mock internal collaborators, test private methods, assert on call counts, or recompute expected values the same way the implementation does.

When should I use mocks in unit tests?▼

Mock only at real system boundaries such as external provider APIs, databases, time, randomness, and sometimes the file system. Do not mock concrete project classes or pure logic that can run directly in the test.

What is a tautological test and why avoid it?▼

A tautological test computes its expected value the same way the implementation does, so it passes by construction and can never catch a bug. Expected values must come from independent literals, worked examples, or specifications.

Should I write all tests before implementing the feature?▼

No. Writing all tests first is horizontal slicing, which verifies imagined behavior and commits to test structure prematurely. Work in vertical slices instead: one test, one minimal implementation, then repeat.