test-driven-development

Guides users through the Red-Green-Refactor cycle for new features and bug fixes.

160|20|Updated Jan 4, 2026
One-click install
npx skills add https://github.com/tctinh/agent-hive --skill test-driven-development-tctinh
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/tctinh/agent-hive/tree/main/packages/opencode-hive/skills/test-driven-development
Command: npx skills add https://github.com/tctinh/agent-hive --skill test-driven-development-tctinh

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill enforces a rigorous Test-Driven Development (TDD) workflow, ensuring code is reliable, maintainable, and demonstrably correct by preventing bugs before they are introduced.

Core Features & Use Cases

  • Enforces Red-Green-Refactor Cycle: Guides the developer through writing failing tests first, then minimal code to pass, followed by refactoring.
  • Prevents Regressions: Ensures that new code or bug fixes do not break existing functionality.
  • Use Case: When starting a new feature, use this Skill to write a test that fails because the feature doesn't exist yet, then write just enough code to make that test pass, and finally clean up the code while keeping all tests green.

Quick Start

Follow the TDD cycle to implement the new 'user authentication' feature.

Frequently Asked Questions about test-driven-development

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

FAQPage Schema
What is the test-driven development cycle and how does it prevent regressions?

The test-driven development cycle uses a Red-Green-Refactor workflow to write a failing test first, then minimal code to pass it, preventing regressions by ensuring all new features and bug fixes are demonstrably correct before integration.

How do I start writing code for a new feature using TDD?

To start writing code using TDD, write a failing test because the feature doesn't exist yet, implement just enough production code to make that test pass, and finally clean up the code while keeping all tests green.

Does test-driven development work for fixing existing bugs?

Yes, test-driven development works for bug fixing by enforcing a failing test that captures the bug before any production code is written, ensuring the fix is reliable and prevents future regressions.

What's the best way to maintain code quality during software development?

The best way to maintain code quality during software development is to rigorously follow the Red-Green-Refactor cycle, which enforces writing failing tests first and refactoring code only after tests pass.

Why should I write a failing test before writing production code?

You should write a failing test before production code to ensure the feature is demonstrably correct from the start, preventing bugs and addressing common rationalizations for skipping the TDD methodology.

Can I skip the refactoring step in the Red-Green-Refactor cycle?

Skipping the refactoring step in the Red-Green-Refactor cycle is discouraged because it is essential for cleaning up code and maintaining high code quality while keeping all tests green.