test-driven-development

Enforce test-first development with pytest and the RED-GREEN-REFACTOR cycle.

Updated May 26, 2026
One-click install
npx skills add https://github.com/ruiyangruiyi/hermes-agent --skill test-driven-development-ruiyangruiyi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/ruiyangruiyi/hermes-agent/tree/main/skills/software-development/test-driven-development
Command: npx skills add https://github.com/ruiyangruiyi/hermes-agent --skill test-driven-development-ruiyangruiyi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It prevents unreliable changes and regressions by forcing you to verify behavior through failing tests before writing production code.

Core Features & Use Cases

  • Red-Green-Refactor workflow: Write one minimal failing test, confirm the failure, implement the smallest code to pass, then refactor while keeping tests green.
  • Strict verification gates: Requires watching tests fail and pass (and re-running the full suite for regressions) at every step.
  • Better debugging and development decisions: Converts bugs into reproducible failing tests and uses tests as executable specifications for both features and fixes.

Example Use Case: You’re implementing a new function to retry an operation; you start by writing a test that demonstrates the expected retry behavior and fails, then write minimal code to pass that test, and finally refactor while ensuring the full test suite still passes.

Quick Start

Tell the agent to implement a feature using strict TDD for a project with pytest tests/ and a known test command.

Frequently Asked Questions about test-driven-development

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

FAQPage Schema
How do I enforce strict test-first development to prevent regressions?

Strict test-first development requires writing a minimal failing test, confirming the failure, implementing the smallest code to pass, and refactoring without adding behavior to prevent regressions.

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

The red-green-refactor cycle in pytest unit testing is writing a failing test, implementing minimal code to pass it, then refactoring while keeping tests green to ensure software quality.

How do I convert a bug fix into a reproducible failing test?

To convert a bug fix into a reproducible failing test, you write a test that demonstrates the expected behavior and fails against the current code, then implement the fix to make it pass.

Can I use this test-driven development approach for refactoring existing code?

Yes, you can use test-driven development for refactoring by maintaining green tests while you restructure code, ensuring you do not add new behavior and verifying the full suite still passes.

Do I need pytest to apply this TDD workflow?

Yes, the workflow applies to projects using pytest to run tests, verify the mandatory RED and GREEN phases, and execute the full test suite to check for regressions during refactoring.

What are the limitations of strict test-first TDD?

Strict test-first TDD requires watching tests fail and pass at every step, which limits adding behavior during refactoring and mandates full suite re-runs to ensure controlled regression prevention.