Add Tests That Match the Project's Existing Style

4 Views
0 Uses

Prompt

ChatGPT
Claude
Grok
OpenRouter
Add tests for {{CODE_TO_TEST}}.

Before writing any test, look at the existing test files near it and tell me, in a short list, the framework, the file naming and location, how tests are set up and torn down, the assertion style, and how the project handles mocks. Follow those conventions exactly and add no new test libraries.

Then identify the behaviours of {{CODE_TO_TEST}} that are not yet covered. List them, ordered by how likely they are to break: normal paths, error conditions, boundary values and unexpected inputs. Show me the list and the tests you propose to write, one line each, then write them.

Run the new tests and then the full test command {{TEST_COMMAND}}. If any new test fails, decide whether it has found a bug or the test is wrong, say which, and show the evidence. Do not change the code under test to make a test pass without asking me. Finish with the commands you ran and their output.

Customize this prompt

Fill in the variables below to personalize this prompt:

ChatGPT
Claude
Grok
OpenRouter

Report this prompt

Model Settings

Recommended Models

Claude

Temperature

0.7

Max Tokens

2000

Additional Notes

Best for: Closing test gaps without disturbing conventions

About this prompt

“Add Tests That Match the Project's Existing Style” is a free prompt for Claude in the Coding & Software category, 162 words long, added to The Prompt Index on November 18, 2026 by The Prompt Index. Copy it with the button above, paste it into Claude or any other AI chat assistant, and send it.

It has 2 placeholders to fill in first: {{CODE_TO_TEST}}, {{TEST_COMMAND}}. Use the “Customize this prompt” fields to personalise it before you copy.

Recommended models: Claude.

0 upvotes, sent to an AI tool 0 times, viewed 4 times.

Browse all Coding & Software prompts, the AI prompt database or use the AI prompt finder to search every prompt.