Claude

Claude Not Following Instructions — How to Fix It

Claude sometimes ignores specific formatting rules, skips parts of your prompt, or produces output that doesn't match what you asked for. This is one of the most common frustrations for both new and experienced Claude users. The good news is that a few simple prompt structure changes can dramatically improve instruction-following behavior.

?

Why does this error happen?

Claude processes your entire prompt as a single block of text and uses probabilistic reasoning to determine which parts to prioritize. When instructions are buried in long paragraphs, mixed with context, or written ambiguously, Claude may deprioritize them in favor of generating a fluent, natural-sounding response. Unlike rule-based systems, Claude does not parse instructions as hard commands — it infers intent. Complex or contradictory instructions, lack of explicit output format examples, and the absence of a system prompt all increase the chance that some instructions will be partially or fully ignored.

How to fix it

1

Use XML Tags to Structure Your Prompt

Wrap distinct sections of your prompt in descriptive XML tags such as <instructions>, <context>, and <task>. This creates clear boundaries that help Claude distinguish between background information and actionable directives. Claude is specifically trained to recognize and respect XML-style structure, making this one of the most effective techniques available.

2

Add Explicit Output Format Examples

Show Claude exactly what your expected output should look like by including a concrete example inside your prompt. For instance, if you want JSON output, paste a sample JSON block and label it as the desired format. Demonstrating the format is far more reliable than describing it in prose alone.

3

Use the System Prompt in the API for Persistent Instructions

If you are using the Claude API, move your formatting rules and behavioral instructions into the system prompt field rather than the human turn. The system prompt is given higher priority and persists across the conversation, making it ideal for constraints you want Claude to always follow. This prevents user messages from accidentally overriding your core instructions.

4

Break Complex Instructions into Numbered Steps

When you have multiple requirements, list them as a numbered or bulleted list rather than writing them as a paragraph. Numbered steps are easier for Claude to track and less likely to be partially skipped. Keep each instruction to a single, unambiguous action for best results.

Code example

// Better prompt structure using XML tags
const prompt = `
<instructions>
  Format output as JSON only.
  No preamble or explanation.
  Follow this exact schema: { "cities": [string] }
</instructions>
<task>List 5 cities in France</task>
`;

// Expected output from Claude:
// {
//   "cities": ["Paris", "Lyon", "Marseille", "Toulouse", "Nice"]
// }

Pro tip

Always place your most critical formatting or behavioral constraints at the very beginning of your prompt inside an <instructions> tag — Claude gives more weight to instructions that appear early and are visually separated from the rest of the content.

Frequently asked questions

Why does Claude follow instructions in short prompts but ignore them in long ones?
Longer prompts introduce more competing signals, making it harder for Claude to weigh all instructions equally. Using XML tags and numbered lists helps Claude maintain focus on your requirements regardless of prompt length.
Does repeating instructions at the end of the prompt help?
Yes, restating the most important constraint at the end of your prompt can reinforce compliance, especially for format rules like 'respond only in JSON.' This technique is sometimes called instruction sandwiching and works well for critical requirements.
Will Claude Pro follow instructions more reliably than the free version?
Claude Pro gives you access to more capable model versions that generally have better instruction-following performance and longer context windows. Upgrading also unlocks full API access, where system prompts can be used for the most consistent results.
Can I force Claude to never break character or format during a long conversation?
The most reliable way to maintain consistent behavior in a long conversation is to use the system prompt via the API and periodically remind Claude of the rules in your user messages. Claude's context window is finite, so very early instructions can fade in influence over many turns.

Upgrade to Claude Pro for better instruction-following and API system prompt access

Related Guides