tdd

Guides test-driven development through red-green cycles with seam-based test design.

Updated Jul 29, 2026
One-click install
npx skills add https://github.com/MaiconGambini/opencode-harness-guide --skill tdd-maicongambini
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/MaiconGambini/opencode-harness-guide/tree/main/skills/tdd
Command: npx skills add https://github.com/MaiconGambini/opencode-harness-guide --skill tdd-maicongambini

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing tests after code often produces brittle, implementation-coupled tests that break on refactors and miss real behavior. This Skill enforces a disciplined red-green loop so tests verify behavior through public interfaces and survive refactoring. ## Core Features & Use Cases - Red-Green Loop Rules: Write the failing test first, then only enough code to pass it, one vertical slice at a time. - Seam-Based Test Design: Agree on public interface seams with the user before writing any test, keeping tests at boundaries rather than internals. - Anti-Pattern Detection: Identifies implementation-coupled, tautological, and horizontally sliced tests, plus mocking guidelines for system boundaries only. - Use Case: When fixing a bug, reproduce the defect as a failing regression test first, then apply the minimal fix so the regression test lands in the project's declared suite. ## Quick Start Ask the agent to build a new feature test-first using the tdd skill, starting by agreeing on the public seams to 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 with the red-green loop?

Write one failing test at a public interface seam first, then write only enough code to make it pass, and repeat one vertical slice at a time. Refactoring belongs to a separate review stage, not the red-green cycle.

What is a seam in test-driven development?

A seam is the public boundary where you observe behavior without reaching inside the code. Tests live at seams agreed with the user up front, never against private methods or internal collaborators.

When should I use mocks in unit tests?

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

Why do my tests break every time I refactor code?

Tests break on refactoring when they are coupled to implementation details, such as mocking internal collaborators or asserting on call counts. Tests should verify observable behavior through public interfaces so internal structure can change freely.

How do I write a regression test for a bug fix?

Reproduce the defect as a failing test that fails for the exact reason the bug exists, then apply the fix. The red test becomes the regression test and lands in the project's declared regression suite.

Why is code coverage not enough to trust my tests?

Coverage shows lines executed but not whether assertions are meaningful; a test can exercise code without asserting anything. The mutation kill ratio detects surviving mutants where code could change without any test noticing.