test-driven-development

Enforce test-first development with red-green-refactor cycles for features and bug fixes.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill prevents fragile implementation work by forcing you to define behavior with tests before writing production code, reducing regressions and guesswork.

Core Features & Use Cases

  • Red-Green-Refactor Workflow: Guides you through writing a failing test, implementing the smallest working change, and then cleaning up safely.
  • Bug Fix Verification: Turns real bugs into repeatable regression tests so fixes stay fixed.
  • Code Quality Guardrails: Helps you avoid overengineering, mock abuse, and test-after-implementation habits.
  • Use Case: When you need to add a feature or repair a defect, this Skill keeps the work disciplined and provably correct from the first test onward.

Quick Start

Ask me to implement your feature or bug fix using test-first development and I will guide the red-green-refactor cycle from the first failing test to the final refactor.

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 for bug fixes to prevent regressions?

Test-driven development for bug fixes requires writing a failing test that reproduces the defect before changing production code. This turns the bug into a repeatable regression test, ensuring the fix stays fixed and preventing future regressions.

What is the red-green-refactor workflow in TDD?

The red-green-refactor workflow is a TDD cycle where you write a failing test first, implement the smallest working code change to make it pass, and then safely clean up the code without breaking the now-green tests.

How do I start writing unit tests before implementation for new features?

To start writing unit tests before implementation, define the desired behavior with a failing test first. Confirm the failure is correct, then write minimal production code to pass the test, keeping the suite green throughout development.

Can I use TDD discipline for refactoring existing code safely?

Yes, TDD discipline supports refactoring by keeping existing tests green while you clean up code. The test suite acts as a safety net, verifying that behavioral changes during refactoring do not introduce new regressions or break functionality.

What are common testing anti-patterns to avoid when writing unit tests?

Common testing anti-patterns include test-after-implementation habits, mock abuse, and overengineering. Writing tests first enforces discipline, helping you avoid fragile implementation work and guesswork while maintaining code quality guardrails.

Why does writing tests after implementation lead to fragile code?

Writing tests after implementation leads to fragile code because it validates existing logic rather than defining expected behavior. Test-first development forces you to specify behavior upfront, reducing guesswork and ensuring provably correct, regression-safe code.