tdd

Guide teams through RED-GREEN-REFACTOR cycles for test-driven development.

729|67|Updated Dec 8, 2025
One-click install
npx skills add https://github.com/joelhooks/swarm-tools --skill tdd-joelhooks
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/joelhooks/swarm-tools/tree/main/.opencode/skill/tdd
Command: npx skills add https://github.com/joelhooks/swarm-tools --skill tdd-joelhooks

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps teams adopt a disciplined Test-Driven Development workflow, ensuring tests drive design and reduce regressions.

Core Features & Use Cases

  • RED-GREEN-REFACTOR cycle: Write a failing test first, implement the minimal code to pass, then refactor to improve design.
  • Pattern guidance: Encourages unit tests, integration-aware design, and measurable progress.
  • Education & onboarding: Provides examples of TDD narratives and best practices.

Quick Start

Install the required tooling, start a new TDD cycle by writing a failing test, implement the minimal code to pass, and run the tests. Iterate as needed to drive design and ensure changes are safe.

Frequently Asked Questions about tdd

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

FAQPage Schema
What is the red-green-refactor cycle in test-driven development?

The red-green-refactor cycle in test-driven development involves writing a failing test first, implementing the minimal code to pass it, then refactoring to improve software design. This iterative workflow ensures tests drive design and reduce regressions.

How do I start writing unit tests first to drive my software design?

To start writing unit tests first, begin a new TDD cycle by writing a failing test, implement the minimal code required to pass it, and run the tests. Iterate through this structured workflow to drive design and ensure changes are safe.

Does test-driven development work for both unit and integration testing?

Yes, test-driven development applies across both unit and integration development. It emphasizes a tests-first design approach and incremental refactoring to improve code quality and enforce structured workflows with clear guidance on structuring tests.

When should I refactor code during the TDD workflow?

You should refactor code during the TDD workflow only after your failing test passes with minimal implementation code. This incremental refactoring phase improves software design while ensuring measurable progress and safe changes without breaking functionality.

Why use a tests-first approach instead of writing tests after implementation?

Using a tests-first approach ensures tests actively drive your software design and reduce regressions rather than just verifying existing code. It enforces a disciplined workflow that improves code quality through incremental design changes and measurable progress.