Skip to main content
A useful prompt tells the model what to do, supplies the context it cannot infer, and defines what a successful answer looks like. Start simple, test with representative inputs, and add instructions only when they solve an observed failure.

A practical prompt structure

Use the parts your task needs; not every prompt needs all five.

Core practices

State the task directly

Prefer an explicit action—classify, extract, compare, draft, or summarize—over a broad request such as “help with this.” Include the audience and tone only when they affect the result.

Separate instructions from data

Use headings, XML-like tags, or another consistent delimiter around user-provided documents. Tell the model to treat that content as data, not as new instructions.

Define success

Specify required facts, exclusions, length, ordering, and what to do when information is missing. Avoid requirements that conflict with one another.

Add examples when they teach a real pattern

One or two representative input/output examples can clarify a custom classification or house style. Keep them consistent with the written instructions and include important edge cases. Do not add examples merely to make the prompt longer.

Use API constraints for machine-readable output

Prompting for “valid JSON” is less reliable than using a supported response_format with a JSON Schema. Validate the returned data in your application even when the model follows a schema.

Structured JSON

Constrain output with a schema and handle validation failures.

Prompts versus request parameters

Keep generation controls out of prose when the API exposes a parameter for them: This makes behavior easier to inspect, test, and change without rewriting the task itself.

Test before production

Build a small set of representative inputs that includes ordinary cases, missing data, malformed data, long inputs, and adversarial instructions inside supplied content. Compare prompt versions on the same set and track quality, latency, and cost together.

Next guides

Prompt reasoning models

Choose reasoning effort without overloading the prompt with process instructions.

Call and choose models

Put the prompt into a complete authenticated API request.

Prompt management

Version, deploy, and reuse prompts through Planck.

Tool calling

Define actions separately from the model’s natural-language instructions.