tdd

Guide test-driven development through red-green-refactor cycles with public-interface tests.

2|Updated May 5, 2026
One-click install
npx skills add https://github.com/OrestesK/pi --skill tdd-orestesk
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/OrestesK/pi/tree/main/packages/context-mode/skills/tdd
Command: npx skills add https://github.com/OrestesK/pi --skill tdd-orestesk

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill prevents unverified implementations and brittle tests by guiding development through a disciplined red-green-refactor cycle focused on observable behavior.

Core Features & Use Cases

  • Behavior-First Testing: Define tests around public interfaces and user-visible outcomes rather than implementation details.
  • Incremental Development: Use one-test-at-a-time tracer bullets to drive minimal, focused implementations.
  • Refactoring Guidance: Improve duplication, module depth, interface design, and structure only after tests pass.
  • Use Case: Apply the workflow when building a feature, fixing a bug, adding integration tests, or practicing test-first development with strong resistance to over-mocking.

Quick Start

Ask the tdd skill to help plan and implement a feature using one behavior-focused test at a time through 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 start test-driven development for a new feature?

Test-driven development starts by defining behavior-focused tests around public interfaces. You plan user-visible outcomes first, then drive minimal implementations incrementally through a red-green-refactor cycle, validating one test at a time.

How do I write integration tests that survive internal refactoring?

Integration tests survive refactoring when validated through public interfaces rather than internal implementation details. Define tests around observable behavior and user-visible outcomes, keeping them stable across structural changes while resisting over-mocking.

When should I use mocking in test-driven development?

Mocking in test-driven development should be limited to system boundaries. Apply boundary-only mocking to isolate external dependencies, while keeping tests focused on public-interface behavior to prevent brittle test suites.

What is the red-green-refactor cycle and how does it guide implementation?

The red-green-refactor cycle guides implementation by first writing a failing test for a specific behavior, creating a minimal implementation to pass it, and then improving code structure and eliminating duplication only after the test passes.

Does test-driven development work for fixing bugs in existing code?

Test-driven development applies to bug fixes by writing a test that reproduces the bug as a failing behavior validation. You then implement the minimal fix to make it pass, ensuring the specific defect is covered by a stable public-interface test.

Why do my tests break when I refactor code structure?

Tests break during refactoring when they validate internal implementation details rather than observable behavior. Writing public-interface tests focused on user-visible outcomes ensures stability across internal structural changes and module depth adjustments.