test-driven-development

Enforce test-driven development with red-green-refactor cycles and failing tests first.

6|1|Updated Oct 23, 2025
One-click install
npx skills add https://github.com/alexsandrocruz/ZenPowers --skill test-driven-development-alexsandrocruz
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/alexsandrocruz/ZenPowers/tree/main/skills/test-driven-development
Command: npx skills add https://github.com/alexsandrocruz/ZenPowers --skill test-driven-development-alexsandrocruz

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill prevents bugs, ensures code quality, and builds confidence by enforcing the Test-Driven Development (TDD) cycle. It eliminates the risk of writing untestable code or tests that don't actually verify behavior.

Core Features & Use Cases

  • Red-Green-Refactor Cycle: Guides you through writing a failing test, implementing minimal code to pass, and then refactoring.
  • Iron Law Enforcement: Strictly prohibits writing production code without a failing test first, preventing common TDD shortcuts.
  • Verification-First: Mandates watching tests fail before writing implementation, proving tests actually verify behavior.
  • Use Case: When implementing any new feature or fixing a bug, use this Skill to ensure every line of code is backed by a verifiable test.

Quick Start

Write a minimal failing test

[Fact] public async Task MyFeature_ShouldDoSomething() { // Arrange var service = new MyService(); // Act var result = await service.DoSomething(); // Assert Assert.Equal("expected", result); }

Run test to see it fail

dotnet test --filter "MyFeature_ShouldDoSomething"

Frequently Asked Questions about test-driven-development

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

FAQPage Schema
How do I implement test-driven development in C# projects?

Test-driven development in C# follows the red-green-refactor cycle: write a failing test first using xUnit or similar frameworks, implement minimal code to pass it, then refactor. This ensures every line of production code is backed by a verifiable test and prevents untestable code.

Why should I write tests before implementing features?

Writing tests first verifies that your tests actually catch failures—you see them fail before writing code. This prevents tests that pass regardless of implementation and ensures bugs are caught early, reducing defects and building confidence in code quality.

Can I use test-driven development for bug fixes and refactoring?

Yes. TDD applies to bug fixes, refactoring, and behavior changes across codebases. Write a failing test that reproduces the bug, fix the code minimally, then refactor. This scope covers new features, existing code changes, and quality improvements.

What's the difference between writing tests after versus before code?

Tests written after code often skip edge cases and don't verify actual behavior—they just document existing logic. TDD-first tests define requirements upfront, drive simpler designs, and guarantee testability by enforcing that production code cannot exist without a failing test.

Does test-driven development work with .NET and C#?

Yes. TDD integrates with .NET and C# workflows using xUnit, NUnit, or similar test frameworks. The red-green-refactor cycle works across .NET codebases and enforces strict test naming and prohibition of production code without a failing test.

How do I ensure tests are actually verifying behavior and not just passing?

TDD requires watching each test fail before writing implementation code. This verification-first step proves the test catches real failures. If code passes a test that never failed, the test isn't verifying behavior—TDD eliminates this risk.