tdd

Guide Test-Driven Development with vertical slices and RED-GREEN-REFACTOR cycles.

2|Updated Aug 8, 2024
One-click install
npx skills add https://github.com/walid-mos/mac-config --skill tdd-walid-mos
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/walid-mos/mac-config/tree/main/claude/.claude/skills/tdd
Command: npx skills add https://github.com/walid-mos/mac-config --skill tdd-walid-mos

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the challenge of building software reliably by guiding users through a structured Test-Driven Development (TDD) workflow, ensuring features are built to specification and are well-tested from the outset.

Core Features & Use Cases

  • Vertical Slicing: Emphasizes building small, testable units of functionality incrementally.
  • Tracer Bullets: Uses tests as the primary driver for implementation, ensuring code directly addresses a verified need.
  • Refactoring Guidance: Provides a clear process for improving code quality after functionality is verified.
  • Use Case: When developing a new user authentication feature, use this skill to write a test for the login success scenario, then implement the minimal code to pass, and repeat for other scenarios like invalid credentials or password resets.

Quick Start

Follow the TDD workflow to implement the next required behavior for the current feature.

Frequently Asked Questions about tdd

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

FAQPage Schema
How do I start using Test-Driven Development for a new software feature?

Start Test-Driven Development by writing a test that verifies a specific behavior through the public interface, then implement the minimal code to pass it. This Skill guides you through incremental RED-GREEN-REFACTOR cycles to build features reliably using vertical slices.

What is vertical slicing in TDD and how does it improve code quality?

Vertical slicing in TDD is building small, testable units of functionality incrementally. It improves code quality by ensuring each slice addresses a verified need through tracer bullets, keeping implementation focused on behavior rather than unnecessary details.

When should I refactor code during the TDD workflow?

You should refactor code during the REFACTOR phase of the TDD cycle, which occurs only after the test passes and functionality is verified. This Skill provides guidance on improving code structure while maintaining robust, testable behavior.

Does Test-Driven Development require testing private implementation details?

Test-Driven Development should focus on verifying behavior through public interfaces, not implementation details. This approach ensures your tests remain robust and maintainable, allowing you to refactor internal code without constantly breaking the test suite.

What's the best way to build a user authentication feature using TDD?

The best way is to write a test for the login success scenario, implement the minimal code to pass, and repeat for other cases like invalid credentials. This Skill uses tracer bullets to drive implementation and ensure each scenario meets specification.

Can I use TDD with agile development methodologies?

Yes, TDD integrates naturally with agile development by supporting incremental development cycles. This Skill emphasizes building software one step at a time, prioritizing testability and clear interface design to deliver features with confidence.