tdd-guidelines

Enforce a Red-Green-Refactor workflow with test pyramid priority and MSW mocking.

11|2|Updated Feb 5, 2026
One-click install
npx skills add https://github.com/recca0120/code-quest --skill tdd-guidelines-recca0120
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd-guidelines
Source: https://github.com/recca0120/code-quest/tree/main/.claude/skills/tdd-guidelines
Command: npx skills add https://github.com/recca0120/code-quest --skill tdd-guidelines-recca0120

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill prevents fragile development by enforcing a strict Test-Driven Development workflow so changes stay behavior-preserving and expectations remain trustworthy during refactors.

Core Features & Use Cases

  • Red → Green → Refactor loop: keeps implementation honest by starting with a failing test, then writing the minimum code to pass, then improving structure without changing behavior.
  • Expect-immutability rule: treats expect as the golden behavioral contract; refactoring must not change expectations.
  • Test pyramid guidance: prioritizes Feature tests, then Integration tests, and finally Unit tests to balance feedback speed and confidence.
  • Test double selection strategy: chooses the lowest-level double that enables principled isolation when needed, aligning with existing test-doubles theory.
  • MSW-based front-end testing patterns: demonstrates request/response mocking for API and transport-driven UI behavior.

Quick Start

Use the tdd-guidelines skill when building a new feature or refactoring code so you can follow Red-Green-Refactor and keep expect stable while tests drive design.

Frequently Asked Questions about tdd-guidelines

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

FAQPage Schema
How do I prevent test expectations from breaking during code refactoring?

To prevent test expectations from breaking during refactoring, apply an expect-immutability rule that treats expect statements as golden behavioral contracts, ensuring refactors change internal structure without altering observable behavior.

What is the correct test pyramid priority for structuring feature, integration, and unit tests?

The correct test pyramid priority structures tests by prioritizing Feature tests first, then Integration tests, and finally Unit tests to balance feedback speed and confidence during iterative development.

How do I select the right test doubles for isolating dependencies in unit testing?

Select the right test doubles by choosing the lowest-level double that enables principled isolation when needed, aligning with established test-doubles theory to keep tests reliable and maintainable.

Can I use MSW for front-end API mocking in test-driven development?

Yes, MSW supports test-driven development by providing request and response mocking patterns for APIs, enabling reliable front-end testing for transport-driven UI behavior.

When should I follow the Red-Green-Refactor loop in software development?

You should follow the Red-Green-Refactor loop when building new features or refactoring code, starting with a failing test, writing minimum code to pass, and improving structure without changing behavior.

Why does behavior drift occur during iterative coding and how can TDD prevent it?

Behavior drift occurs during iterative coding when changes unintentionally alter existing functionality; TDD prevents it by enforcing a strict workflow that keeps changes behavior-preserving and expectations trustworthy.