Format inconsistency is one of the most common complaints from teams putting Claude into production: the same prompt returns a bulleted list on Monday and three paragraphs on Tuesday, or a clean table for short inputs and free-form prose once the input gets messy. The fix is rarely a better model — it is a prompt that treats format as an explicit requirement instead of a vibe. Anthropic's prompting best practices dedicate a whole section to controlling response format; this article distills the patterns that matter for enterprise use on any platform — Bedrock, Vertex AI, Foundry, or Claude Platform on AWS.
State the format as a contract, with a reason
The core guidance from Anthropic is to be clear and direct — treat Claude like a brilliant new employee who needs the output spec spelled out, and explicitly request behavior rather than implying it. Compare "summarize this report" with:
Summarize this report as:
- A one-sentence headline (no heading marker, plain text)
- Exactly 3 bullet points, each under 25 words
- One "Risks" line starting with "Risks: "
No introduction, no closing remarks, no markdown headers.
This summary is pasted directly into a dashboard cell, so any
extra formatting breaks the display.
The last sentence does real work. Anthropic's guidance stresses adding the why behind an instruction — for example, telling Claude output will be read aloud by a text-to-speech engine explains a "no ellipses" rule better than the rule alone — because Claude generalizes from the explanation to cases you didn't anticipate.
Show it, don't just describe it
For anything beyond trivial formats, examples beat descriptions. Anthropic recommends 3–5 relevant, diverse examples wrapped in <example> tags. For format control, diversity means varying the inputs while holding the output format rigid: a short input, a long one, an awkward edge case — all mapped to identically shaped outputs. That is precisely the lesson you want the model to draw. Structuring the whole prompt with XML tags (instructions, format spec, examples, and input in separate named sections) further improves reliability on complex prompts.
| Output target | Technique that carries the most weight |
|---|---|
| Prose for human readers | Tone and length instructions; "no headers/bullets" stated explicitly |
| Markdown for docs or chat UIs | One full skeleton example showing exact header levels and list style |
| Tables | Fixed column list in the prompt plus one filled-in example row |
| JSON for code | Prompt-only JSON patterns, or structured outputs for a hard guarantee |
Kill the preamble the modern way
A long-standing trick for format control was prefilling — starting the assistant turn yourself (say, with a | table character or an opening brace) so Claude had to continue in that shape. That door is closed: starting with the Claude 4.6 generation, prefilled assistant turns are no longer supported and such requests return a 400 error. Anthropic's documented migration path is exactly what you should use anyway: direct instructions like "Begin your response with the table header row; no preamble," or structured outputs when the format must be guaranteed rather than encouraged.
output_config structured outputs and get schema-valid JSON by construction.When prompting isn't enough
Prompted format compliance is strong but statistical. For machine-consumed output, the Messages API's structured outputs feature (output_config: {"format": {"type": "json_schema", …}}) enforces the shape at generation time; it is generally available on the Claude API, Claude Platform on AWS, Bedrock, and Vertex AI, with beta support on Foundry. The practical split: use prompt-level format control for documents, summaries, emails, and tables destined for humans; use structured outputs the moment a parser, not a person, is on the other end. The two aren't rivals — many production prompts spec a human-readable format and route a parallel extraction call through a schema.
Finally, measure it. Format drift across varied inputs is exactly the kind of failure an evaluation set catches cheaply: run your prompt across a few dozen representative inputs and diff the shapes, not just the substance. Anthropic's prompt-engineering overview lists empirical tests against clear success criteria as a prerequisite to prompt engineering, not a follow-up.
Where to go next
For length rather than shape, see controlling output length. For guaranteed JSON, read the structured outputs guide and extraction to JSON via prompt-only techniques.