tdd-failing-tests-loop

Automate a red-green-refactor TDD loop for subsystem overhauls.

1|Updated Jan 26, 2026
One-click install
npx skills add https://github.com/AskTinNguyen/vesper-team-skills --skill tdd-failing-tests-loop
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd-failing-tests-loop
Source: https://github.com/AskTinNguyen/vesper-team-skills/tree/main/tdd-failing-tests-loop
Command: npx skills add https://github.com/AskTinNguyen/vesper-team-skills --skill tdd-failing-tests-loop

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This guide provides a repeatable red-green-refactor loop to safely overhaul, refactor, or harden a code path using strict failing-tests-first TDD; it ensures contracts, tests, and implementation stay aligned while mitigating risk.

Core Features & Use Cases

  • Map the existing contract before touching code to capture durable behavior boundaries.
  • Write purposeful red tests that express explicit contract gaps.
  • Run the smallest relevant test slice to verify the targeted surface.
  • Make the smallest green change that satisfies the new contract.
  • Refactor after the contract is green to simplify and consolidate.
  • Sync internal docs, prompts, and policy to reflect the new runtime contract.
  • Broaden verification to adjacent subsystems and related suites.
  • Report the red → green timeline for auditable change.

Quick Start

Apply the red-green-refactor loop to a subsystem by mapping the contract, writing red tests for gaps, executing the smallest green change, and recording the red→green timeline.

Frequently Asked Questions about tdd-failing-tests-loop

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

FAQPage Schema
How do I use TDD to safely refactor a brittle code path?

A strict red-green-refactor loop mitigates risk by mapping the existing contract first, writing purposeful failing tests to express gaps, and making the smallest green changes to satisfy the new contract before refactoring. This keeps tests, implementation, and documentation aligned.

How do I write failing tests that clarify ambiguous contracts?

Write purposeful red tests that explicitly express contract gaps in the targeted surface area. By mapping the existing contract first, you capture the durable behavior boundaries, allowing your failing tests to clarify ambiguous expectations before you make the smallest green change to satisfy them.

When should I use a failing-tests-first workflow for subsystem overhauls?

Use a failing-tests-first workflow for subsystem overhauls when behavior is brittle, tests are ambiguous, or documentation must stay aligned with implementation. It enforces steps to map the contract, write red tests, run the smallest green changes, and synchronize docs to produce a traceable red to green timeline.

What's the best way to keep documentation aligned during a TDD refactor?

Sync internal docs, prompts, and policy to reflect the new runtime contract after your code turns green. This loop ensures that your documentation stays aligned with the implementation throughout the refactor, capturing the auditable red to green timeline for your subsystem overhaul.

Can I run targeted test slices instead of the full suite during a red-green loop?

Yes, you run the smallest relevant test slice to verify the targeted surface area. This focused execution verifies your smallest green changes efficiently before you broaden verification to adjacent subsystems and related suites, ensuring the contract gaps are resolved without unnecessary overhead.

Why does my TDD workflow fail to produce an auditable change timeline?

Your TDD workflow fails when you skip mapping the contract or syncing documentation after refactoring. A traceable red to green timeline requires enforcing steps to map the contract, write failing tests, make green changes, and record the progression to verify the targeted surface and adjacent subsystems.