Anatomy of an AI Coding Agent's Prompts
Every system prompt, tool instruction, agent persona, and behavioral constraint inside Claude Code: extracted, annotated, and organized as a learning resource for prompt engineering.
The core identity, behavioral rules, and task guidance that define how Claude Code operates
Instructions given to the model for each of the 36+ built-in tools
System prompts for built-in sub-agent types like Explore, Plan, and Verification
The multi-worker orchestration system that manages parallel task execution
How Claude Code stores and retrieves long-term memories across sessions
Configurable response modes like Explanatory and Learning that change Claude's behavior
Autonomous mode, scratchpad, proactive behavior, and other advanced capabilities
Background pipelines: compaction, Chrome, permissions, hooks, bundled skills, and other service-level LLM prompts
Slash commands and CLI handlers such as /init, /insights, auto-mode critique, and session naming
Featured Prompts
Key prompts that define how Claude Code thinks, acts, and uses its tools
Identity & Introduction
The identity section is deliberately minimal — a single sentence that establishes role (interactive agent), domain (software engineering), and deference to the rest of the prompt ('use the instructions below'). This avoids over-constraining the persona early, which research shows can cause the model to ignore later instructions. The CYBER_RISK_INSTRUCTION is inlined immediately to establish security boundaries before any task-specific guidance. The URL guardrail prevents a common failure mode where models hallucinate plausible-looking links.
Bash Tool
The Bash tool prompt is one of the most elaborate in Claude Code, combining tool-use guidance with extensive guardrails. It steers the model away from shell commands when dedicated tools exist (Glob, Grep, Read, Edit, Write), uses priority-ordering to list preferred alternatives, and includes detailed behavioral constraints for git safety. The sandbox section uses conditional logic to adapt restrictions based on configuration. The sleep guidance prevents common anti-patterns like polling loops and unnecessary delays.
Explore Agent — Read-Only Codebase Search Specialist
The explore agent is a speed-optimized, read-only search specialist. The prompt uses an exhaustive deny-list of prohibited operations to enforce immutability — listing every way a file could be modified rather than just saying 'read-only.' This negative-example technique is more robust against creative workarounds. The performance note at the end nudges the model toward parallel tool calls.
Coordinator System Prompt
The coordinator prompt is the most architecturally significant prompt in Claude Code, defining a multi-agent orchestration pattern. It establishes a four-phase workflow (Research → Synthesis → Implementation → Verification) and makes synthesis the coordinator's 'most important job.' The anti-patterns section ('based on your findings' is banned) prevents lazy delegation. The continue-vs-spawn decision table teaches context-aware worker management. The full example session demonstrates the complete lifecycle from bug report to fix.
Action Safety & Reversibility
This section introduces a 'reversibility and blast radius' framework that gives the model a principled mental model for evaluating risk without exhaustively enumerating every dangerous action. The asymmetric cost framing ('cost of pausing is low, cost of unwanted action is high') creates a strong prior toward caution. The explicit note that 'approving once does NOT mean approving in all contexts' prevents the model from over-generalizing permissions — a subtle but critical safety boundary. The concrete examples serve as few-shot calibration for what 'risky' means in practice, and the closing 'measure twice, cut once' aphorism reinforces the spirit of the rules.
Agent Tool
The Agent tool prompt is a masterclass in meta-prompting — it teaches the model how to write good prompts for sub-agents. The 'Writing the prompt' section uses persona-based framing ('brief like a smart colleague') and includes negative examples of what not to do ('never delegate understanding'). The fork semantics section introduces a qualitative decision framework for when to fork vs. spawn fresh agents. The 'Don't peek' and 'Don't race' directives are critical guardrails preventing the model from fabricating results or polluting its context with fork output.
How it works
Pick a workflow, then step through the prompt chain; see how system, tool, and agent prompts connect in real tasks.
Identity & Introduction
src/constants/prompts.ts:175Every turn starts with the core system prompt: role as an interactive coding agent, security boundaries, and URL safety before any tools run.
Prompt Engineering Techniques
18 techniques identified across all prompts; see how production AI agents are built
Explicit rules about what the AI must or must not do
Restricting the AI's actions to a specific domain or set of capabilities
Instructions for when and how to use specific tools
Specifying the exact format for responses (JSON, XML, etc.)
Safety boundaries to prevent harmful or unintended actions
Classifying items into a structured hierarchy of types
Breaking complex tasks into ordered sequential steps
Instructions that adapt based on runtime context or conditions
Providing concrete examples of desired input/output pairs
Establishing the AI's identity and capabilities upfront
Showing what NOT to do to prevent common mistakes
Prompts that instruct the AI on how to construct other prompts
Dynamically inserting environment or session data into prompts
Arranging instructions by importance with explicit priority markers
Using XML-style tags to structure and delimit prompt sections
Encouraging step-by-step reasoning before conclusions
Giving the AI a specific character or expertise to embody
Requiring the AI to check its own work before reporting completion
Explore by Category
Organized by function within the Claude Code agent architecture
System Prompt
The core identity, behavioral rules, and task guidance that define how Claude Code operates
Tool Prompts
Instructions given to the model for each of the 36+ built-in tools
Agent Prompts
System prompts for built-in sub-agent types like Explore, Plan, and Verification
Coordinator
The multi-worker orchestration system that manages parallel task execution
Memory System
How Claude Code stores and retrieves long-term memories across sessions
Output Styles
Configurable response modes like Explanatory and Learning that change Claude's behavior
Special Features
Autonomous mode, scratchpad, proactive behavior, and other advanced capabilities
Services & Utilities
Background pipelines: compaction, Chrome, permissions, hooks, bundled skills, and other service-level LLM prompts
Commands & CLI
Slash commands and CLI handlers such as /init, /insights, auto-mode critique, and session naming
What You'll Learn
System Prompt Architecture
How a production AI agent structures its core identity, constraints, and task-specific instructions across composable sections.
Tool Design Patterns
Each tool carries its own prompt describing when and how to use it; see the patterns behind 18+ tool definitions.
Multi-Agent Orchestration
How sub-agents get specialized personas for different tasks, and how coordinators manage parallel work.
Prompt Engineering Craft
Real-world applications of 18 techniques: role-setting, guardrails, few-shot examples, meta-prompting, and more.
Ready to explore?
Dive into 124 annotated prompts across 9 categories. Every prompt includes engineering insights and technique breakdowns.
Start Exploring