TDD

Guide developers through the Red-Green-Refactor cycle with pytest.

Updated Apr 12, 2026
One-click install
npx skills add https://github.com/mguinada/agent-skills --skill tdd-mguinada
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: TDD
Source: https://github.com/mguinada/agent-skills/tree/main/skills/tdd
Command: npx skills add https://github.com/mguinada/agent-skills --skill tdd-mguinada

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a structured approach to using Test-Driven Development to design, implement, and maintain software with confidence by emphasizing tests first and frequent verification.

Core Features & Use Cases

  • Red-Green-Refactor workflow: Guides you through cycle-driven development for new features, bug fixes, and refactoring.
  • Test-First Discipline: Encourages writing failing tests before production code to clearly specify behavior.
  • Quality & Maintenance: Helps identify test improvements, improve coverage, and reduce future defects.
  • Use Case: When starting a feature, debugging a flaky module, or refactoring legacy code, apply TDD to obtain reliable behavior with fast feedback.

Quick Start

Start by writing a tiny failing test for a new function, run pytest to observe the failure, implement the minimal code to satisfy the test, and repeat until all tests pass. Then refactor for clarity and maintainability.

Frequently Asked Questions about TDD

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

FAQPage Schema
What is test-driven development and how does the red-green-refactor cycle work?

Test-driven development is a software engineering approach where you write a failing test, implement minimal code to pass it, then refactor. The red-green-refactor cycle drives design through rapid feedback and frequent verification.

How do I start using TDD for feature development and refactoring legacy code?

Start using TDD by writing a tiny failing test for a new function, run pytest to observe the failure, implement the minimal code to satisfy the test, and repeat until all tests pass. Then refactor for clarity and maintainability.

Do I need pytest to follow a test-first development workflow?

A pytest-compatible environment is required to follow this test-first development workflow. The skill guides developers through cycle-driven development by relying on pytest to observe test failures and verify small, incremental steps.

When should I use TDD for bug fixes and improving software quality?

Use TDD for bug fixes and improving software quality when debugging flaky modules or refactoring legacy code. Test-first discipline clearly specifies behavior and reduces future defects by ensuring tests drive design with rapid feedback.