tdd

Guide developers through a red-green-refactor TDD loop for features and bug fixes.

Updated Feb 24, 2021
One-click install
npx skills add https://github.com/roderik/roderik.github.io --skill tdd-roderik
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/roderik/roderik.github.io/tree/main/.agents/skills/tdd
Command: npx skills add https://github.com/roderik/roderik.github.io --skill tdd-roderik

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Traditional software development often suffers from brittle code and regressions when changing features. This skill guides teams to adopt a test-first mindset, validating behavior via public interfaces so implementations can change without breaking users.

Core Features & Use Cases

  • Red-Green-Refactor workflow to validate functionality end-to-end.
  • Integration-focused testing strategies that exercise public APIs rather than internal details.
  • Structured workflow guidance (planning, tracer bullets, incremental loops, and safe refactoring) to improve code quality and maintainability.

Quick Start

Start a red-green-refactor cycle by writing a failing test for the desired feature, implement the minimal code to pass, and then refactor for clarity and long-term maintainability.

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 is a workflow where you write a failing test, implement minimal code to pass it, and then refactor for clarity. This enforces a test-first mindset to validate behavior via public interfaces.

How do I implement features using test-driven development?

To implement features using test-driven development, start by writing a failing test for the desired behavior, add the minimal code required to make it pass, and then safely refactor the implementation guided by public interfaces.

Why should I write integration tests instead of testing internal details?

Writing integration tests instead of testing internal details prevents brittle code and regressions. By exercising public APIs rather than internal implementations, your tests validate end-to-end functionality and allow implementations to change without breaking users.

What's the best way to plan a test-first workflow for a new feature?

The best way to plan a test-first workflow is using structured guidance like tracer bullets and incremental loops. This approach breaks down features into vertical slices, ensuring you validate functionality end-to-end through disciplined red-green-refactor cycles.

Can I use test-driven development to fix bugs in an existing codebase?

Yes, you can use test-driven development to fix bugs in an existing codebase. You start by writing a failing integration test that reproduces the bug, implement the minimal fix to make it pass, and then refactor to maintain code quality without introducing regressions.