From workflow-toolkit
This skill should be used when the user asks to "use TDD", "write tests first", "red-green-refactor", "test-driven development", "build this with tests", "fix this bug with TDD", or wants to implement features or fix bugs using a test-first approach.
How this skill is triggered — by the user, by Claude, or both
Slash command
/workflow-toolkit:tdd*.ts*.tsx*.js*.jsxThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Implement features and fix bugs using the red-green-refactor loop. Write one test, make it pass, repeat. Never write all tests first — work in vertical slices.
Implement features and fix bugs using the red-green-refactor loop. Write one test, make it pass, repeat. Never write all tests first — work in vertical slices.
Tests verify behavior through public interfaces, not implementation details. Code can change entirely; tests should not break unless behavior changes. A good test reads like a specification — "user can checkout with valid cart" tells you exactly what capability exists.
See references/tests.md for good vs bad test examples and references/mocking.md for mocking guidelines.
Never write all tests first, then all implementation. This produces tests that verify imagined behavior instead of actual behavior.
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
Each test responds to what was learned from the previous cycle.
Before writing any code:
references/deep-modules.md)references/interface-design.md)Ask: "What should the public interface look like? Which behaviors are most important to test?"
Not everything can be tested. Focus testing effort on critical paths and complex logic, not every possible edge case.
Write ONE test that confirms ONE thing about the system:
RED: Write test for first behavior → test fails
GREEN: Write minimal code to pass → test passes
This proves the path works end-to-end.
For each remaining behavior:
RED: Write next test → fails
GREEN: Minimal code to pass → passes
Rules:
After all tests pass, look for refactor candidates (see references/refactoring.md):
Never refactor while RED. Get to GREEN first.
Once the feature is implemented and tests pass, suggest: "When the codebase has grown enough to warrant it, ask me to improve the architecture to find deepening opportunities."
references/tests.md — Good vs bad test examples with codereferences/mocking.md — When to mock and designing for mockabilityreferences/deep-modules.md — Deep vs shallow module designreferences/interface-design.md — Interface design for testabilityreferences/refactoring.md — Refactor candidates after the TDD cyclenpx claudepluginhub pau-vega/ai-devkitGuides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.