test-driven-development

Enforce a red-green-refactor cycle with failing tests before production code.

Updated Oct 21, 2022
One-click install
npx skills add https://github.com/Chengxufeng1994/dotfiles --skill test-driven-development-chengxufeng1994
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/Chengxufeng1994/dotfiles/tree/main/gemini/antigravity/global_skills/test-driven-development
Command: npx skills add https://github.com/Chengxufeng1994/dotfiles --skill test-driven-development-chengxufeng1994

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill enforces a rigorous development process by ensuring that tests are written before any implementation code, preventing bugs and ensuring code quality.

Core Features & Use Cases

  • Enforces Test-First Development: Mandates writing failing tests before writing production code.
  • Guides Red-Green-Refactor Cycle: Provides a clear methodology for writing tests, implementing code, and refactoring.
  • Use Case: When starting a new feature, use this Skill to guide you in writing a test that describes the desired behavior, then write the minimal code to make that test pass, and finally refactor.

Quick Start

Use the test-driven-development skill to write a failing test for the new 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 process and how does it improve code quality?

The test-driven development process enforces a red-green-refactor cycle, requiring failing tests before implementation. This prevents bugs and ensures verifiable software by making tests dictate code behavior.

How do I write code using the red-green-refactor cycle?

To write code using the red-green-refactor cycle, first write a failing test describing desired behavior, then implement minimal production code to pass the test, and finally refactor the codebase.

When should I use test-first development for software tasks?

Use test-first development for all software tasks including building new features, fixing bugs, and refactoring existing code. It mandates writing failing tests before any production code to ensure robust outcomes.

Do I need to write a failing test before writing production code for new features?

Yes, writing a failing test before any production code is an iron law of this methodology. You must write tests first that describe the desired behavior before implementing the minimal code.

Does test-driven development work for bug fixes and refactoring existing code?

Test-driven development is fully applicable to bug fixes and refactoring. It guides developers to write failing tests that capture the bug or desired behavior before making code modifications.

What is the best way to ensure robust software during agile development?

The best way to ensure robust software during agile development is enforcing a test-driven development process. This prevents bugs by mandating tests are written before implementation code across all tasks.