Skip to content

Write AI coding prompts you can verify

Give an AI assistant a reproducible coding task, concrete constraints and acceptance criteria, then evaluate its answer with meaningful tests.

By DevToolPlace · Published October 5, 2026 · 2 min read

Describe the observable problem

Replace “fix my API” with a request, expected response and actual response. Include framework and runtime versions, a minimal code sample and steps to reproduce. Tell the assistant which behavior must remain compatible. A small complete example is more useful than a large repository dump with no clear goal.

Use a prompt with a testable finish

The prompt below asks for a specific behavior and makes the constraints reviewable. Use the prompt builder to adapt it for debugging, reviewing, refactoring or writing tests. The builder creates a template locally; it does not send the code to a model or generate an answer.

Task: Fix a JSON endpoint that returns HTML on validation failure.
Environment: PHP and Laravel; include exact installed versions.
Expected: An invalid email returns HTTP 422 with JSON field errors.
Actual: The request redirects and the client cannot parse the body.
Constraints: Preserve successful response fields. Add no dependency.
Acceptance: Cover valid, invalid and missing email requests.
Deliverable: Explain the cause, propose a patch and show verification.

Choose a model using your own task set

Model names, prices and limits change. Compare candidates using a small set of tasks from your codebase: a bug reproduction, a refactor, a review and a test-writing request. Score correctness, passing checks, unnecessary changes, latency and cost per accepted result. A model that writes fluent explanations can still produce incorrect code. Keep the same inputs and review criteria across candidates.

Keep context relevant and remove secrets

Include only code and data needed to understand the task. Replace credentials, bearer tokens and customer records with safe examples before sending a prompt to any external provider. Ask the assistant to state assumptions when files or dependencies are missing. If you compress JSON into another notation, verify that structure and types survive the conversion and that the receiver understands the format. Shorter text does not guarantee lower token usage or better accuracy.

Review and run the result

Inspect the patch for changed permissions, new network calls, broad exception handling and removed validation. Run the original reproduction and an appropriate regression check. For AI-generated tests, confirm the assertions describe the desired behavior rather than copying the implementation. Record the prompt and outcome so that later model comparisons use evidence from real work.

Reference documentation

Try the related tools with sample data

Build your coding prompt →

Found an error or a missing edge case? Send a reproducible example.