test-driven-development

Implement deterministic code changes via failing tests before minimal production code.

47|12|Updated Apr 17, 2026
One-click install
npx skills add https://github.com/btseytlin/ultrapack --skill test-driven-development-btseytlin
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/btseytlin/ultrapack/tree/main/plugins/up/skills/test-driven-development
Command: npx skills add https://github.com/btseytlin/ultrapack --skill test-driven-development-btseytlin

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It prevents regressions by forcing new behavior to be proven with a failing test first, then implemented minimally until the test passes and the wider suite remains green.

Core Features & Use Cases

  • Applicability-based invocation: Guides you to use TDD only when behavior is deterministic, reused across multiple call sites, and a regression should trip CI.
  • RED-GREEN-REFACTOR loop: Enforces the order of operations—write a failing test, verify the failure reason, implement the smallest code change to pass, then refactor while keeping tests green.
  • Safety guardrails for common mistakes: Explicitly blocks tests-after patterns such as writing production code before the test or “adapting” existing code while writing tests.

Quick Start

Ask the agent to apply RED-GREEN-REFACTOR to implement a deterministic regression-prone feature by writing a failing test first, then adding the minimal production code to make it pass, and finally running the full test suite.

Frequently Asked Questions about test-driven-development

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

FAQPage Schema
How do I use RED-GREEN-REFACTOR to prevent regressions in Python?

Apply TDD by writing a failing test first, verifying its failure reason, adding minimal production code until it passes, then refactoring while keeping tests green. This enforces strict sequencing to prevent regressions in deterministic library utilities and API methods.

When should I use test-first development for deterministic code?

Use test-first development when behavior is deterministic, reused across multiple call sites, and regressions should trip CI. Apply it to library utilities, validators, and API methods to enforce regression prevention through a failing test before implementation.

What is the correct sequence for unit testing and implementation in TDD?

The correct TDD sequence is RED-GREEN-REFACTOR: write a failing test, verify the failure reason, implement the smallest code change to pass the test, then refactor while keeping the full test suite green. This strict order prevents tests-after patterns.

Can I adapt existing code while writing tests for regression prevention?

No, you should not adapt existing code while writing tests. Adapting production code before or during test creation violates the tests-first final rule and breaks the strict RED-GREEN-REFACTOR sequencing required for reliable regression prevention and CI gating.

How do I ensure CI gating fails properly on regressions?

Ensure CI gating fails on regressions by writing a failing unit test first, verifying the specific failure reason, implementing minimal code to pass, and running the full test suite. This RED-GREEN-REFACTOR loop guarantees CI catches deterministic behavior changes.