Workflow

Add tests to a feature that already works

Lock in working behaviour so the next AI edit can't silently break it.

The promptPaste into Cursor, Claude Code, Codex, Lovable, Bolt, Replit or v0
Add tests for [FEATURE / FILE] without changing its behaviour.

1. Detect the existing test setup (Vitest, Jest, Playwright, pytest...). If none exists, propose the lightest option and wait for my OK.
2. Write tests for: the happy path, empty/invalid input, and one error from external services (mock the network).
3. Prefer testing behaviour through the public function or the UI, not internal details.
4. Run the tests and show me the output. If a test reveals a real bug, report it. Don't change the app code to make the test pass without asking.

Tips

  • Add an npm test step to your deploy pipeline once these pass.

Works with: Cursor, Claude Code, Codex, Replit, Lovable, Bolt, v0. Last reviewed 2026-11-13.

← All prompts · Something broke? Fix library