From dev-practices
Guides TDD workflow with red-green-refactor cycle: plan interfaces, tracer bullet tests, minimal implementation to green, refactor under tests. For explicit TDD requests only.
npx claudepluginhub spences10/claude-code-toolkit --plugin dev-practicesThis skill uses the workspace's default tool permissions.
Drive implementation through tests using the red-green-refactor cycle.
Guides TDD with red-green-refactor loop using vertical slicing, integration tests through public interfaces, and avoiding implementation-coupled tests for features and bug fixes.
Enforces red-green-refactor TDD cycle for building features and fixing bugs test-first, combating horizontal slicing anti-pattern.
Enforces strict TDD workflow for feature implementation: write one failing test, minimal code to pass, refactor, repeat. Prevents writing full test suites upfront.
Share bugs, ideas, or general feedback.
Drive implementation through tests using the red-green-refactor cycle.
Adapted from Matt Pocock's TDD skill
Do not activate for general "write tests for X" or "add test coverage" requests. This skill is specifically for the TDD workflow where tests lead implementation.
Test behavior, not implementation. Every test should verify what the code does from the outside, not how it works inside. See deep-modules.md for the reasoning behind this.
Good tests act as a contract: they define what the module promises to its callers. If you can swap the internals completely and your tests still pass, they're testing the right thing.
Before writing any code, decide the public surface area:
Design for the caller, not the implementation. See interface-design.md.
Start with one test that exercises the simplest meaningful path through the feature. This test should:
RED: test exists, code does not
Run the test. Confirm it fails for the right reason (missing function, wrong return value — not a syntax error).
Write the minimum code to pass that one test. Do not write more than what the test demands. Hardcode return values if that's all it takes. The goal is a green test suite, not elegant code.
GREEN: test passes with minimal implementation
With the test passing, clean up. Remove duplication, improve names, extract helpers — but only while tests stay green. See refactoring.md.
REFACTOR: improve code quality, tests still pass
Add the next test. Pick the next simplest behavior that isn't covered. Follow the same cycle:
Build up complexity incrementally. Each cycle should take minutes, not hours.
After the core behavior works, add tests for:
Once all behavior is covered, do a final pass:
Use real dependencies when practical. Mock only at system boundaries — network calls, databases, file systems, clocks. See mocking.md for detailed guidance.
Write tests that are readable, independent, and fast. See tests.md for patterns on naming, structure, and assertion style.