test-driven-development

Drive development with failing tests before implementing minimal solutions.

Updated Mar 30, 2026
One-click install
npx skills add https://github.com/beyondwen/track-record-new --skill test-driven-development-beyondwen
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/beyondwen/track-record-new/tree/main/.gemini/skills/test-driven-development
Command: npx skills add https://github.com/beyondwen/track-record-new --skill test-driven-development-beyondwen

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

先写测试,确保实现的功能在最小改动下满足期望,并避免回归。

Core Features & Use Cases

  • Red-Green-Refactor cycle: 通过不断的失败测试、实现最小代码、再重构来提升代码质量。
  • Behavior-driven development: 测试驱动实现,确保需求明确且可验证。
  • Risk reduction and documentation: 通过测试用例记录期望行为,方便后续维护。

Quick Start

在实现新功能前先编写失败测试,并让测试失败后再实现最小代码。

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 to fix bugs without causing regressions?

Test-driven development fixes bugs by writing a failing test that reproduces the issue first, then implementing the minimal code to pass it. This validates behavior and prevents regressions during bug fixes.

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

The red-green-refactor cycle is a unit testing workflow where you write a failing test, implement the minimal solution to pass it, and then refactor the code while keeping tests green to ensure quality.

How to start writing failing tests before implementing new features?

Start writing failing tests by defining expected behavior for a new feature before any implementation. Run the test to confirm failure, then write the minimal code needed to pass it.

Does test-driven development work for refactoring existing codebases?

Test-driven development works for refactoring codebases by validating expected behavior with tests before changes. You keep tests green while restructuring code to ensure correctness throughout the refactor.

Why avoid mocking anti-patterns when doing TDD?

Avoiding mocking anti-patterns in TDD ensures tests validate actual behavior rather than implementation details. Proper mocking maintains test reliability and prevents false positives during the red-green-refactor cycle.

When should I not use test-driven development for software engineering tasks?

Test-driven development may not suit exploratory programming or throwaway prototypes where behavior is undefined. It requires clear, verifiable requirements to drive implementation and validate correctness effectively.