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
Decision gist · record as of 2026-01-24
TDD Mastery teaches the red-green-refactor cycle, enforcing test-first development with zero exceptions. 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.
Use it when
- TDD Mastery's workflow for beginners is: (1) Write a failing test and watch it fail; (2) Write minimal code to make it pass.
- TDD Mastery requires watching your test fail first because it proves your test is actually testing something.
Verify before relying
Read SKILL.md below before installing (2 files). Open directory: indexed for reading, not audited.
Install
xenitV1/claude-code-maestro/tdd-mastery · repository language: JavaScript
Open directory. Skills are indexed for reading, not audited. Review a skill's body before installing it.
Frequently 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)
File tree — 2 files
skills/tdd-mastery/SKILL.md
skills/tdd-mastery/testing-anti-patterns.md
Let your AI agent find skills like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 56,283 agent skills by what they can do, searchable in plain language.
wish › “Learn and enforce strict test-first development cycle”
Give your agent the search over MCP, or paste the wish link into any chat. No install? Search from any chat →
Related skills
Verification Mastery establishes a mandatory gate: never claim work is done without running fresh verification commands and reviewing their output. The skill teaches a five-step workflow—identify what proves your claim, execute the full command, read the complete output, confirm it matches your assertion, and only then make the claim. It covers common scenarios like test passes, builds, linter checks, and bug fixes, each with specific evidence requirements.
This skill teaches the red-green-refactor cycle: write a failing test, verify it fails for the right reason, implement just enough code to pass, then refactor. Follow the iron law—no production code without a failing test first—and use this approach for all features, bug fixes, and refactoring work.
tdd guides you through writing tests before implementation using the red-green-refactor workflow. Each cycle commits a failing test marked red, then minimal passing code marked green, with refactoring only after all tests pass. The skill enforces behavioral testing over implementation details and includes commit hygiene checks to keep your tree lint-clean at every step.
This skill walks you through the test-first workflow: write a failing test, verify it fails correctly, implement just enough code to pass, then refactor while keeping tests green. You'll learn why test order matters, how to recognize when you're rationalizing shortcuts, and how to apply TDD to features, bug fixes, and refactoring across any language.
tdd guides you through strict test-driven development using the red-green-refactor cycle: write a failing test, implement minimal code to pass it, then refactor. The skill enforces the discipline of writing tests before production code and provides framework-specific commands for multiple languages.
Test Driven Development teaches the red-green-refactor discipline for writing code validated by tests before implementation. Learn when to apply TDD across feature work, bug fixes, and refactoring, plus how to design testable interfaces, mock at system boundaries, and avoid common pitfalls.
More skills laravel-tdd (MIT)