⚡ PromptLoot

Coding & Cursor Rules

Generate Unit Tests Prompt

Get thorough unit tests, including edge cases, for any function.

Write unit tests for this code using [pytest / vitest / jest]:

```
[PASTE CODE]
```

Requirements:
- Cover the happy path, edge cases (empty, zero, negative, very large, unicode), and error cases.
- One behavior per test. Test names describe the behavior, e.g. test_returns_empty_list_when_no_matches.
- Mock only external I/O (network, disk, time). Do not mock the code under test.
- After the tests, list any behavior that seems like a bug or is ambiguous.

How to use it

  1. Click Copy template.
  2. Paste into ChatGPT, Claude, Grok, Cursor, or your agent framework.
  3. Replace the [BRACKETED] parts with your details.
Sponsor this page · Reach builders who use AI daily. Get details

FAQ

What framework should I pick?

Use whatever your project already uses. pytest for Python, vitest for Vite projects.

Why list ambiguous behavior?

Writing tests often exposes bugs; this makes the AI tell you instead of hiding them.

Get 3 new templates every week

Free. Unsubscribe anytime.

Related templates

Cursor Rules for Next.js + TypeScript

A .cursorrules file that keeps Cursor writing clean, typed Next.js App Router code.

Cursor Rules for Python Projects

Rules that make AI editors write typed, tested, modern Python.

Vibe Coding Project Kickoff Prompt

Turn a fuzzy app idea into a scoped plan before the AI writes any code.
PromptLoot Pro Pack · 200+ advanced templates, agent workflows, and Cursor rules bundles. Coming soon