LEARN 116 words
Write A Prompt That Forces Structured Output Every Time
Ask the same question twice and get a bullet list once, a wall of prose the next time, and a missing section the third: that inconsistency makes automation unreliable. This locks down a schema, forces the model to fill gaps with a stated placeholder rather than dropping sections, and anchors it with a worked example. Suits anyone building prompts that feed into another process.
<context>
You keep getting inconsistent formatting back from a model when you ask for {OUTPUT_TYPE}, sometimes a list, sometimes prose, sometimes missing a section you needed.
</context>
<task>
**Design a prompt that guarantees consistent structured output:**
1. Define the exact output schema (sections, order, and what each must contain)
2. Write an explicit instruction telling the model to follow the schema even if the input is sparse, filling gaps with a stated placeholder rather than omitting sections
3. Add one worked example of the schema filled in, to anchor the format
4. Write the final reusable prompt in full
</task>
<output_format>
- The schema definition
- The worked example
- The final prompt template in a single block
</output_format> ⚠ human-in-the-loop: you are responsible for the results of using this prompt, not us.