Code prompts
Code prompt

Drive implementation from tests (TDD with AI)

When you want a clear definition of done before any implementation exists.

Works best in: Claude

We're going to TDD {{feature: e.g. the password reset flow}}. Follow this order strictly.

Step 1 — Write the tests first.
- Cover the happy path
- Cover the obvious edge cases (empty input, malformed input, expired tokens, race conditions, permission errors)
- Cover the not-obvious edge cases you'd think of as a senior engineer
- Do NOT write any implementation yet. The tests should fail because the implementation doesn't exist.

Step 2 — Show me the tests. Wait for me to approve them or ask for additions.

Step 3 — Implement the feature, then run the tests. If anything fails, fix the implementation (not the test) and re-run. Repeat until green.

Step 4 — Report what you implemented, which tests pass, and any edge case you decided was out of scope (and why).

Hard rule: never weaken a test to make it pass. If a test seems wrong, stop and ask.
·Open in·Share
tddtestingai-agents

More code prompts

All code prompts

Go deeper