Write tests for a feature
By VibeCoderHQ|Published on 7/3/2026
PromptingAICursor
Get a real safety net so AI-driven changes stop silently breaking things that used to work. Best in Cursor or Claude Code that can run the suite and confirm it passes. The read-and-explain-first step catches cases where the code is wrong, so you do not lock in a bug by writing a test that asserts the broken behavior.
Prompt Text
Write tests for [THIS FEATURE / FILE / FUNCTION]. My test setup is [Vitest / Jest / Playwright / none yet, pick a sensible default for my stack].
Before writing tests:
1. Read the code and tell me in plain English what it is supposed to do, and list the behaviors worth testing.
2. Point out any behavior that is unclear or looks like a bug. Do not test a bug as if it were correct behavior. Ask me if unsure.
Then write tests that cover:
- The normal happy path.
- Edge cases: empty input, missing or null values, very large input, and boundary numbers.
- Error cases: bad input, failed network or database calls, and unauthorized access where relevant.
Rules:
- Test behavior and outcomes, not internal implementation details, so the tests do not break every time I refactor.
- Give each test a clear name that states what it checks.
- Mock external services (network, database, payment) so tests run fast and offline.
- If the code is hard to test, tell me what small change would make it testable.
After writing, tell me the exact command to run them, and confirm they pass.Join the Vibe Coder Community
Get weekly updates on new prompts, tools, and success stories to help monetize your AI development skills.
Reviews
No reviews yet. Be the first to review!