tdd

Enforce Red-Green-Refactor with one failing pytest test per phase.

Updated Mar 2, 2022
One-click install
npx skills add https://github.com/ysuurme/azure_hello_world --skill tdd-ysuurme
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/ysuurme/azure_hello_world/tree/main/.agents/skills/tdd
Command: npx skills add https://github.com/ysuurme/azure_hello_world --skill tdd-ysuurme

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

TDD prevents implementation drift and untested changes by forcing you to prove each behavior with a failing test before writing production code.

Core Features & Use Cases

  • Red-Green-Refactor loop: Write one failing pytest test, implement the minimum to pass, then refactor toward deeper modules without changing the public interface.
  • Acceptance-criterion traceability: Ensure every test maps to a Lean PRD testing decision or user story so scope stays aligned with the work being built.
  • Safe mocking boundaries: Mock only system boundaries (external APIs, databases, time, filesystem) and avoid mocking internal collaborators.

Use case: You’re fixing a bug reported in a GitHub Issue—write a single reproducing test first, make the smallest change that passes, then refactor to keep the codebase deep and maintainable.

Quick Start

Use the tdd skill to produce one failing pytest test against the public interface, implement the minimal fix to make it pass, and then refactor the implementation while keeping the interface stable.

Frequently Asked Questions about tdd

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

FAQPage Schema
How do I enforce the red green refactor workflow using pytest?

The red green refactor workflow requires writing exactly one failing pytest test against the public interface, implementing the minimal code to pass it, and then refactoring to hide complexity without changing the interface.

When do I need test-driven development for bug fixing?

Test-driven development for bug fixing is needed when you want to prevent implementation drift by first writing a single reproducing pytest test, ensuring the unverified code change is proven before production code is modified.

What are the mocking boundaries in unit testing for refactoring?

Mocking boundaries in unit testing should be limited strictly to system boundaries like external APIs, databases, time, and filesystem, while avoiding mocking internal collaborators to maintain refactoring integrity.

How do I trace acceptance criteria to pytest tests?

Tracing acceptance criteria to pytest tests involves ensuring every single test maps directly to a Lean PRD testing decision or user story, keeping the scope aligned with the work being built during the red green refactor loop.

Does test-driven development work for refactoring without growing the public interface?

Test-driven development applies to refactoring by allowing you to hide implementation complexity and build deeper modules, strictly requiring that the public interface remains stable and does not grow.