Advanced
Choose what Claude sees, and design tools it can pick and use correctly.
Context engineering
Choose what goes in front of Claude, put it in the right order, trim what doesn't change the answer, and carry state across sessions with a file.
4 techniques →-
What Is Context Engineering, and How Do You Do It in Claude? Context engineering means choosing what's in front of Claude when it answers: instructions, files, history, tool definitions and tool results. Level 4: Multi-tool systems1M-token window
- System prompt
- Messages
- Tool results
- Images and documents
- Tool definitions
- Output, including thinking
-
How Do You Give Claude Memory Across a Long Project? Keep a short file with what's done, what's next and what was decided, and have each session read it first and update it last. Level 4: Multi-tool systems
- 1Read the progress notes
- 2Do one feature
- 3Verify it end to end
- 4Update the notes
The next session starts here -
Where Should Important Context Go in a Claude Prompt? With long inputs, put the documents at the top of the prompt and your question at the end. Level 4: Multi-tool systems
- 1Long documents, in tagstop
- 2Instructions and examplesafter the data
- 3Your specific questionlast
-
How Do You Trim Context Without Hurting Claude's Answer? For each thing in your prompt, ask whether the answer would change without it. Level 4: Multi-tool systemsCutno change in the answer
- old tool output
- pleasantries and history
- unused fields in data
Keepthe answer depends on it- constraints and numbers
- the audience
- the section being asked about
Tool use
Write clear tool descriptions, keep the tool list short, report errors Claude can act on, and get JSON that matches a schema.
4 techniques →-
How Do You Write Tool Descriptions Claude Can Use? Write each description as you'd brief a new hire: what the tool does, when to use it and when not to, what each parameter means, and what it won't return. Level 4: Multi-tool systemsToo thinleaves questions open
- "Gets the stock price"
- no parameter description
- silent on what it won't return
A real briefat least 3 to 4 sentences- what it does and returns
- when to use it, and when not
- what each parameter means
-
How Many Tools Should You Give Claude? Give Claude as few tools as cover the job, with clearly separate purposes. Level 4: Multi-tool systems
- ~55ktokens in tool definitionsfive servers, before any work
- 85%+typical cut with tool search
- 30 to 50tools before selection degrades
- 3 to 5tools loaded for a request
-
How Should Tools Report Errors to Claude? Return the failure as a tool_result with is_error: true, and say what went wrong and what Claude should try next. Level 4: Multi-tool systemsDo
- Set is_error: true
- Say what went wrong
- Say what to try next
Don't- Return only "failed"
- Send a raw stack trace
- Send an empty success
-
How Do You Get Reliable JSON From Claude? On the API, set output_config.format with a JSON schema for the response, or strict: true on a tool for its inputs. Level 4: Multi-tool systemsOld tricks400 on current models
- prefilling the response with {
- forced tool_choice on current models
Use todayschema enforced- output_config.format for answers
- strict: true for tool inputs
How well do you manage context and tools in Claude?
Six questions for people building on Claude, on what to include, how to design tools and how to get reliable output. You get instant answers, and no sign-up is needed.
Who this is for
These lessons are mostly for people building on the API or running long Claude Code sessions, though the context lesson also applies in chat. They cover the two things you control once your prompts are already good: what's in front of Claude when it answers, and what it can do.
Why they belong together
Tool definitions and tool results count as context, so the two topics overlap. A long tool list uses up tokens before any work starts, and a tool that returns a full database record fills the context with fields no step needs. If an agent is getting worse as you add to it, look at both before changing the prompt.
What is context engineering?
It's the practice of choosing what's in front of a model when it answers, including instructions, documents, history, tools and tool results. Anthropic describes the goal as the smallest possible set of high-signal tokens that makes the result you want most likely.
What is tool use in Claude?
Tool use lets Claude call functions you define. Claude returns a request with a tool name and inputs, your code runs it, and you send back the result. Anthropic also offers server tools, such as web search, that run on its side.
Do I need the API to use these techniques?
Not all of them. Choosing what to paste, and where to put it, works in chat. Tool design and structured outputs apply on the API, and when you build MCP servers. Claude Code handles many context decisions for you, but still benefits from a short CLAUDE.md.
How big is Claude's context window?
Anthropic's docs say current models have a 1M-token context window on the API. In chat on paid plans, the help center says most current models offer 1M tokens, some 500K and older ones 200K. Anthropic also warns that more context isn't automatically better.