/tdd:tddfrom tdd
Test-driven development with red-green-refactor loop. Use when user wants to build features or fix bugs using TDD, mentions "red-green-refactor", wants integration tests, or asks for test-first development.
Ships in tdd. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Core principle: Tests should verify behavior through public interfaces, not implementation details. Code can change entirely; tests shouldn't.
Good tests are integration-style: they exercise real code paths through public APIs. They describe what the system does, not how it does it. A good test reads like a specification - "user can checkout with valid cart" tells you exactly what capability exists. These tests survive refactors because they don't care about internal structure.
Bad tests are coupled to implementation. They mock internal collaborators, test private methods, or verify through external means (like querying a database directly instead of using the interface). The warning sign: your test breaks when you refactor, but behavior hasn't changed. If you rename an internal function and tests fail, those tests were testing implementation, not behavior.
Before starting, detect the project's test runner by reading package.json, pyproject.toml, Cargo.toml, go.mod, or similar config files. Use Bash to run tests:
npm test, npx jest, npx vitest run, or npx mochapytest, python -m pytestgo test ./...cargo test./gradlew test or mvn testbundle exec rspecIf uncertain, check package.json scripts or the project README. Always confirm a test command works before starting the RED-GREEN loop.
RED = run test, see it fail with the expected failure (not a compile error or wrong failure). GREEN = run test, see it pass.
DO NOT write all tests first, then all implementation. This is "horizontal slicing" - treating RED as "write all tests" and GREEN as "write all code."
This produces crap tests:
Correct approach: Vertical slices via tracer bullets. One test → one implementation → repeat. Each test responds to what you learned from the previous cycle. Because you just wrote the code, you know exactly what behavior matters and how to verify it.
WRONG (horizontal):
RED: test1, test2, test3, test4, test5
GREEN: impl1, impl2, impl3, impl4, impl5
RIGHT (vertical):
RED→GREEN: test1→impl1
RED→GREEN: test2→impl2
RED→GREEN: test3→impl3
...
When exploring the codebase, use the project's domain glossary so that test names and interface vocabulary match the project's language, and respect ADRs in the area you're touching.
Before writing any code:
run tests command worksAsk: "What should the public interface look like? Which behaviors are most important to test?"
You can't test everything. Confirm with the user exactly which behaviors matter most. Focus testing effort on critical paths and complex logic, not every possible edge case.
The behavior list produced here drives Steps 2 and 3. Each item is checked off as it reaches GREEN.
Take behavior #1 from the planning list. Write ONE test that confirms it:
RED: Write test → run tests → confirm failure message matches expected behavior
GREEN: Write minimal code → run tests → confirm pass
This is your tracer bullet - proves the path works end-to-end.
For each remaining behavior in the planning list (in order):
RED: Write test → run tests → confirm RED
GREEN: Minimal code to pass → run tests → confirm GREEN
Check off this behavior from the list
Rules:
Loop ends when all behaviors from the planning list are checked off and GREEN.
After all behaviors pass, look for refactor candidates:
Never refactor while RED. Get to GREEN first.
Done when: all planned behaviors are GREEN and tests still pass after refactor.
[ ] Test describes behavior, not implementation
[ ] Test uses public interface only
[ ] Test would survive internal refactor
[ ] RED confirmed by actually running the test (not assumed)
[ ] Code is minimal for this test
[ ] GREEN confirmed by actually running the test
[ ] No speculative features added
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub tunoc2c/workbuddy-skill-official --plugin tdd