test-driven-development

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

Updated Apr 28, 2026
One-click install
npx skills add https://github.com/JacobThree/zero-bloat-mcp-stack --skill test-driven-development-jacobthree
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/JacobThree/zero-bloat-mcp-stack/tree/main/ai_blueprints/agent-skills/skills/test-driven-development
Command: npx skills add https://github.com/JacobThree/zero-bloat-mcp-stack --skill test-driven-development-jacobthree

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Code changes and bug fixes often ship without proof they work, leading to regressions and untested behavior. This Skill enforces a test-first workflow where every behavior change is verified by a failing test before implementation. ## 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 resolves the issue. - Test Quality Guidance: Covers the test pyramid, DAMP vs DRY trade-offs, state-based assertions over mocks, and anti-patterns like flaky tests and snapshot abuse. - Use Case: A bug report says completing a task doesn't set its timestamp. Write a reproduction test that fails, implement the fix, watch the test pass, and 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 all tests passing.

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

Prefer real implementations first, then fakes, stubs, and mocks last. Use mocks 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 with no behavioral impact. Any logic change, bug fix, or edge case handling should have a corresponding test.

Why do my tests break every time I refactor code?▼

Tests likely assert on internal implementation details or method call sequences instead of outcomes. Test state and inputs/outputs rather than interactions so refactoring without behavior change keeps tests green.

How do I balance unit, integration, and end-to-end tests?▼

Follow the test pyramid: roughly 80% fast unit tests for pure logic, 15% integration tests for API and database boundaries, and 5% end-to-end tests limited to critical user flows.