test-driven-development

Implements code changes using the red-green-refactor test-driven development loop.

Updated Sep 15, 2026
One-click install
npx skills add https://github.com/Qiuyi-Hong/addyosmani-skills --skill test-driven-development-qiuyi-hong
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/Qiuyi-Hong/addyosmani-skills/tree/main/skills/test-driven-development
Command: npx skills add https://github.com/Qiuyi-Hong/addyosmani-skills --skill test-driven-development-qiuyi-hong

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Code changes often ship without proof they work, and bug fixes regress because no test captured the original failure. This Skill enforces a write-the-test-first workflow so every behavior change is verified by a failing-then-passing test. ## Core Features & Use Cases - Red-Green-Refactor Loop: Write a failing test, implement the minimal code to pass it, then refactor with tests green. - Prove-It Pattern for Bugs: Reproduce any reported bug with a failing test before attempting a fix, guaranteeing the fix is verified. - Test Pyramid & Quality Guidance: Classify tests by size (small/medium/large), prefer real implementations over mocks, and apply DAMP, Arrange-Act-Assert, and descriptive naming conventions. - Use Case: A bug report says completing a task doesn't set its timestamp. Write a reproduction test that fails, implement the fix, watch it pass, then run the full suite to confirm no regressions. ## Quick Start Ask the agent to implement a new feature or fix a bug using test-driven development with a failing test written first.

Frequently Asked Questions about test-driven-development

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

FAQPage Schema
How do I practice test-driven development when fixing a bug?

Write a test that reproduces the bug first and confirm it fails, then implement the fix and confirm the test passes. Finally run the full test suite to verify no regressions were introduced.

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

Red means writing a failing test for the desired behavior, green means writing the minimal code to make it pass, and refactor means cleaning up the implementation while keeping tests green. The cycle repeats for each new behavior.

Should I use mocks or real implementations in unit tests?

Prefer real implementations first, then fakes, stubs, and mocks last. Mock only when the real dependency is too slow, non-deterministic, or has uncontrollable side effects like external APIs or email sending.

When should I not write tests for a change?

Skip tests only for pure configuration changes, documentation updates, or static content changes with no behavioral impact. Any change to logic, behavior, or edge case handling should have a corresponding test.

Why do my tests break every time I refactor code?

Tests that verify internal method calls or implementation details break during refactoring even when behavior is unchanged. Test state and outcomes instead of interactions so tests survive internal restructuring.