tdd-mastery
TDD Mastery enforces the iron law of test-first development: write a failing test, verify it fails, implement minimal code to pass, then refactor. The skill drills the red-green-refactor cycle with no exceptions, rejecting any production code written before its corresponding test exists and has been observed failing.
TDD Mastery teaches the red-green-refactor cycle, enforcing test-first development with zero exceptions.
AI-generated summary based on this skill's SKILL.md
Install
xenitV1/claude-code-maestro/tdd-mastery · repository language: JavaScript
git clone https://github.com/xenitV1/claude-code-maestro
cp -r claude-code-maestro/skills/tdd-mastery ~/.claude/skills/tdd-masterynpx skillfed install xenitV1/claude-code-maestro/tdd-masteryFrequently asked questions
AI-generated answers based on this skill's SKILL.md and metadata
How do you write tests first in the red-green-refactor cycle?
TDD Mastery teaches that you write a failing test before any production code. In the red phase, you observe the test fail to confirm it's testing the right behavior. In the green phase, you write minimal code to pass that test. In the refactor phase, you improve the code while keeping tests green. This sequence is non-negotiable—TDD Mastery rejects any production code written before its test exists and has failed.
What is the TDD workflow for beginners?
TDD Mastery's workflow for beginners is: (1) Write a failing test and watch it fail; (2) Write minimal code to make it pass; (3) Refactor while keeping tests green; (4) Repeat. This red-green-refactor cycle enforces strict test-first discipline. Each cycle should be small and focused. TDD Mastery emphasizes that skipping the failing test observation step or writing code before tests violates the iron law of test-first development.
Why should you watch a test fail before coding?
TDD Mastery requires watching your test fail first because it proves your test is actually testing something. If a test passes before you write code, it's not testing the new behavior—it's a false positive. Observing the red phase confirms your test will catch regressions and validates your test logic. This verification step is core to TDD Mastery's iron law: no production code without a preceding, observed-failing test.
How does TDD Mastery handle bug fixes using test-first protocol?
TDD Mastery fixes bugs by first writing a failing test that reproduces the bug, then fixing the code to pass that test. This ensures the bug is captured and won't resurface. The test becomes a permanent guard. TDD Mastery rejects hotfixes or patches written without this test-first protocol, maintaining quality standards and testing infrastructure rigor across all code changes.
What testing infrastructure does TDD Mastery recommend?
TDD Mastery supports setup with Vitest, Jest, or pytest depending on your language. The skill emphasizes that testing infrastructure must be in place before development begins. It also covers contract-first testing with MSW handlers for API mocking. TDD Mastery implements quality standards by ensuring your test framework, runners, and coverage tools are configured to enforce the red-green-refactor cycle and reject code without preceding tests.
What common TDD mistakes does TDD Mastery help you avoid?
TDD Mastery helps avoid writing code before tests, skipping the red phase verification, writing overly complex tests, and refactoring without green tests. It teaches that minimal code to pass tests prevents over-engineering. TDD Mastery also emphasizes clear test names, edge case coverage, and a verification checklist for each cycle. The skill enforces the iron law with no exceptions: every production function must have a failing test written and observed first.
SKILL.md
rendered from the published skill — quoted content, verbatim
<domain_overview>
🧪 TDD MASTERY: THE IRON LAW
> Philosophy: If you didn't watch the test fail, you don't know if it tests the right thing. TDD is not optional—it's the foundation of trustworthy code. TEST-FIRST INTEGRITY MANDATE (CRITICAL): Never write production code before a test exists and has been seen failing. AI-generated code often attempts to write implementation and tests simultaneously or implementation first. You MUST strictly adhere to the Red-Green-Refactor cycle. Any code submitted without a preceding failing test or that generates tests after the implementation must be rejected as "Legacy Code on Arrival".
🚨 THE IRON LAW
NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST
Write code before the test? Delete it. Start over.
No exceptions: - Don't keep it as "reference" - Don't "adapt" it while writing tests - Don't look at it - Delete means delete
Implement fresh from tests. Period. </domain_overview> <core_workflow>
🔴 RED-GREEN-REFACTOR CYCLE
Phase 1: RED - Write Failing
(truncated - see the full file via the links below)
Read as markdown · JSON record · Browse the source repository
File tree — 2 files
skills/tdd-mastery/SKILL.md
skills/tdd-mastery/testing-anti-patterns.md