One-click install
npx skills add https://github.com/CasaPerks/casaflow --skill tdd-casaperks
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/CasaPerks/casaflow/tree/main/core/skills/tdd
Command: npx skills add https://github.com/CasaPerks/casaflow --skill tdd-casaperks

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

TDD prevents unverified code changes by forcing you to write a failing test first, so you only implement what you have explicitly specified and can automatically guard against regressions.

Core Features & Use Cases

  • Failing-test-first discipline: Ensures every production behavior is justified by a test that initially fails, then passes.
  • Red-Green-Refactor loop: Drives a tight cycle of writing the test, verifying the failure, implementing the smallest change to pass, and only then cleaning up.
  • Regression-proof debugging: When a bug is found, it is reproduced in a new failing test before making the fix, so the fix is proven and preserved.

Use case example: You’re adding a new retry behavior to a function—write a test that fails because the retry doesn’t exist yet, implement the minimal retry logic to make the test pass, then refactor for clarity while keeping the tests green.

Quick Start

Ask an AI to guide you through writing a failing test first, running it to confirm the failure is real, implementing the minimal code to make it pass, and refactoring without changing behavior.

Frequently Asked Questions about tdd

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

FAQPage Schema
How do I start test-driven development for a new feature?

Test-driven development starts by writing a failing unit test that defines the desired behavior, implementing the minimal code to pass it, and then refactoring while keeping tests green.

What is the red-green-refactor loop in unit testing?

The red-green-refactor loop is a test-driven development cycle where you write a failing test, implement the smallest code change to make it pass, and then clean up the design without breaking behavior.

How do I use unit testing to prevent software regressions when fixing bugs?

To prevent software regressions, you reproduce the bug in a new failing unit test first, then apply the fix so the test passes, ensuring the specific behavior is permanently guarded against future breaks.

When should I use test-first workflow for refactoring existing code?

Use a test-first workflow for refactoring when changing internal code structure, ensuring all existing tests remain green throughout the process to verify behavior stays unchanged and regressions are prevented.

Does test-driven development work for behavior changes in production code?

Yes, test-driven development applies to behavior changes by turning requirements into executable proofs, ensuring new production code is justified by failing tests and protected against regressions.

Why write a failing test before implementing production code?

Writing a failing test before implementation enforces a test-first discipline that verifies the test is valid and ensures you only implement exactly what the requirements specify, preventing unverified code changes.