Use when writing new functions, adding features, fixing bugs, or refactoring by applying TDD principles - write failing tests before implementation code, make them pass, then refactor.
Limited to specific tools
Additional assets for this skill
This skill is limited to using the following tools:
name: test-driven-development description: Use when writing new functions, adding features, fixing bugs, or refactoring by applying TDD principles - write failing tests before implementation code, make them pass, then refactor. allowed-tools:
Red → Green → Refactor cycle for all code changes.
✅ Always use TDD for:
❌ Skip TDD for:
# Start with test
test "calculates total with tax" do
result = Calculator.calculate_total([100, 200])
assert Money.equal?(result, Money.new(:USD, 324))
end
# Run test - should FAIL
mix test
# Just enough to pass
def calculate_total(prices) do
prices |> Enum.sum() |> Kernel.*(1.08) |> Money.new(:USD)
end
Extract constants, improve naming, etc.
test/path/module_test.exsapps/api/test/your_app/task/task_test.exsComponentName.test.tsxmobile/libraries/atorasu/atoms/Button/Button.test.tsx# Backend
mix test path/to/test.exs
# Frontend
yarn test path/to/test.tsx