tdd

Enforce Red-Green-Refactor cycles with failing tests, minimal code, and coverage checks.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill enforces a test-first development workflow to prevent regressions, reduce scope creep, and ensure each feature is developed in small, verifiable increments.

Core Features & Use Cases

  • Red-Green-Refactor Workflow: Step-by-step guidance for writing a failing test, implementing the minimal code to pass, and then refactoring safely.
  • Test Design and Completion Checklist: Prompts for confirming inputs, outputs, edge cases, and enumerating test cases to cover happy paths and error conditions.
  • Coverage and Reporting: Encourages running the test runner and coverage checks and provides a concise report format for completed TDD cycles.
  • Use Case: Implement a new Python function or API endpoint by writing the first pytest that fails, making a minimal change to pass it, and then refactoring and validating coverage.

Quick Start

Implement the feature 'calculate_total' using a Red→Green→Refactor cycle by writing the first failing pytest test, adding minimal code to pass it, and then refactoring while keeping all tests passing.

Frequently Asked Questions about tdd

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

FAQPage Schema
How do I implement a new feature using test-driven development?

Test-driven development implements features by enforcing a Red-Green-Refactor cycle to drive small, test-first iterations, requiring you to write a failing test, provide minimal code to pass it, and then refactor safely.

What is the Red-Green-Refactor cycle in unit testing?

The Red-Green-Refactor cycle is a test-driven development workflow where you first write a failing test (Red), implement the minimal code to pass it (Green), and then iteratively refactor the code while keeping all tests passing.

How do I write a failing pytest test for a new API endpoint?

To write a failing pytest test for an API endpoint, start by defining the expected inputs, outputs, and edge cases. Run the test to confirm it fails, then add the minimal implementation logic required to make the test pass.

Can I use test-driven development for algorithmic logic and unit-level functions?

Yes, test-driven development applies to software engineering tasks like unit-level functions, API endpoints, and algorithmic logic where incremental tests, minimal implementations, and iterative refactoring are appropriate for verifiable increments.

How do I ensure my test automation covers edge cases and error conditions?

To ensure test automation covers edge cases, use a test design checklist to confirm inputs, outputs, and enumerate test cases. This covers happy paths and error conditions before running coverage checks to validate the results.

When should I not use a test-first development workflow?

You should avoid a test-first development workflow for exploratory prototypes or tasks where verifiable increments and iterative refactoring are inappropriate, as it may restrict rapid scope changes and delay initial feedback.