test-driven-development

Implement the RED-GREEN-REFACTOR cycle with Python tests.

1|Updated Jun 9, 2026
One-click install
npx skills add https://github.com/aivos-xie/hermes-skills --skill test-driven-development-aivos-xie
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/aivos-xie/hermes-skills/tree/main/software-development/test-driven-development
Command: npx skills add https://github.com/aivos-xie/hermes-skills --skill test-driven-development-aivos-xie

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pytest, and includes scripts (resource) components.

What problem does it solve?

This Skill guides you through the Test-Driven Development (TDD) process, helping you write high-quality code by emphasizing tests before code.

Core Features & Use Cases

  • RED-GREEN-REFACTOR Cycle: Encourages you to write a failing test, then write minimal code to pass it, and finally refactor.
  • When to Use TDD: For new features, bug fixes, refactoring, and behavior changes.
  • Why Order Matters: Emphasizes writing tests first to ensure they accurately reflect the desired behavior.

Quick Start

Start by writing a failing test for a new feature. Run the test to confirm it fails. Then, write the minimum code to pass the test. Refactor as needed to improve the code without changing its behavior.

Frequently Asked Questions about test-driven-development

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

FAQPage Schema
How do I start test-driven development in Python?

To start test-driven development, write a failing test for a new feature first, then write minimal code to pass it, and finally refactor to improve code quality without changing behavior.

What is the RED-GREEN-REFACTOR cycle in TDD?

The RED-GREEN-REFACTOR cycle is a test-driven development process where you write a failing test, implement the minimum code to make it pass, and then refactor for better code quality.

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

You should use test-first development when implementing new features, fixing bugs, refactoring existing logic, or modifying software behavior to ensure tests accurately reflect desired outcomes.

Do I need pytest to write tests before code?

Yes, this test-driven development methodology requires Python and uses pytest as its dependency to run tests, validate failures, and confirm that minimal code passes the required behavior.

Why write tests before code instead of afterwards?

Writing tests before code ensures the tests accurately reflect the desired behavior without being biased by the implementation, leading to higher code quality and clearer software development focus.

Can I use TDD for bug fixes and refactoring?

Yes, test-driven development is specifically recommended for bug fixes and refactoring, as writing a failing test first confirms the defect and ensures your refactored code maintains the correct behavior.