test-driven-development

Enforce the Red-Green-Refactor cycle with failing tests before production code.

7|1|Updated Mar 15, 2017
One-click install
npx skills add https://github.com/Henquewl/Hunter-X-Hunter-Greed-Island-MUD --skill test-driven-development-henquewl
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/Henquewl/Hunter-X-Hunter-Greed-Island-MUD/tree/main/.opencode/skills/superpowers/skills/test-driven-development
Command: npx skills add https://github.com/Henquewl/Hunter-X-Hunter-Greed-Island-MUD --skill test-driven-development-henquewl

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill addresses the common issue of unreliable code and technical debt by enforcing a disciplined Test-Driven Development (TDD) cycle that ensures every feature is verified by a failing test before implementation.

Core Features & Use Cases

  • Red-Green-Refactor Cycle: Provides a structured workflow to write failing tests, implement minimal code, and refactor safely.
  • Anti-Pattern Prevention: Includes comprehensive guidance on avoiding common testing pitfalls like mocking behavior instead of real logic.
  • Use Case: When implementing a new feature or fixing a bug, use this skill to ensure your code is fully tested, documented by its own test suite, and free from over-engineering.

Quick Start

Apply the test-driven-development skill to guide the implementation of the new user authentication module by writing the failing test first.

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 the Red-Green-Refactor cycle to implement new software features?

The Red-Green-Refactor cycle enforces writing a failing test first, implementing minimal production code to pass it, and then safely refactoring. This disciplined TDD approach ensures high code quality and full test coverage for new features.

Why does writing failing tests before production code improve software quality?

Writing failing tests before production code prevents technical debt by verifying every feature requirement upfront. This strict adherence to the TDD cycle ensures your implementation is fully documented by its test suite and free from over-engineering.

What is the best way to fix a bug using test-driven development?

The best way to fix a bug using test-driven development is to write a failing test that reproduces the specific defect first. You then implement the minimal code fix to make the test pass, ensuring the bug is verified and prevented from regressing.

How do I avoid common unit testing anti-patterns when mocking behavior?

To avoid common unit testing anti-patterns, you should mock external dependencies rather than mocking real internal logic. Following strict TDD guidelines prevents over-engineering and ensures your tests verify actual behavior instead of implementation details.

When should I not use test-driven development for my software project?

You should not use test-driven development when exploring experimental spikes where code will be thrown away, as the strict Red-Green-Refactor cycle requires writing failing tests before production code. TDD is designed for feature implementations, bug fixes, and refactoring tasks.