increase-consistency changedtest-and-evaluate/strengthen-guardrails/increase-consistency
Nearest release: v2.1.312, published under an hour before this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.
Recorded here
Lines+7added
Lines−7removed
From line
12
where the diff opens
First seen
14 Aug 2026
this site's first read of the page
Recorded edits4to this page, all time
## Prefill Claude’s response ## Prefill Claude's response
The whole hunk
from line 12, old and new numbered
/
from line 12
1212 The techniques below are useful for general output consistency or when you need flexibility beyond strict JSON schemas.
1313</Tip>
1414
15Here's how to make Claude's responses more consistent:
15Here’s how to make Claude’s responses more consistent:
1616
1717## Specify the output format you want
1818
from line 55
5555 ```
5656</Accordion>
5757
58## Prefill Claude's response
58## Prefill Claude’s response
5959
6060<Note>
6161 Prefilling is not supported on Claude 4.6 and later models and
from line 69
6969 on models that support it, or system prompt instructions, instead.
7070</Note>
7171
72Prefill the `Assistant` turn with the format you want. This trick bypasses Claude's friendly preamble and enforces your structure.
72Prefill the `Assistant` turn with the format you want. This trick bypasses Claude’s friendly preamble and enforces your structure.
7373
7474<Accordion title="Example: Daily sales report">
7575 ```text User wrap
from line 249
249249
250250## Use retrieval for contextual consistency
251251
252For tasks requiring consistent context (for example, chatbots, knowledge bases), use retrieval to ground Claude's responses in a fixed information set.
252For tasks requiring consistent context (for example, chatbots, knowledge bases), use retrieval to ground Claude’s responses in a fixed information set.
253253
254254<Accordion title="Example: Enhancing IT support consistency">
255255 ```text User wrap
from line 322
322322
323323For role-based applications, maintaining consistent character requires deliberate prompting.
324324
325* **Use system prompts to set the role:** Use [system prompts](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices#give-claude-a-role) to define Claude's role and personality. This sets a strong foundation for consistent responses.
325* **Use system prompts to set the role:** Use [system prompts](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices#give-claude-a-role) to define Claude’s role and personality. This sets a strong foundation for consistent responses.
326326 <Tip>
327 When setting up the character, provide detailed information about the personality, background, and any specific traits or quirks. This helps the model better emulate and generalize the character's traits.
327 When setting up the character, provide detailed information about the personality, background, and any specific traits or quirks. This helps the model better emulate and generalize the character’s traits.
328328 </Tip>
329* **Prepare Claude for possible scenarios:** Provide a list of common scenarios and expected responses in your prompts. This "trains" Claude to handle diverse situations without breaking character.
329* **Prepare Claude for possible scenarios:** Provide a list of common scenarios and expected responses in your prompts. This “trains” Claude to handle diverse situations without breaking character.
330330
331331<Accordion title="Example: Enterprise chatbot for role prompting">
332332 ```text System wrap
No line in this hunk matches that.