test-driven-development

Guides test-driven development with red-green-refactor cycles and bug reproduction tests.

2|Updated Jul 6, 2026
One-click install
npx skills add https://github.com/NAMEWTA/learning-open-code --skill test-driven-development-namewta
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/NAMEWTA/learning-open-code/tree/main/translator/open-ai-skills/addyosmani-agent-skills/skills/test-driven-development
Command: npx skills add https://github.com/NAMEWTA/learning-open-code --skill test-driven-development-namewta

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Code changes often ship without proof they work, and bug fixes lack regression protection. This Skill enforces a test-first workflow so every behavior change is verified by a failing-then-passing test before it is considered done. ## Core Features & Use Cases - Red-Green-Refactor Workflow: Write a failing test first, implement the minimal code to pass it, then refactor safely 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 and preventing regressions. - Testing Best Practices: Covers the test pyramid, state-based vs interaction-based assertions, DAMP over DRY in tests, real implementations over mocks, and browser runtime verification via Chrome DevTools. - Use Case: When you receive a bug report that completing a task does not set its timestamp, the Skill guides you to first write a failing reproduction test, then implement the fix, 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, starting with a failing test that proves the expected behavior.

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 reproduction test that demonstrates the bug and confirm it fails before touching the fix. Then implement the minimal change to make the test pass, and 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 first, green means writing the minimal code to make it pass, and refactor means cleaning up the implementation while keeping tests green. A test that passes immediately proves nothing about the new behavior.

Should I use mocks or real implementations in unit tests?▼

Prefer real implementations first, then in-memory fakes, then stubs, and use interaction mocks only as a last resort. Reserve mocks for dependencies that are slow, nondeterministic, 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 edits that do not affect behavior. Any change to logic, bug fixes, or edge-case handling should always ship with a corresponding test.

Why do my tests break during refactoring even when behavior is unchanged?▼

Tests that assert on internal method calls or implementation details break during refactoring. Assert on observable state and outputs instead of interactions, so tests verify what the code does rather than how it does it.