tdd-red-green-refactor

Write failing tests before production code to drive minimal fixes.

1|Updated Mar 20, 2026
One-click install
npx skills add https://github.com/kaynetik/skills --skill tdd-red-green-refactor-kaynetik
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd-red-green-refactor
Source: https://github.com/kaynetik/skills/tree/main/tdd-red-green-refactor
Command: npx skills add https://github.com/kaynetik/skills --skill tdd-red-green-refactor-kaynetik

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Red-Green-Refactor provides a disciplined TDD workflow that prevents regressions, proves bugs exist before changing production code, and guides minimal, test-driven feature delivery so teams avoid brittle tests and hidden defects.

Core Features & Use Cases

  • Prove-before-change: Always start by writing a failing test that documents the expected behavior so fixes are auditable and reproducible.
  • Minimal, safe fixes: Implement the smallest possible change to make the test pass, then refactor with strong test coverage to avoid introducing regressions.
  • Team workflows: Supports splitting work into a failing-test commit and a separate fix commit for clearer reviews, and encourages hypothesis-driven investigations when root causes are unclear.
  • Language guidance: Includes practical advice and examples for Rust, Go, TypeScript, and Solidity to apply the pattern in real projects.

Quick Start

Reproduce the failing behavior, write one failing test that asserts the correct public behavior, run the test to confirm failure, implement the minimal change to pass the test, and then refactor with tests remaining green.

Frequently Asked Questions about tdd-red-green-refactor

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

FAQPage Schema
How do I fix bugs using test-driven development?

Fix bugs using test-driven development by writing a failing test that reproduces the defect, implementing minimal code to pass, and refactoring safely. This proves the bug exists before changing production code and prevents regressions.

What is the red-green-refactor cycle?

The red-green-refactor cycle is writing a failing test, writing minimal code to pass, then refactoring safely. It drives disciplined feature delivery and regression prevention across unit, integration, and acceptance test scenarios.

Can I apply TDD to bug fixes in Rust, Go, TypeScript, and Solidity?

Yes, you can apply TDD to bug fixes in Rust, Go, TypeScript, and Solidity. The workflow includes practical advice and examples for these languages to reproduce failing behavior and implement minimal passing changes.

How do I start TDD for a small feature addition?

Start TDD for a small feature addition by reproducing the failing behavior, writing one failing test asserting correct public behavior, confirming failure, implementing the minimal change, and refactoring with tests green.

What's the best way to prevent regressions during code reviews?

Prevent regressions during code reviews by splitting work into a failing-test commit and a separate fix commit. This enforces a disciplined TDD workflow, ensuring fixes are auditable and reproducible for clearer reviews.

When should I not use the red-green-refactor workflow?

Avoid red-green-refactor when root causes are unclear and require hypothesis-driven investigation, or when writing more than one failing test per behavior, as the workflow demands a single failing test to drive minimal fixes.