tdd

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

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/mengdehong/opencode-dotfiles --skill tdd-mengdehong
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/mengdehong/opencode-dotfiles/tree/main/skills/tdd
Command: npx skills add https://github.com/mengdehong/opencode-dotfiles --skill tdd-mengdehong

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill promotes test-driven development (TDD) by guiding teams to write failing tests before implementing code, reducing defects and enabling safe refactors.

Core Features & Use Cases

  • Red-Green-Refactor discipline: follow a strict cycle to ensure each feature starts with a failing test, then green code, then clean refactor.
  • Quality assurance through tests: ensures that new features, bug fixes, and refactors are validated by automated tests from the outset.
  • Use Case: a developer adds a new module; you first write a failing unit test that describes expected behavior, then implement until tests pass, and finally refactor for readability.

Quick Start

Provide a failing test first, then write minimal code to pass the test.

Frequently Asked Questions about tdd

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

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

Test-driven development for new features requires writing a failing unit test describing expected behavior first, then implementing minimal code to pass the test, and finally refactoring for readability. This red-green-refactor cycle ensures each feature is validated by automated tests from the outset.

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

The red-green-refactor cycle is a strict test-driven development workflow where you write a failing test first, implement minimal code to make it pass, then clean up the code through refactoring. This discipline reduces defects and enables safe refactors.

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

Yes, test-driven development applies to bug fixes and refactors across any codebase. You write a failing test that captures the bug or expected behavior, implement the fix until tests pass, and refactor with confidence knowing the automated tests validate your changes.

Do I need a specific testing framework to start writing failing tests first?

No specific testing framework is required. Test-driven development can be applied across any codebase where rapid feedback and robust tests are valued. You simply need an environment that supports writing and running unit tests to validate expected behavior.

Why should I write failing tests before implementation code?

Writing failing tests before implementation ensures your code is validated by automated tests from the outset. This test-first approach reduces defects, provides rapid feedback, and enables safe refactors by guaranteeing that every feature starts with a verifiable test.

What's the best way to maintain test quality when adding new modules?

The best way to maintain test quality is following strict red-green-refactor discipline. When adding a new module, first write a failing unit test describing expected behavior, implement until tests pass, then refactor for readability to ensure consistent test quality.