For an overview of Claude Sonnet 4.5’s new capabilities, see What’s new in Claude Sonnet 4.5. For migration guidance from previous models, see Migrating to Claude 4.
General principles
Be explicit with your instructions
Claude 4 models respond well to clear, explicit instructions. Being specific about your desired output can help enhance results. Customers who desire the “above and beyond” behavior from previous Claude models might need to more explicitly request these behaviors with Claude 4.Example: Creating an analytics dashboard
Example: Creating an analytics dashboard
Less effective:More effective:
Add context to improve performance
Providing context or motivation behind your instructions, such as explaining to Claude why such behavior is important, can help Claude 4 models better understand your goals and deliver more targeted responses.Example: Formatting preferences
Example: Formatting preferences
Less effective:More effective:
Be vigilant with examples & details
Claude 4 models pay close attention to details and examples as part of their precise instruction following capabilities. Ensure that your examples align with the behaviors you want to encourage and minimize behaviors you want to avoid.Long-horizon reasoning and state tracking
Claude Sonnet 4.5 excels at long-horizon reasoning tasks with exceptional state tracking capabilities. It maintains orientation across extended sessions by focusing on incremental progress—making steady advances on a few things at a time rather than attempting everything at once. This capability especially emerges over multiple context windows or task iterations, where Claude can work on a complex task, save the state, and continue with a fresh context window.Context awareness and multi-window workflows
Claude Sonnet 4.5 features context awareness, enabling the model to track its remaining context window (i.e. “token budget”) throughout a conversation. This enables Claude to execute tasks and manage context more effectively by understanding how much space it has to work. Managing context limits: If you are using Claude in an agent harness that compacts context or allows saving context to external files (like in Claude Code), we suggest adding this information to your prompt so Claude can behave accordingly. Otherwise, Claude may sometimes naturally try to wrap up work as it approaches the context limit. Below is an example prompt:Sample prompt
Multi-context window workflows
For tasks spanning multiple context windows:- Use a different prompt for the very first context window: Use the first context window to set up a framework (write tests, create setup scripts), then use future context windows to iterate on a todo-list.
-
Have the model write tests in a structured format: Ask Claude to create tests before starting work and keep track of them in a structured format (e.g.,
tests.json
). This leads to better long-term ability to iterate. Remind Claude of the importance of tests: “It is unacceptable to remove or edit tests because this could lead to missing or buggy functionality.” -
Set up quality of life tools: Encourage Claude to create setup scripts (e.g.,
init.sh
) to gracefully start servers, run test suites, and linters. This prevents repeated work when continuing from a fresh context window. -
Starting fresh vs compacting: When a context window is cleared, consider starting with a brand new context window rather than using compaction. Sonnet 4.5 is extremely effective at discovering state from the local filesystem. In some cases, you may want to take advantage of this over compaction. Be prescriptive about how it should start:
- “Call pwd; you can only read and write files in this directory.”
- “Review progress.txt, tests.json, and the git logs.”
- “Manually run through a fundamental integration test before moving on to implementing new features.”
- Provide verification tools: As the length of autonomous tasks grows, Claude needs to verify correctness without continuous human feedback. Tools like Playwright MCP server or computer use capabilities for testing UIs are helpful.
- Encourage complete usage of context: Prompt Claude to efficiently complete components before moving on:
Sample prompt
State management best practices
- Use structured formats for state data: When tracking structured information (like test results or task status), use JSON or other structured formats to help Claude understand schema requirements
- Use unstructured text for progress notes: Freeform progress notes work well for tracking general progress and context
- Use git for state tracking: Git provides a log of what’s been done and checkpoints that can be restored. Claude Sonnet 4.5 performs especially well in using git to track state across multiple sessions.
- Emphasize incremental progress: Explicitly ask Claude to keep track of its progress and focus on incremental work
Example: State tracking
Example: State tracking
Communication style
Claude Sonnet 4.5 has a more concise and natural communication style compared to previous models:- More direct and grounded: Provides fact-based progress reports rather than self-celebratory updates
- More conversational: Slightly more fluent and colloquial, less machine-like
- Less verbose: May skip detailed summaries for efficiency unless prompted otherwise
Guidance for specific situations
Balance verbosity
Claude Sonnet 4.5 tends toward efficiency and may skip verbal summaries after tool calls, jumping directly to the next action. While this creates a streamlined workflow, you may prefer more visibility into its reasoning process. If you want Claude to provide updates as it works:Sample prompt
Tool usage patterns
Claude Sonnet 4.5 is trained for precise instruction following and benefits from explicit direction to use specific tools. If you say “can you suggest some changes,” it will sometimes provide suggestions rather than implementing them—even if making changes might be what you intended. For Claude to take action, be more explicit:Example: Explicit instructions
Example: Explicit instructions
Less effective (Claude will only suggest):More effective (Claude will make the changes):Or:
Sample prompt for proactive action
Sample prompt for conservative action
Control the format of responses
There are a few ways that we have found to be particularly effective in steering output formatting in Claude 4 models:-
Tell Claude what to do instead of what not to do
- Instead of: “Do not use markdown in your response”
- Try: “Your response should be composed of smoothly flowing prose paragraphs.”
-
Use XML format indicators
- Try: “Write the prose sections of your response in <smoothly_flowing_prose_paragraphs> tags.”
- Match your prompt style to the desired output The formatting style used in your prompt may influence Claude’s response style. If you are still experiencing steerability issues with output formatting, we recommend as best as you can matching your prompt style to your desired output style. For example, removing markdown from your prompt can reduce the volume of markdown in the output.
- Use detailed prompts for specific formatting preferences For more control over markdown and formatting usage, provide explicit guidance:
Sample prompt to minimize markdown
Research and information gathering
Claude Sonnet 4.5 demonstrates exceptional agentic search capabilities and can find and synthesize information from multiple sources effectively. For optimal research results:- Provide clear success criteria: Define what constitutes a successful answer to your research question
- Encourage source verification: Ask Claude to verify information across multiple sources
- For complex research tasks, use a structured approach:
Sample prompt for complex research
Subagent orchestration
Claude Sonnet 4.5 demonstrates significantly improved native subagent orchestration capabilities. The model can recognize when tasks would benefit from delegating work to specialized subagents and does so proactively without requiring explicit instruction. To take advantage of this behavior:- Ensure well-defined subagent tools: Have subagent tools available and described in tool definitions
- Let Claude orchestrate naturally: Claude will delegate appropriately without explicit instruction
- Adjust conservativeness if needed:
Sample prompt for conservative subagent usage
Model self-knowledge
If you would like Claude to identify itself correctly in your application or use specific API strings:Sample prompt for model identity
Sample prompt for model string
Leverage thinking & interleaved thinking capabilities
Claude 4 offers thinking capabilities that can be especially helpful for tasks involving reflection after tool use or complex multi-step reasoning. You can guide its initial or interleaved thinking for better results.Example prompt
For more information on thinking capabilities, see Extended thinking.
Document creation
Claude Sonnet 4.5 excels at creating presentations, animations, and visual documents. It matches or exceeds Claude Opus 4.1 in this domain, with impressive creative flair and stronger instruction following. The model produces polished, usable output on the first try in most cases. For best results with document creation:Sample prompt
Optimize parallel tool calling
Claude 4 models excel at parallel tool execution, with Sonnet 4.5 being particularly aggressive in firing off multiple operations simultaneously. The model will:- Run multiple speculative searches during research
- Read several files at once to build context faster
- Execute bash commands in parallel (which can even bottleneck system performance)
Sample prompt for maximum parallel efficiency
Sample prompt to reduce parallel execution
Reduce file creation in agentic coding
Claude 4 models may sometimes create new files for testing and iteration purposes, particularly when working with code. This approach allows Claude to use files, especially python scripts, as a ‘temporary scratchpad’ before saving its final output. Using temporary files can improve outcomes particularly for agentic coding use cases. If you’d prefer to minimize net new file creation, you can instruct Claude to clean up after itself:Sample prompt
Enhance visual and frontend code generation
Claude 4 models can generate high-quality, visually distinctive, functional user interfaces. However, without guidance, frontend code can default to generic patterns that lack visual interest. To elicit exceptional UI results:- Provide explicit encouragement for creativity:
Sample prompt
- Specify aesthetic direction and design constraints:
Sample prompt
- Encourage design diversity and fusion aesthetics:
Sample prompt
- Request specific features explicitly:
- “Include as many relevant features and interactions as possible”
- “Add animations and interactive elements”
- “Create a fully-featured implementation beyond the basics”
Avoid focusing on passing tests and hard-coding
Claude 4 models can sometimes focus too heavily on making tests pass at the expense of more general solutions, or may use workarounds like helper scripts for complex refactoring instead of using standard tools directly. To prevent this behavior and ensure robust, generalizable solutions:Sample prompt
Minimizing hallucinations in agentic coding
Claude 4 models are less prone to hallucinations and give more accurate, grounded, intelligent answers based on the code. To encourage this behavior even more and minimize hallucinations:Sample prompt
Migration considerations
When migrating from Sonnet 3.7 to Claude 4 (including Sonnet 4.5):- Be specific about desired behavior: Consider describing exactly what you’d like to see in the output.
- Frame your instructions with modifiers: Adding modifiers that encourage Claude to increase the quality and detail of its output can help better shape Claude’s performance. For example, instead of “Create an analytics dashboard”, use “Create an analytics dashboard. Include as many relevant features and interactions as possible. Go beyond the basics to create a fully-featured implementation.”
- Request specific features explicitly: Animations and interactive elements should be requested explicitly when desired.