Workflows

Write tests first

Use Claude to help with a test-driven development flow.

Goal

Write tests that define the intended behavior before writing the implementation.

Outcome: A test suite that locks in expected behavior and guides the implementation.

RefactorSafety
Intermediate

Steps

1

Describe what you want to build

Tell Claude the function or feature goal in plain terms.

claude "I need a function that validates email addresses — write tests for it before I write the implementation"
2

Review and adjust the tests

Make sure the tests match your actual requirements.

  • ·Add edge cases Claude missed. Remove cases that do not apply.
3

Ask Claude to implement to pass the tests

Use the tests as the spec.

claude "now implement the function so all these tests pass"
4

Run the tests

Verify the implementation is correct.

!npm test

Commands used