In the pack: ChatGPT, Claude & Gemini Prompts for Coding and Developers
Tests-First Implementation From a Spec
Prompt
Spec or acceptance criteria: {{SPEC}}
Test framework and conventions: {{TEST_FRAMEWORK}}
Existing code it must fit into (signatures, types, nearby modules): {{EXISTING_CODE}}
Work in this order:
1. Restate the behavior as a numbered list of test cases: the happy path, boundaries, invalid input, and failure of dependencies. Ask me about any behavior the spec leaves ambiguous before writing code, or state the assumption you're making.
2. Write the tests first, complete and runnable, with clear names that describe behavior.
3. Explain which tests would fail against an empty implementation, and why.
4. Write the simplest implementation that makes the tests pass. No speculative features, no new dependencies.
5. Refactor once for clarity, keeping the tests unchanged.
6. List what the tests do not cover and why.
Use only APIs that exist in the standard library or the code I pasted. If you need something else, stop and ask. I will run the tests myself; mark anything you're unsure would pass.
Customize this prompt
Fill in the variables below to personalize this prompt:
Model Settings
Recommended Models
Temperature
Max Tokens
Additional Notes
About this prompt
“Tests-First Implementation From a Spec” is a free prompt for ChatGPT in the Coding & Software category, 180 words long, added to The Prompt Index on October 28, 2026 by The Prompt Index. Copy it with the button above, paste it into ChatGPT or any other AI chat assistant, and send it.
It has 4 placeholders to fill in first:
{{LANGUAGE}}, {{SPEC}}, {{TEST_FRAMEWORK}}, {{EXISTING_CODE}}.
Use the “Customize this prompt” fields to personalise it before you copy.
Recommended models: ChatGPT, Claude, Gemini.
0 upvotes, sent to an AI tool 0 times, viewed 2 times.
Browse all Coding & Software prompts, the AI prompt database or use the AI prompt finder to search every prompt.