tdd

Guide the red-green-refactor workflow for Python projects using pytest.

Updated Jan 28, 2026
One-click install
npx skills add https://github.com/mesca/claude-plugins --skill tdd-mesca
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/mesca/claude-plugins/tree/main/plugins/wf/skills/tdd
Command: npx skills add https://github.com/mesca/claude-plugins --skill tdd-mesca

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Test-driven development can be hard to practice consistently; this skill guides and enforces the red-green-refactor workflow so tests drive implementation.

Core Features & Use Cases

  • Enforces test-first development discipline in Python projects with pytest.
  • Provides templates and patterns for common test cases, including setup fixtures and mocks.
  • Walks teams through contract → models → tests → implementation to reduce defects.

Quick Start

Write a failing test for a new feature, then implement just enough code to pass it.

Frequently Asked Questions about tdd

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

FAQPage Schema
How do I enforce test-driven development in my Python project?

To enforce test-driven development in Python, this skill guides you through the red-green-refactor workflow, ensuring you write failing tests first and implement just enough code to pass them using pytest.

What is the contracts-first workflow for test-driven development?

The contracts-first workflow for test-driven development defines a strict sequence: contract → models → tests → implementation, reducing defects by establishing boundaries and validating models before writing the actual application logic.

Can I use pytest fixtures and mocks when following a test-first workflow?

Yes, you can use pytest fixtures and mocks when following a test-first workflow, as this skill provides specific templates and patterns for common test cases including setup fixtures and mocks to isolate dependencies.

What's the best way to start writing tests before implementation in Python?

The best way to start writing tests before implementation is to write a failing test for a new feature, then run pytest with coverage to verify the failure before writing the minimal code required to pass it.

When should I not use the red-green-refactor workflow?

You should not use the red-green-refactor workflow in isolation if your project lacks model validation steps, as this skill specifically relies on a defined sequence of contract definition and model validation to reduce defects.

Does test-driven development work for bug fixes in Python projects?

Yes, test-driven development works for bug fixes in Python projects by guiding you to write a failing test that reproduces the bug first, then modifying the implementation until the test passes within the red-green-refactor cycle.