Vibedia.
All vendors

Show only the vendors you work with. This applies to every page, and is remembered.

Prompts

Write tests for code that already works

For Claude Code, Cursor, an IDE assistant.

The prompt

Write tests for the code below. It currently works; I want to keep it that way.

<code>
{{CODE}}
</code>

Rules:
- Test the behaviour, not the implementation. If I refactor the inside, the tests should pass.
- One test per behaviour, named so a failure tells me what broke without opening the file.
- Cover the edge cases that look deliberate in this code — empty input, the boundary values,
  the error path.
- Do not test getters, or that a constructor assigns its arguments.
- If you cannot tell what some behaviour is for, list it as a question instead of guessing.

What to fill in

PlaceholderWhat goes there
{{CODE}}the module and its exports

Why it works

The last rule is the valuable one. Asked to test code it does not understand, a model writes a test asserting whatever the code currently does, which locks in bugs as expected behaviour. Asking it to flag the parts it cannot explain surfaces them instead.

ShareOpen LinkedIn