Task prompt · Coding
Write tests for a file
by Agent Yard TeamAdds meaningful unit tests that cover edge cases, not just the happy path.
Use cases
- Adds meaningful unit tests that cover edge cases, not just the happy path.
- When you already have a file and want the AI to work from it instead of starting from scratch.
- Reuse it as often as you like: fill in the blanks (test framework) with new details and copy again.
- With Cursor, Claude Code, Codex and more, the AIs that support what this prompt needs.
Featured in: Best Claude prompts for coding, Best Claude prompts for essays and writing, Best Claude prompts for code review and debugging.
How to use it
- Open Cursor or Claude Code in your terminal (or another AI listed here).
- Attach the file (PDF, Word, CSV or Excel), or paste its text into the prompt.
- Fill in the highlighted blank ([TEST FRAMEWORK]) below, or edit them after pasting.
- Copy the prompt, paste it into the chat and send.
Fill in the blanks (optional)
Prompt
Write tests for the attached file using [TEST FRAMEWORK]. - First list the behaviors worth testing, including edge cases, errors and boundary values. - Then write the tests: clear names that describe behavior, arrange-act-assert, no testing of private internals. - Mock only external services (network, time, randomness). - Point out any code that is hard to test and suggest a small refactor.
One email a week
The Weekly is presented byyour brandSponsored · openThe best new prompts and personas, nothing else.