Use when writing tests for bug fixes, parsers, state machines, business logic, or high-risk code. Not universal - skip for trivial edits, config changes, and UI-only work.
From mbscodenpx claudepluginhub mbstools/mbscodeThis skill uses the workspace's default tool permissions.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Searches prompts.chat for AI prompt templates by keyword or category, retrieves by ID with variable handling, and improves prompts via AI. Use for discovering or enhancing prompts.
Guides implementation of event-driven hooks in Claude Code plugins using prompt-based validation and bash commands for PreToolUse, Stop, and session events.
Write one failing test, make it pass with minimal code, refactor. One test at a time.
Skip for: Trivial edits, config changes, UI styling, documentation, dependency bumps.
Write the simplest test that fails for the right reason.
| Task Type | What "Minimal Failing Test" Means |
|---|---|
| Bug fix | Reproduce the exact bug. Test must fail with the same symptom the user reported. |
| Parser/transformer | One input → expected output. Start with the simplest valid input. |
| State machine | One state transition. Test the first transition in the happy path. |
| API endpoint | One request → expected response code + body shape. |
| Database migration | One record before → expected record after. |
| Validation logic | One valid input passes, one invalid input fails. Two tests minimum. |
Verify the test fails. Run it. Read the failure message. If it fails for the wrong reason (import error, missing file, syntax error), fix the test — you haven't started RED yet.
Write the least code that makes the failing test pass. No more.
Add the next test (next edge case, next state transition, next input type). Repeat RED → GREEN → REFACTOR until the feature/fix is complete.
Build up complexity incrementally:
Test one transition at a time:
Before considering tests "done":
| Thought | Reality |
|---|---|
| "I'll write tests after the implementation" | That's not TDD. Write the test first. |
| "This is too simple to test" | Simple code with tests stays simple. Simple code without tests becomes complex. |
| "I'll write all the tests first, then implement" | TDD is one test at a time. Write one, make it pass, then write the next. |
| "The test is obvious, I don't need to see it fail" | Run it. Seeing RED confirms your test actually tests something. |
| "I need to refactor first before I can test" | Write a characterization test for the current behavior first, then refactor. |
| "Edge cases can wait" | Edge cases found later cost 10x more. Add them during the cycle. |
Called by: mbscode:executing-plans, mbscode:subagent-driven-development (when plan steps include TDD patterns); mbscode:systematic-debugging Phase 4 (write failing test for the bug)
During: Works alongside the calling skill — TDD is an execution technique, not a separate phase. Return to the calling skill when tests pass.
Related: mbscode:writing-plans mandates TDD step patterns; mbscode:verification-before-completion requires the test evidence this skill produces.