tdd-protocol

Enforce RED-GREEN-REFACTOR TDD by requiring failing tests before production code.

3|1|Updated Dec 3, 2025
One-click install
npx skills add https://github.com/Probably-Group/Dev-AID --skill tdd-protocol-probably-group
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd-protocol
Source: https://github.com/Probably-Group/Dev-AID/tree/main/.dev-aid/skills/process/tdd-protocol
Command: npx skills add https://github.com/Probably-Group/Dev-AID --skill tdd-protocol-probably-group

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill prevents premature or unproven changes by enforcing a strict Test-Driven Development workflow, ensuring that production code is never written until a failing test demonstrates the required behavior.

Core Features & Use Cases

  • RED-GREEN-REFACTOR enforcement: Forces the sequence of writing a failing test first, adding the minimal implementation to make it pass, and refactoring only after tests are green.
  • Gate logic for implementation requests: Detects whether failing tests exist for new features or bug fixes and enforces behavior with levels such as strict, warning, or off.
  • Bug-fix specific TDD loop: Adapts the cycle to reproduce the bug via a failing test before applying the minimal root-cause fix.
  • Safety around failure reasons: Flags cases where tests fail due to infrastructure issues (e.g., import/syntax problems) rather than missing behavior.
  • Local search for test templates: Uses FAISS to suggest similar existing tests to speed up writing correct failing scenarios.

Use Case: When implementing a feature or fixing a bug, use this Skill to require a failing test that captures the intended behavior, then implement the smallest code change that satisfies the test, keeping the suite green.

Quick Start

Use the tdd-protocol Skill when you are asked to implement a new feature or fix a bug, and instruct the AI to “write a minimal failing test first for the required behavior, confirm it fails for the right reason, then implement only enough production code to make it pass, and finally refactor only after tests are green.”

Frequently Asked Questions about tdd-protocol

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

FAQPage Schema
How do I enforce a strict test-driven development workflow when implementing new features?

To enforce test-driven development for new features, use a strict RED-GREEN-REFACTOR gate that requires a failing test before generating any production code. This prevents premature changes by ensuring the failing test demonstrates the required behavior first, followed by minimal implementation and refactoring.

What is the best way to fix bugs using a red-green-refactor TDD cycle?

The best way to fix bugs with a red-green-refactor cycle is reproducing the bug via a failing test first, then applying the minimal root-cause fix. This variant confirms the fix passes while preventing unrelated regressions, ensuring the behavior-specific test scenario validates the correction.

Why does my TDD test fail for the wrong reason during the red phase?

TDD tests fail for the wrong reason during the red phase when infrastructure issues like import or syntax problems occur rather than missing behavior. The gate logic flags these cases, checking failure types to ensure tests fail specifically due to unmet behavior requirements before implementation proceeds.

Can I adjust the test enforcement level if I don't want strict TDD blocking my code generation?

Yes, you can adjust test enforcement levels to strict, warning, or off if strict TDD blocks code generation. This gate logic flexibility allows scaling enforcement based on context, detecting whether failing tests exist for new features or bug fixes before applying the required behavior levels.

How does FAISS help speed up writing failing test scenarios for pytest?

FAISS speeds up writing failing test scenarios by performing local search for similar existing test templates. This suggests relevant tests to use as a foundation, accelerating the creation of correct failing scenarios that capture the intended behavior before implementing the minimal production code.

When should I not use strict test-driven development enforcement on my codebase?

You should not use strict test-driven development enforcement when rapid prototyping without behavior verification is needed, or when existing infrastructure issues cause test failures unrelated to missing behavior. Switching to warning or off modes avoids blocking code generation in these scenarios.