TDD

Installation
SKILL.md

Test-Driven Development (TDD)

Overview

Test-Driven Development (TDD) is a software development approach where you write tests before you write the production code. Its purpose is to ensure high code coverage, deep understanding of requirements before implementation, and a robust safety net for future refactoring. Invoke this skill when starting a new feature or when asked to write tests for existing code that currently lacks coverage.

Core Principles

  • Red-Green-Refactor: This is the heartbeat of TDD.
    • Red: Write a test that fails.
    • Green: Write the minimal code to pass the test.
    • Refactor: Improve the code structure without altering behavior.
  • YAGNI (You Aren't Gonna Need It): Only write code that is required to pass the current failing test. Do not anticipate future requirements.
  • Single Responsibility: Each test should verify exactly one logical concept or behavior.

Preparation Checklist

  • Have the feature requirements clearly defined.
  • Set up the testing framework in your project environment.
  • Ensure you can easily execute tests from your command line or IDE.
Installs
1
GitHub Stars
3
First Seen
2 days ago
TDD — heldinhow/awesome-opencode-dev-skills