tdd

Enforce vertical slicing and behavior-driven testing in test-driven development workflows.

3|Updated Jul 30, 2023
One-click install
npx skills add https://github.com/danielcopper/dotfiles --skill tdd-danielcopper
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/danielcopper/dotfiles/tree/main/claude/.claude/skills/tdd
Command: npx skills add https://github.com/danielcopper/dotfiles --skill tdd-danielcopper

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill addresses the common pitfalls of test-driven development, such as writing tautological tests, horizontal slicing, and coupling tests to implementation details rather than observable behavior.

Core Features & Use Cases

  • Vertical Slicing: Guides you through the tracer bullet approach, ensuring each test corresponds to a single, verifiable behavior.
  • Interface Design: Provides patterns for creating testable, deep modules with small surface areas.
  • Mocking Guidelines: Defines clear boundaries for when to mock (system boundaries) and when to avoid it (internal collaborators).
  • Use Case: When building a new feature, use this skill to plan your public interface, write a failing test for a single behavior, and implement the minimal code required to pass, ensuring your test suite remains a reliable specification.

Quick Start

Use the tdd skill to help me plan and implement the next feature using the red-green-refactor loop.

Frequently Asked Questions about tdd

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

FAQPage Schema
How do I avoid writing tautological tests when practicing test-driven development?

Avoid tautological tests in test-driven development by enforcing vertical slicing and behavior-driven patterns, ensuring each test validates a single verifiable behavior through a tracer bullet approach rather than mirroring internal implementation logic.

What is the best way to structure unit tests for observable behavior instead of implementation details?

Structure unit tests for observable behavior by adhering to public interface design and dependency injection principles, which decouples tests from internal implementation and focuses validation on verifiable system outputs.

When should I use mocking in integration testing versus unit testing?

Use mocking in integration testing strictly at system boundaries, and avoid mocking internal collaborators in unit testing to prevent coupling tests to internal implementation details and maintain reliable specifications.

How do I plan a public interface using the red-green-refactor loop?

Plan a public interface using the red-green-refactor loop by defining a deep module with a small surface area, writing a failing test for a single behavior, and implementing the minimal code required to pass.

Does test-driven development work for refactoring existing code with poor test coverage?

Test-driven development supports refactoring existing code by applying behavior-driven testing patterns to establish verifiable specifications before making changes, ensuring maintainability and robust code quality.

Why does horizontal slicing cause problems in test-driven development?

Horizontal slicing causes problems in test-driven development because it prevents each test from corresponding to a single verifiable behavior, leading to tautological tests and tight coupling to implementation details.