In short.
Modifying system prompts is a guide for developers shaping Claude Agent SDK behavior, with the main catch that replacing the coding preset makes developers responsible for supplying the guidance their agents still need. It distinguishes the minimal SDK default from the Claude Code preset, explains four customization approaches, and documents context injected outside the system prompt. Its most consequential details concern project settings, provider-dependent caching and prompt changes that may not reach a resumed session immediately. The examples were not executed, and practical reliability, safety and cost savings are not assessed.
Researched and written by an AI model and checked by a second AI model. How it works
Coverage includes the complete supplied page at [https://code.claude.com/docs/en/agent-sdk/modifying-system-prompts.md], including its examples, comparison tables and notices about defaults, output styles, caching, session recording and injected context. The documentation index and all linked pages are excluded. Package implementations, complete installation and authentication requirements, licenses, pricing and runtime outcomes are not established. No examples were executed, and no safety, reliability or cache-performance results were measured.
The overview
Resource identity
The resource is the Claude Code documentation page titled Modifying system prompts at [https://code.claude.com/docs/en/agent-sdk/modifying-system-prompts.md]. It teaches configuration of the Claude Agent SDK rather than supplying a standalone agent or a ready-made prompt package.
Its examples use @anthropic-ai/claude-agent-sdk in TypeScript and claude_agent_sdk in Python. The central decision is whether to keep the Claude Code coding-agent prompt, extend it, or provide a replacement.
Practical assessment
The guide is useful when an agent behaves differently from the Claude Code CLI or when developers need to understand which instructions their application actually supplies. Its clearest warning is that omitting systemPrompt in TypeScript or system_prompt in Python uses a minimal tool-calling prompt, whereas claude -p uses the Claude Code prompt by default.
The page provides configuration examples and explains consequential exceptions rather than promising that a prompt alone will produce reliable behavior. It does not provide executed results, comparative evaluations or measured safety outcomes.
Who it suits
Developers building terminal or IDE-like coding assistants can use the claude_code preset when a person watches and steers the work. Teams adding coding standards, domain context or response requirements can extend that preset with append.
Developers building support bots, research agents, structured-output applications or agents with different identities and permission models are directed toward custom prompts. The page also says unattended coding tasks such as CI lint fixes and diff reviews can still suit the preset because their work remains software engineering.
Beginners receive a decision table and parallel language examples. Experienced developers receive details about cache boundaries, session recording, inherited settings and application-added context.
What the guide covers
Four customization approaches receive direct treatment. CLAUDE.md supplies persistent project context without changing the system prompt. Output styles save reusable role, tone and formatting instructions. The preset's append field adds instructions to its existing prompt. A custom system prompt supplies a replacement.
The approaches can be combined. For example, a saved code-review output style can establish a recurring role while append adds session-specific priorities such as OAuth and token storage.
The page also covers sharing preset cache entries across machines, separating static and changing parts of custom prompts, large Python prompts, changing instructions during resumed sessions, suppressing conflicting built-in context and inspecting outgoing requests.
Using it
Requirements and compatibility
The examples assume an application using the TypeScript or Python Agent SDK and its query interface. The page does not establish a complete installation procedure, authentication requirements, account eligibility or general operating-system support.
The documented minimum versions for excluding dynamic preset sections are @anthropic-ai/claude-agent-sdk v0.2.98 and claude-agent-sdk v0.1.58. The snapshot field requires TypeScript SDK v0.3.257 or Python SDK v0.2.153 or later.
Several CLI features have separate requirements: /output-style requires Claude Code v2.1.269, a custom-prompt boundary line requires v2.1.275, and CLAUDE_CODE_DISABLE_FILE_MENTIONS requires v2.1.299. These are feature-specific thresholds reported by the page, not confirmation of compatibility with any installed environment.
How instructions reach the agent
The SDK offers three system-prompt starting points. Its minimal default supports tool calling but omits the rest of the Claude Code preset, including its security and safety instructions. The claude_code preset includes that guidance. A custom string replaces the system prompt with the supplied text.
Replacing the system prompt does not remove all application context. CLAUDE.md content, output-style instructions, hook context and other reminders can still enter the conversation separately. The page recommends explaining application-added reminders in a custom prompt so their origin is clear.
Preset cache reuse can be disrupted by an embedded auto-memory path that differs between users and machines. excludeDynamicSections moves that changing context into the first user message, leaving a static system prompt. The documented tradeoff is that the moved instructions may receive less weight in the conversation.
The SDK's returned message stream does not expose system reminders. The page describes inspecting outgoing request bodies through OTEL_LOG_RAW_API_BODIES or a logging gateway to see what context was sent.
Configuration steps
For a coding agent that needs Claude Code behavior, configure systemPrompt or system_prompt with type set to preset and preset set to claude_code. Add append when the existing prompt should remain and application-specific instructions should follow it.
CLAUDE.md loading is controlled by settingSources or setting_sources, independently of the preset. According to the page, default query options enable both project and user sources. Explicit settings must include the desired sources; an empty array prevents CLAUDE.md loading. Project files can be CLAUDE.md or .claude/CLAUDE.md in the working directory, while user instructions come from ~/.claude/CLAUDE.md.
Output-style files belong in ~/.claude/output-styles/ or the repository's .claude/output-styles/. Activate a style through settings: outputStyle is inside the TypeScript settings object, not a top-level Options field. Python accepts settings as a JSON string or a settings-file path. Loading saved styles requires the corresponding user or project setting source.
A custom output style omits software-engineering instructions unless keep-coding-instructions is true. That flag only affects the full system prompt; the page specifies CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT=0 to select it.
Illustrative use
One supplied example asks Claude to help write a Python Fibonacci function while preserving the coding preset and adding a requirement for detailed docstrings and type hints. Its TypeScript options contain systemPrompt: { type: "preset", preset: "claude_code", append: "Always include detailed docstrings and type hints in Python code." }. The Python example uses the equivalent dictionary through ClaudeAgentOptions(system_prompt=...).
Another example asks for a React user-profile component with the preset enabled and settingSources set to ["project"], combining the coding prompt with repository instructions. These examples illustrate configuration; they were not executed, and no resulting implementation or adherence to the instructions was verified.
Assessment & evidence
Important limitations
Changing append or a custom prompt on resume or continue does not normally change the next turn's recorded system prompt. The page says the new prompt takes effect after compaction or in a new session. Instructions that must change immediately should instead be added to the conversation. Disabling recording with snapshot: false changes this behavior, but also affects caching and, where enforced, preserved thinking.
The TypeScript custom-prompt array can use SYSTEM_PROMPT_DYNAMIC_BOUNDARY to separate static and changing text. Splitting works only with direct Claude API calls or Claude Platform on AWS. Other configurations, including Amazon Bedrock, Google Cloud's Agent Platform, Microsoft Foundry and gateways, send one block. Setting CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 also prevents splitting. Python has no equivalent array form.
Python string prompts are passed as a command-line argument to a CLI subprocess and can exceed operating-system argument limits before an API request is made. The documented alternative is a system_prompt object with type set to file and a path. Platform thresholds and Windows details are on an excluded linked page.
Custom prompts can still receive conflicting built-in instructions. The page describes disabling git guidance, adjusting attribution and controlling reminder sources. It does not demonstrate security guarantees, reliable instruction adherence or successful operation across the supported configurations.
How to choose an approach
The page's decision framework connects the prompt to the agent's work, presentation and authority. A repository coding assistant can retain relevant preset guidance; a support agent with a separate identity and restricted resources needs instructions that reflect those conditions.
For project conventions, CLAUDE.md provides a persistent file without replacing the prompt. For reusable response behavior, an output style provides a saved configuration. For session-specific additions, append preserves the preset. A custom prompt offers broader control but requires deliberate replacement of needed tool and safety guidance.
This supports choosing the smallest configuration change that meets the agent's needs. It does not establish which wording will work best for a particular model or application; that remains unassessed.
Related approaches
The useful alternatives established here are configuration approaches within the same SDK. A minimal prompt suits a thin tool-calling loop whose behavior is supplied elsewhere. The coding preset suits coding-agent behavior. A custom prompt suits a different role or application design.
For changes during an active session, the page offers a new user message or hook-provided additionalContext instead of replacing the recorded system prompt. It also identifies skills, hooks and permissions as separate mechanisms that influence behavior, but their detailed configuration is outside this page.
Other SDKs, models and agent frameworks are not compared, so relative cost, reliability and migration effort are unknown.
Source evidence and limits
The evidence is the complete captured documentation page at [https://code.claude.com/docs/en/agent-sdk/modifying-system-prompts.md], retained as selected-page.txt. Its source revision is sha256:34d99ce0a9340cdc69bb3a7447e8cd359719eb03d1419675c49c388772fa8f2c.
The page supplies prose explanations, comparison tables, configuration examples and compatibility notices. These establish documented behavior, not observed runtime results. SDK source code, outgoing request logs, example outputs and benchmark results are not included.
Linked references provide directions to further material but their contents are outside the evidence. No code, configuration or agent was executed.
Access & freshness
Costs and caching
SDK pricing, model rates, subscription requirements and a usable budget are unknown from this page. It provides no measured spending, performance comparison or quantified cache savings.
The guide describes two potential cache-reuse improvements: excluding dynamic sections from the preset and separating static instructions from changing context in a TypeScript custom prompt. It points to cache_creation_input_tokens and cache_read_input_tokens in result messages as relevant usage fields.
Turning snapshot off while editing prompts has a documented cache tradeoff: when a changed prompt reaches a resumed session, that request cannot reuse the session's prompt cache. The financial effect depends on usage and pricing that this evidence does not establish.
Usage and redistribution rights
The supplied page does not state a license for its documentation or examples, SDK package license terms, or redistribution permission. Those rights remain unknown from this evidence. The presence of copyable examples does not establish permission to redistribute the page or SDK.
Date and version sensitivity
The page was captured on 2026-11-23 at 07:57:33.186 UTC. A publication date and last-updated date are not supplied. The capture establishes the available text at that time, not the current behavior of every SDK installation.
Session recording has particularly detailed version qualifications. The page says default recording of append or custom prompts requires Claude Code v2.1.265, bundled from TypeScript SDK v0.3.265 and Python SDK v0.2.153. Before Claude Code v2.1.268, sessions without feature-flag fetching rebuilt prompts on every request and snapshot had no effect.
Outside cloud sessions, bare mode leaves recording off unless snapshot is explicitly true. These exceptions make installed versions and launch configuration material to applying the guide.
Practical next steps
Start by deciding the agent's role, output surface and permission model. Choose the coding preset when its behavior fits, then use project instructions, an output style or append for the required additions. If replacing the prompt, explicitly supply the tool guidance, safety instructions and explanation of application reminders the agent needs.
Check installed SDK and CLI versions before relying on cache splitting, snapshot control or output-style commands. Inspect enabled setting sources so user and project instructions match the intended configuration. If supplying env in TypeScript, the page says it replaces the inherited environment and shows preserving it by spreading process.env.
For an existing session, send urgent instruction changes through the conversation rather than assuming a changed systemPrompt will apply immediately. Before relying on cache savings or reminder suppression, inspect the relevant request context and usage fields. No such verification or cost measurement is established by this evidence.
