test-driven-development

Guides test-first development using the red-green-refactor cycle for implementations and bug fixes.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Code changes made without tests are unverifiable, and bug fixes without reproduction tests leave regressions undetected. This Skill enforces a disciplined test-first workflow so every behavior change is proven by a failing-then-passing test. ## Core Features & Use Cases - Red-Green-Refactor Cycle: Write a failing test first, implement the minimal code to pass it, then refactor with tests as a safety net. - Prove-It Pattern for Bugs: Reproduce any reported bug with a failing test before attempting a fix, guaranteeing the fix actually works. - Test Quality Guidance: Apply the test pyramid, DAMP-over-DRY principle, Arrange-Act-Assert structure, and prefer real implementations over mocks. - Use Case: A bug report says completing a task doesn't set its timestamp. Write a failing test that asserts completedAt is set, confirm it fails, implement the fix, and watch it pass — the regression is now permanently guarded. ## Quick Start Ask the agent to implement the new feature using test-driven development, writing a failing test before any implementation code.

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. This Prove-It Pattern guarantees the fix works and permanently guards against regression.

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 finally mocks as a last resort. Mock only when dependencies are slow, non-deterministic, or have uncontrollable side effects like external APIs or email sending.

When should I not use test-driven development?▼

Skip TDD for pure configuration changes, documentation updates, and static content changes that have no behavioral impact. Any change affecting logic or behavior should be test-driven.

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 inputs and outputs (state) instead of interactions, so refactors keep tests green.