tdd

Drive feature implementation through red-green-refactor TDD cycles.

Updated May 25, 2026
One-click install
npx skills add https://github.com/cmetech/otto-cli --skill tdd-cmetech
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/cmetech/otto-cli/tree/main/src/resources/skills/tdd
Command: npx skills add https://github.com/cmetech/otto-cli --skill tdd-cmetech

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Test-driven development (TDD) enforces observable behavior through tests, guiding design and preventing regression by delivering working code early.

Core Features & Use Cases

  • Vertical-slice driven: implement one feature slice at a time with a red-green-refactor loop, producing measurable test outcomes.
  • Public-interface-first: pins behavior via tests against the contract, not internal details.
  • Continuous improvement: supports refactoring after green, and iterates on edge cases with guardrails.

Quick Start

Start by writing a failing test for the next observable contract, then implement the minimal code to satisfy it.

Frequently Asked Questions about tdd

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

FAQPage Schema
How do I implement test-driven development using red-green-refactor cycles?

Test-driven development using red-green-refactor cycles starts by writing a failing public-interface test, implementing minimal code to pass, and refactoring only when green. This enforces observable behavior and prevents scope creep during feature work.

Why write failing tests against the public interface first in TDD?

Writing failing tests against the public interface first in TDD pins behavior via the contract rather than internal details. This approach guides design decisions and delivers working code early by focusing on observable outcomes.

Can I use TDD for vertical slice feature implementation?

Yes, TDD works for vertical slice feature implementation by driving one feature slice at a time through red-green-refactor loops. Each slice produces measurable test outcomes and supports iterative edge case handling with guardrails.

When should I refactor code during test-driven development?

You should refactor code during test-driven development only when tests are green. This continuous improvement phase allows safe code restructuring after minimal implementation passes, preventing regression while maintaining observable behavior.

What's the best way to prevent scope creep during TDD cycles?

The best way to prevent scope creep during TDD cycles is applying guardrails that enforce writing one failing test at a time, implementing minimal code to pass, and iterating on edge cases only after green. This keeps feature work focused.

Does test-driven development work for bug fixes with clear external contracts?

Yes, test-driven development works for bug fixes with clear external contracts and observable behavior. Applied at the task level, it guides fixes by first writing a failing test that reproduces the bug before minimal implementation.