test-driven-development

Guides test-first development workflows using the red-green-refactor cycle for code changes.

Updated Jul 1, 2026
One-click install
npx skills add https://github.com/raishoemi/traffic-sim-v2 --skill test-driven-development-raishoemi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/raishoemi/traffic-sim-v2/tree/main/.github/skills/test-driven-development
Command: npx skills add https://github.com/raishoemi/traffic-sim-v2 --skill test-driven-development-raishoemi

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Code changes shipped without tests create regressions, unverified bug fixes, and untrustworthy implementations. 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 minimal code to pass it, then refactor with tests as a safety net. - Prove-It Pattern for Bug Fixes: Reproduce any reported bug with a failing test before attempting a fix, guaranteeing the fix actually works. - Test Quality Guidance: Covers the test pyramid, DAMP vs DRY, state-based assertions over mocks, and anti-patterns to avoid. - Use Case: A bug report says completing a task doesn't set its timestamp. Write a reproduction test that fails, implement the fix, and watch the test pass — the regression is now permanently guarded. ## Quick Start Use the test-driven-development skill to implement this feature by writing a failing test first, then the minimal code to make it pass.

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.

How do I write a failing test before the code exists?

Write the test against the interface you intend to create, such as calling a not-yet-defined function, and run it to confirm it fails. Then write the minimal implementation needed to make that specific test pass.

Should I use mocks or real implementations in unit tests?

Prefer real implementations first, then fakes, stubs, and finally mocks as a last resort. Reserve mocks for dependencies that are slow, non-deterministic, or have 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 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 assert on internal method calls or implementation details break during refactoring even when behavior is unchanged. Assert on inputs and outputs (state-based testing) instead of interaction sequences.