tdd

Guides test-driven development using the red-green-refactor loop with seam-based testing.

28|1|Updated Mar 15, 2026
One-click install
npx skills add https://github.com/NauelG/astro-blocks --skill tdd-nauelg
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/NauelG/astro-blocks/tree/main/.agents/skills/tdd
Command: npx skills add https://github.com/NauelG/astro-blocks --skill tdd-nauelg

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing tests after implementation often produces brittle, implementation-coupled tests that break during refactors and fail to verify real behavior. This Skill enforces a disciplined test-first workflow so tests act as durable specifications of behavior. ## Core Features & Use Cases - Red-Green Loop Discipline: Enforces writing a failing test before any implementation, one vertical slice at a time. - Seam Identification: Helps define and confirm public interface boundaries where tests should live before any test is written. - Anti-Pattern Detection: Flags implementation-coupled, tautological, and horizontally sliced tests with concrete good/bad examples. - Mocking Guidance: Provides rules for mocking only at system boundaries using dependency injection and SDK-style interfaces. - Use Case: When adding a checkout feature, use this Skill to agree on the public seams first, then drive the implementation one failing test at a time through the public API. ## Quick Start Use the tdd skill to build the new checkout feature test-first, starting by agreeing on the seams we should test.

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 on a new feature?▼

Start by agreeing on the public seams to test, then write one failing test against that seam, implement only enough code to pass it, and repeat. Work in vertical slices rather than writing all tests upfront.

What is the red-green-refactor loop in TDD?▼

Red-green-refactor means writing a failing test first (red), then writing the minimal code to make it pass (green). Refactoring is handled separately in a review stage, not inside the implementation loop.

When should I mock dependencies in unit tests?▼

Mock only at system boundaries such as external APIs, time, randomness, and sometimes databases or the file system. Never mock your own classes or internal collaborators, and prefer dependency injection with SDK-style interfaces.

Why do my tests break every time I refactor code?▼

Tests break on refactor when they are coupled to implementation details, such as mocking internal collaborators, testing private methods, or asserting on call counts. Tests should verify behavior through public interfaces only.

What is a tautological test and how do I avoid it?▼

A tautological test recomputes the expected value the same way the implementation does, so it passes by construction. Avoid it by deriving expected values from independent sources like known literals, worked examples, or the specification.