tdd

Guides test-driven development using the RED-GREEN-REFACTOR loop for features and bugfixes.

1|Updated Sep 15, 2026
One-click install
npx skills add https://github.com/amoai-tech/mdeai --skill tdd-amoai-tech
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/amoai-tech/mdeai/tree/main/.claude/skills/tdd
Command: npx skills add https://github.com/amoai-tech/mdeai --skill tdd-amoai-tech

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? It prevents untested code changes by enforcing a disciplined test-first workflow where every behavior is proven by a failing test before implementation, reducing regressions and tests coupled to internals. ## Core Features & Use Cases - RED-GREEN-REFACTOR Loop: Write the smallest failing test for one behavior, implement the minimal change to pass, then refactor while keeping tests green. - Seam Selection Guidance: Choose the cheapest test level for each requirement, from Vitest unit tests and Supabase RLS tests to Mastra tool tests and Playwright journeys. - Regression Pattern: For bugs, follow reproduce, failing regression test, fix, passing test, then adjacent and journey tests. - Use Case: When fixing a duplicate Stripe webhook processing bug, first write a failing idempotency/replay regression test, then apply the smallest fix and rerun to prove the behavior. ## Quick Start Ask the assistant to implement your next feature or bugfix using test-driven development with a failing test written first.

Frequently Asked Questions about tdd

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

FAQPage Schema
How do I practice test-driven development for a bugfix?

Follow the regression pattern: reproduce the bug, write a failing regression test that proves the missing behavior, apply the smallest fix, confirm the test passes, then add adjacent tests and a user journey test if the change is material.

How do I choose the right test level for a feature?

Pick the cheapest test that proves the requirement: Vitest unit tests for pure domain logic, integration tests for module contracts, SQL/RLS tests for Supabase authorization, tool tests for Mastra workflows, and Playwright for user journeys.

When should I mock dependencies in tests?

Mock only at system boundaries such as external APIs, payment providers, time, and randomness. Never mock your own modules or internal collaborators, and never assert on the mock itself instead of the real component's behavior.

Why does my test pass before I write the implementation?

A test that passes before the implementation change is not proving the new behavior. Fix the test or choose a better public seam so it fails for the intended reason before writing any production code.

What makes a test coupled to implementation details?

Tests that mock internal collaborators, assert call counts, verify through database queries instead of interfaces, or recompute expected values with the code under test break on refactors without catching real bugs. Assert observable behavior with hand-derived literals.