← All guides
Prompts By Editorial · Skillaisle ([email protected]) · Published Oct 18, 2026 · Steps checked against official docs on Oct 18, 2026

How to write a reusable prompt with variables

Turn a one-off prompt into a template you can reuse, with clearly marked variables, a fixed structure, examples and a quick test routine.

A reusable prompt has two parts: instructions that stay the same every time, and variables you fill in for each use. Keeping them apart makes the prompt easier to reuse, test and improve. The advice below comes from Anthropic’s and OpenAI’s prompting guides, linked at the end.

1. Write the fixed part first

Be clear and direct. Anthropic’s guide suggests imagining a brilliant new colleague with no context: if they would be confused by your prompt, the model will be too. Say what the output should look like and what constraints apply. Use numbered steps when order or completeness matters.

Explain why, not just what. “Your answer will be read aloud, so don’t use ellipses” works better than “NEVER use ellipses”, because the model can generalize from the reason.

Say what to do rather than what not to do. “Write in flowing prose paragraphs” steers better than “Don’t use Markdown”.

2. Mark the variables clearly

Pick one placeholder style and stick to it. Double curly braces are common, and Anthropic’s examples use them:

{{supplier_name}}  {{product}}  {{destination_market}}

Use names that explain themselves, and keep a short table next to the prompt with what each one means and an example value. If you fill them in by hand, that table is what stops mistakes.

3. Separate instructions from inputs

When a prompt mixes instructions, context, examples and variable inputs, wrap each part in its own tag or section. Anthropic recommends XML tags such as <instructions> and <document>; OpenAI’s guide shows Markdown headings like # Identity, # Instructions and # Examples. Either works if you stay consistent.

For long inputs, such as a whole document, put the input near the top and your question or instructions after it. Anthropic reports this improves results on long, multi-document inputs.

4. Add a few examples

Examples are one of the most reliable ways to steer format and tone. Anthropic suggests 3 to 5 examples that mirror your real use case and vary enough to cover edge cases, each wrapped in <example> tags so the model can tell them apart from the instructions.

A template you can copy

<instructions>
You are a sourcing assistant for a small importer. Write a checklist of
questions to send to a new supplier before the first order.
Group the questions under clear headings. After each question, note what a
good answer looks like and what would be a red flag.
Do not invent registration numbers or certificate numbers.
</instructions>

<inputs>
Supplier: {{supplier_name}}
Product: {{product}}
Destination market: {{destination_market}}
</inputs>

The fixed part is at the top and the variables come last. OpenAI’s guide notes that keeping static content first and dynamic content later helps prompt caching, because cache hits depend on an exact matching prefix.

5. Test before you rely on it

Run the template on a few real inputs, including awkward ones, and read the output against what you wanted. When you change the prompt, run the same inputs again and compare. Keep each version, so you can go back if a change makes things worse.

If you use prompts in code

OpenAI is deprecating its reusable prompt objects in the API: creation is de-emphasized from June 3, 2026, and v1/prompts is scheduled to shut down on November 30, 2026. OpenAI now recommends keeping prompts in your own code, replacing variables with typed function parameters, and reviewing prompt changes like any other code change, with tests.

See this in practice with our free Supplier Verification Question Set prompt.

Sources

Products change. If a step no longer matches what you see, the official page above is the reference.

Related on Skillaisle