Extracted from source code · 124 prompts cataloged

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.

124
Prompts
9
Categories
18
Techniques
289
Unique Tags
277k
Characters

What's Inside

124 prompts across 9 categories, extracted from Claude Code's source

⚙️System Prompt
15·19k

The core identity, behavioral rules, and task guidance that define how Claude Code operates

Identity & Introduction
System Rules & Permissions
Task Execution & Code Style
Action Safety & Reversibility
+11 more
🔧Tool Prompts
38·73k

Instructions given to the model for each of the 36+ built-in tools

Bash Tool
File Read Tool
File Edit Tool
File Write Tool
+34 more
🤖Agent Prompts
7·26k

System prompts for built-in sub-agent types like Explore, Plan, and Verification

Default Agent Prompt
Explore Agent — Read-Only Codebase Search Specialist
General-Purpose Agent
Plan Agent — Software Architect
+3 more
🎯Coordinator
1·14k

The multi-worker orchestration system that manages parallel task execution

Coordinator System Prompt
🧠Memory System
10·44k

How Claude Code stores and retrieves long-term memories across sessions

Memory Type Taxonomy (Combined Mode)
Memory Type Taxonomy (Individual Mode)
What NOT to Save in Memory
When to Access Memories
+6 more
🎨Output Styles
2·6k

Configurable response modes like Explanatory and Learning that change Claude's behavior

Explanatory Output Style
Learning Output Style
Special Features
3·5k

Autonomous mode, scratchpad, proactive behavior, and other advanced capabilities

Autonomous Work (Proactive Mode)
Scratchpad Directory Instructions
Hooks System Instructions
🔌Services & Utilities
31·59k

Background pipelines: compaction, Chrome, permissions, hooks, bundled skills, and other service-level LLM prompts

Compaction: No-Tools Preamble
Compaction: Detailed Analysis (Base)
Compaction: Detailed Analysis (Partial)
Compaction: Base Prompt
+27 more
⌨️Commands & CLI
17·31k

Slash commands and CLI handlers such as /init, /insights, auto-mode critique, and session naming

/init NEW_INIT Prompt
/init OLD_INIT Prompt
Auto-Mode Critique
Session Title Generation
+13 more

Key prompts that define how Claude Code thinks, acts, and uses its tools

prompts.ts:175

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.

role-settingguardrailsscope-limiting
prompt.ts

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.

tool-use-guidancebehavioral-constraintspriority-ordering
exploreAgent.ts

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.

role-settingbehavioral-constraintsnegative-examples
coordinatorMode.ts

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.

role-settingbehavioral-constraintsfew-shot-examples
prompts.ts:255

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.

guardrailsconditional-logicbehavioral-constraints
prompt.ts

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.

meta-promptingnegative-examplestool-use-guidance

How it works

Pick a workflow, then step through the prompt chain; see how system, tool, and agent prompts connect in real tasks.

See all flows →
⚙️Agent identity & guardrails

Identity & Introduction

src/constants/prompts.ts:175
1/7

Every turn starts with the core system prompt: role as an interactive coding agent, security boundaries, and URL safety before any tools run.

prompt excerpt
You are an interactive agent that helps users with software engineering tasks.

Prompt Engineering Techniques

18 techniques identified across all prompts; see how production AI agents are built

behavioral-constraints×76

Explicit rules about what the AI must or must not do

scope-limiting×50

Restricting the AI's actions to a specific domain or set of capabilities

tool-use-guidance×47

Instructions for when and how to use specific tools

structured-output×44

Specifying the exact format for responses (JSON, XML, etc.)

guardrails×39

Safety boundaries to prevent harmful or unintended actions

taxonomy×31

Classifying items into a structured hierarchy of types

step-by-step×27

Breaking complex tasks into ordered sequential steps

conditional-logic×27

Instructions that adapt based on runtime context or conditions

few-shot-examples×21

Providing concrete examples of desired input/output pairs

role-setting×19

Establishing the AI's identity and capabilities upfront

negative-examples×19

Showing what NOT to do to prevent common mistakes

meta-prompting×16

Prompts that instruct the AI on how to construct other prompts

context-injection×11

Dynamically inserting environment or session data into prompts

priority-ordering×11

Arranging instructions by importance with explicit priority markers

xml-tags×11

Using XML-style tags to structure and delimit prompt sections

chain-of-thought×6

Encouraging step-by-step reasoning before conclusions

persona×5

Giving the AI a specific character or expertise to embody

self-verification×2

Requiring the AI to check its own work before reporting completion

What You'll Learn

01

System Prompt Architecture

How a production AI agent structures its core identity, constraints, and task-specific instructions across composable sections.

02

Tool Design Patterns

Each tool carries its own prompt describing when and how to use it; see the patterns behind 18+ tool definitions.

03

Multi-Agent Orchestration

How sub-agents get specialized personas for different tasks, and how coordinators manage parallel work.

04

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