Structured prompt generator
Build prompts with role, context, instructions, format and constraints for ChatGPT, Claude, Gemini and any LLM. Templates for common use cases.
Generated prompt
How it works
A well-structured prompt can double the quality of an LLM's response without changing model. The most consistent technique is to split the prompt into marked sections: role (who the model should behave as), context (what information it needs to know), task (what exactly to do), format (how to respond) and constraints (what not to do). This separation helps the model prioritise information and reduces rambling or ignoring important details.
Why structured prompts work
LLMs have been trained on large amounts of hierarchically structured text: articles with sections, technical documentation with headings, emails with greeting-body-signature. When you present a prompt with Markdown headers or XML tags, the model recognises the pattern and gives more weight to each section. Claude and GPT-4o work especially well with XML sections (<role>, <context>, <task>), and both handle Markdown with ## headers nicely.
When to add examples (few-shot)
Examples are most effective when: (1) the task needs a specific non-obvious output format, (2) there are style or tone nuances hard to verbalise, (3) the model without examples fails on edge cases. Two or three well-chosen examples often beat three paragraphs of instructions. Caveat: examples consume input tokens, so for high-volume prompts consider prompt caching.
Frequently asked questions
The structured format works across the three, with nuances: Claude prefers XML tags, GPT-4o is fine with Markdown and JSON, and Gemini accepts any structure but benefits from explicit examples. This tool uses Markdown with headers because it's the most portable format.
Yes. Copy the output and paste it into the "system prompt" or "custom instructions" field of your platform. On OpenAI API it goes in the message with role: "system"; on Anthropic, in the Messages API "system" parameter.
Depends on the model and task. For simple tasks, clear plain-text instructions are enough. For complex tasks with multiple constraints, structured format with sections reduces errors. Try variations and measure with evals.
Related tools
Other calculators and tools related to this one.
This tool generates prompts following best practices published by OpenAI, Anthropic and Google. It doesn't guarantee that the model will always respond correctly: LLMs remain stochastic systems that can be wrong even with a perfect prompt. Combine with evals and human review for critical uses.
