Text & chat prompt
Write unit tests for your code
Write unit tests for your code: a free, copy-paste prompt for Claude, ChatGPT and Gemini. Paste the prompt and replace each [BRACKETED] field with your own details.
The prompt
Act as a senior engineer. Write thorough unit tests for this [LANGUAGE / FRAMEWORK, e.g. Python with pytest] code: [PASTE YOUR CODE] Cover normal cases, edge cases (empty, null, very large, and invalid input), and error handling. Use clear test names that describe the behaviour. Point out any bug you find while writing the tests, and explain how to run them.
Pro tip: Run the tests yourself — if one fails, paste the output back and ask why.
How to use this prompt
- Open Claude and start a new chat.
- Paste the prompt.
- Replace each [BRACKETED] field with your real details and paste in your own text where asked.
- Reply with follow-ups such as "make it shorter" or "make it sound more like me".
Prompt at a glance
- Category
- Text & chat
- Works with
- Claude · ChatGPT · Gemini
- Length
- 61 words
- Fields to fill in
- LANGUAGE / FRAMEWORK, PASTE YOUR CODE
- Last updated
Frequently asked questions
Which AI tools work with this prompt?
It is written for Claude, ChatGPT and Gemini. Paste it into your preferred tool and adjust the wording if the result is off.
What do I need to fill in?
Replace these fields before you send it: LANGUAGE / FRAMEWORK, PASTE YOUR CODE. Each field shows an example in the prompt.
Should I paste private information into the prompt?
Only what the task needs. Remove names, contact details and other sensitive data before pasting a resume or document into any AI tool.