test-driven-development

Enforce test-first development with a red-green-refactor workflow.

Updated Sep 27, 2024
One-click install
npx skills add https://github.com/sheer-rey/PowerBash --skill test-driven-development-sheer-rey
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/sheer-rey/PowerBash/tree/main/.claude/skills/test-driven-development
Command: npx skills add https://github.com/sheer-rey/PowerBash --skill test-driven-development-sheer-rey

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill prevents fragile implementations by requiring you to define expected behavior in failing tests before writing production code.

Core Features & Use Cases

  • Red-Green-Refactor Workflow: Guides feature work, bug fixes, refactors, and behavior changes through a strict test-first loop.
  • Behavior-Focused Testing: Encourages tests that verify real outcomes instead of overfitting to mocks or implementation details.
  • Practical Guardrails: Helps you validate failures, keep implementation minimal, and preserve confidence while changing code.
  • Use Case: When adding a new function or fixing a regression, use this Skill to write the test that captures the requirement, make it pass with the smallest change, then clean up safely.

Quick Start

Use this skill to write a failing test for the behavior you want, then implement only enough code to make it pass.

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 test-driven development for bug fixes and refactoring?

Test-driven development for bug fixes and refactoring requires writing a failing test that captures the desired behavior before changing production code. You then implement the minimal change to make it pass and clean up safely.

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

The red-green-refactor workflow in unit testing is a strict test-first loop where you write a failing test, implement minimal code to pass it, then clean up safely. It enforces behavior validation throughout feature development.

How do I avoid overfitting unit tests to mocks and implementation details?

To avoid overfitting unit tests to mocks, focus tests on verifying real outcomes and behavior changes rather than implementation details. This prevents fragile implementations and preserves confidence while changing code.

When do I need to write failing tests before production code?

You need to write failing tests before production code when adding new features, fixing regressions, or modifying behavior in software projects. This prevents fragile implementations by defining expected behavior upfront.

How do I validate test failures during test-first development?

Validating test failures during test-first development involves checking that the failing test accurately captures the requirement before writing code. You then implement only enough production code to make the test pass.

Does test-driven development work without external mocking dependencies?

Test-driven development works without external mocking dependencies by encouraging behavior-focused testing that verifies real outcomes. It provides practical guardrails to validate failures and passes without overfitting to mocks.