SpyBara
Go Premium

Documentation 2026-01-20 21:03 UTC to 2026-01-21 21:05 UTC

12 files changed +561 −11. View all changes and history on the product overview
2026
Sat 31 03:42 Fri 30 18:07 Thu 29 21:03 Wed 28 15:06 Tue 27 21:01 Mon 26 21:03 Sun 25 03:34 Sat 24 03:29 Fri 23 21:01 Thu 22 21:03 Wed 21 21:05 Tue 20 21:03 Mon 19 21:01 Fri 16 21:01 Wed 14 06:02 Mon 12 21:02 Sun 11 18:02 Sat 10 21:01 Fri 9 21:01 Thu 8 21:02 Wed 7 21:01 Tue 6 21:01 Sat 3 18:02
Details

209 We recommend creating a dedicated AWS account for Claude Code to simplify cost tracking and access control.209 We recommend creating a dedicated AWS account for Claude Code to simplify cost tracking and access control.

210</Note>210</Note>

211 211 

212## AWS Guardrails

213 

214[Amazon Bedrock Guardrails](https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails.html) let you implement content filtering for Claude Code. Create a Guardrail in the [Amazon Bedrock console](https://console.aws.amazon.com/bedrock/), publish a version, then add the Guardrail headers to your [settings file](/en/settings). Enable Cross-Region inference on your Guardrail if you're using cross-region inference profiles.

215 

216Example configuration:

217 

218```json theme={null}

219{

220 "env": {

221 "ANTHROPIC_CUSTOM_HEADERS": "X-Amzn-Bedrock-GuardrailIdentifier: your-guardrail-id\nX-Amzn-Bedrock-GuardrailVersion: 1"

222 }

223}

224```

225 

212## Troubleshooting226## Troubleshooting

213 227 

214If you encounter region issues:228If you encounter region issues:

Details

39| `--fallback-model` | Enable automatic fallback to specified model when default model is overloaded (print mode only) | `claude -p --fallback-model sonnet "query"` |39| `--fallback-model` | Enable automatic fallback to specified model when default model is overloaded (print mode only) | `claude -p --fallback-model sonnet "query"` |

40| `--fork-session` | When resuming, create a new session ID instead of reusing the original (use with `--resume` or `--continue`) | `claude --resume abc123 --fork-session` |40| `--fork-session` | When resuming, create a new session ID instead of reusing the original (use with `--resume` or `--continue`) | `claude --resume abc123 --fork-session` |

41| `--ide` | Automatically connect to IDE on startup if exactly one valid IDE is available | `claude --ide` |41| `--ide` | Automatically connect to IDE on startup if exactly one valid IDE is available | `claude --ide` |

42| `--init` | Run [Setup hooks](/en/hooks#setup) and start interactive mode | `claude --init` |

43| `--init-only` | Run [Setup hooks](/en/hooks#setup) and exit (no interactive session) | `claude --init-only` |

42| `--include-partial-messages` | Include partial streaming events in output (requires `--print` and `--output-format=stream-json`) | `claude -p --output-format stream-json --include-partial-messages "query"` |44| `--include-partial-messages` | Include partial streaming events in output (requires `--print` and `--output-format=stream-json`) | `claude -p --output-format stream-json --include-partial-messages "query"` |

43| `--input-format` | Specify input format for print mode (options: `text`, `stream-json`) | `claude -p --output-format json --input-format stream-json` |45| `--input-format` | Specify input format for print mode (options: `text`, `stream-json`) | `claude -p --output-format json --input-format stream-json` |

44| `--json-schema` | Get validated JSON output matching a JSON Schema after agent completes its workflow (print mode only, see [Agent SDK Structured Outputs](https://docs.claude.com/en/docs/agent-sdk/structured-outputs)) | `claude -p --json-schema '{"type":"object","properties":{...}}' "query"` |46| `--json-schema` | Get validated JSON output matching a JSON Schema after agent completes its workflow (print mode only, see [Agent SDK Structured Outputs](https://docs.claude.com/en/docs/agent-sdk/structured-outputs)) | `claude -p --json-schema '{"type":"object","properties":{...}}' "query"` |

47| `--maintenance` | Run [Setup hooks](/en/hooks#setup) with maintenance trigger and exit | `claude --maintenance` |

45| `--max-budget-usd` | Maximum dollar amount to spend on API calls before stopping (print mode only) | `claude -p --max-budget-usd 5.00 "query"` |48| `--max-budget-usd` | Maximum dollar amount to spend on API calls before stopping (print mode only) | `claude -p --max-budget-usd 5.00 "query"` |

46| `--max-turns` | Limit the number of agentic turns (print mode only). Exits with an error when the limit is reached. No limit by default | `claude -p --max-turns 3 "query"` |49| `--max-turns` | Limit the number of agentic turns (print mode only). Exits with an error when the limit is reached. No limit by default | `claude -p --max-turns 3 "query"` |

47| `--mcp-config` | Load MCP servers from JSON files or strings (space-separated) | `claude --mcp-config ./mcp.json` |50| `--mcp-config` | Load MCP servers from JSON files or strings (space-separated) | `claude --mcp-config ./mcp.json` |

Details

1# Common workflows1# Common workflows

2 2 

3> Learn about common workflows with Claude Code.3> Step-by-step guides for exploring codebases, fixing bugs, refactoring, testing, and other everyday tasks with Claude Code.

4 4 

5Each task in this document includes clear instructions, example commands, and best practices to help you get the most from Claude Code.5This page covers practical workflows for everyday development: exploring unfamiliar code, debugging, refactoring, writing tests, creating PRs, and managing sessions. Each section includes example prompts you can adapt to your own projects.

6 6 

7## Understand new codebases7## Understand new codebases

8 8 

costs.md +1 −1

Details

159 159 

160For longer or more complex work, these habits help avoid wasted tokens from going down the wrong path:160For longer or more complex work, these habits help avoid wasted tokens from going down the wrong path:

161 161 

162* **Use plan mode for complex tasks**: Press Shift+Tab to enter [plan mode](/en/plan-mode) before implementation. Claude explores the codebase and proposes an approach for your approval, preventing expensive re-work when the initial direction is wrong.162* **Use plan mode for complex tasks**: Press Shift+Tab to enter [plan mode](/en/common-workflows#use-plan-mode-for-safe-code-analysis) before implementation. Claude explores the codebase and proposes an approach for your approval, preventing expensive re-work when the initial direction is wrong.

163* **Course-correct early**: If Claude starts heading the wrong direction, press Escape to stop immediately. Use `/rewind` or double-tap Escape to restore conversation and code to a previous checkpoint.163* **Course-correct early**: If Claude starts heading the wrong direction, press Escape to stop immediately. Use `/rewind` or double-tap Escape to restore conversation and code to a previous checkpoint.

164* **Give verification targets**: Include test cases, paste screenshots, or define expected output in your prompt. When Claude can verify its own work, it catches issues before you need to request fixes.164* **Give verification targets**: Include test cases, paste screenshots, or define expected output in your prompt. When Claude can verify its own work, it catches issues before you need to request fixes.

165* **Test incrementally**: Write one file, test it, then continue. This catches issues early when they're cheap to fix.165* **Test incrementally**: Write one file, test it, then continue. This catches issues early when they're cheap to fix.

features-overview.md +239 −0 created

Details

1# Extend Claude Code

2 

3> Understand when to use CLAUDE.md, Skills, subagents, hooks, MCP, and plugins.

4 

5Claude Code combines a model that reasons about your code with [built-in tools](/en/how-claude-code-works#tools) for file operations, search, execution, and web access. The built-in tools cover most coding tasks. This guide covers the extension layer: features you add to customize what Claude knows, connect it to external services, and automate workflows.

6 

7<Note>

8 For how the core agentic loop works, see [How Claude Code works](/en/how-claude-code-works).

9</Note>

10 

11**New to Claude Code?** Start with [CLAUDE.md](/en/memory) for project conventions. Add other extensions as you need them.

12 

13## Overview

14 

15Extensions plug into different parts of the agentic loop:

16 

17* **[CLAUDE.md](/en/memory)** adds persistent context Claude sees every session

18* **[Skills](/en/skills)** add reusable knowledge and invocable workflows

19* **[MCP](/en/mcp)** connects Claude to external services and tools

20* **[Subagents](/en/sub-agents)** run their own loops in isolated context, returning summaries

21* **[Hooks](/en/hooks)** run outside the loop entirely as deterministic scripts

22* **[Plugins](/en/plugins)** and **[marketplaces](/en/plugin-marketplaces)** package and distribute these features

23 

24[Skills](/en/skills) are the most flexible extension. A skill is a markdown file containing knowledge, workflows, or instructions. You can invoke skills with a slash command like `/deploy`, or Claude can load them automatically when relevant. Skills can run in your current conversation or in an isolated context via subagents.

25 

26## Match features to your goal

27 

28Features range from always-on context that Claude sees every session, to on-demand capabilities you or Claude can invoke, to background automation that runs on specific events. The table below shows what's available and when each one makes sense.

29 

30| Feature | What it does | When to use it | Example |

31| ------------- | ---------------------------------------------------------- | ------------------------------------------------------ | -------------------------------------------------------------------------------- |

32| **CLAUDE.md** | Persistent context loaded every conversation | Project conventions, "always do X" rules | "Use pnpm, not npm. Run tests before committing." |

33| **Skill** | Instructions, knowledge, and workflows Claude can use | Reusable content, reference docs, repeatable tasks | `/review` runs your code review checklist; API docs skill with endpoint patterns |

34| **Subagent** | Isolated execution context that returns summarized results | Context isolation, parallel tasks, specialized workers | Research task that reads many files but returns only key findings |

35| **MCP** | Connect to external services | External data or actions | Query your database, post to Slack, control a browser |

36| **Hook** | Deterministic script that runs on events | Predictable automation, no LLM involved | Run ESLint after every file edit |

37 

38**[Plugins](/en/plugins)** are the packaging layer. A plugin bundles skills, hooks, subagents, and MCP servers into a single installable unit. Plugin skills are namespaced (like `/my-plugin:review`) so multiple plugins can coexist. Use plugins when you want to reuse the same setup across multiple repositories or distribute to others via a **[marketplace](/en/plugin-marketplaces)**.

39 

40### Compare similar features

41 

42Some features can seem similar. Here's how to tell them apart.

43 

44<Tabs>

45 <Tab title="Skill vs Subagent">

46 Skills and subagents solve different problems:

47 

48 * **Skills** are reusable content you can load into any context

49 * **Subagents** are isolated workers that run separately from your main conversation

50 

51 | Aspect | Skill | Subagent |

52 | --------------- | ---------------------------------------------- | ---------------------------------------------------------------- |

53 | **What it is** | Reusable instructions, knowledge, or workflows | Isolated worker with its own context |

54 | **Key benefit** | Share content across contexts | Context isolation. Work happens separately, only summary returns |

55 | **Best for** | Reference material, invocable workflows | Tasks that read many files, parallel work, specialized workers |

56 

57 **Skills can be reference or action.** Reference skills provide knowledge Claude uses throughout your session (like your API style guide). Action skills tell Claude to do something specific (like `/deploy` that runs your deployment workflow).

58 

59 **Use a subagent** when you need context isolation. The subagent might read dozens of files or run extensive searches, but your main conversation only receives a summary. Custom subagents can have their own instructions and can preload skills.

60 

61 **They can combine.** A subagent can preload specific skills (`skills:` field). A skill can run in isolated context using `context: fork`. See [Skills](/en/skills) for details.

62 </Tab>

63 

64 <Tab title="CLAUDE.md vs Skill">

65 Both store instructions, but they load differently and serve different purposes.

66 

67 | Aspect | CLAUDE.md | Skill |

68 | ------------------------- | ---------------------------- | --------------------------------------- |

69 | **Loads** | Every session, automatically | On demand |

70 | **Can include files** | Yes, with `@path` imports | Yes, with `@path` imports |

71 | **Can trigger workflows** | No | Yes, with `/<name>` |

72 | **Best for** | "Always do X" rules | Reference material, invocable workflows |

73 

74 **Put it in CLAUDE.md** if Claude should always know it: coding conventions, build commands, project structure, "never do X" rules.

75 

76 **Put it in a skill** if it's reference material Claude needs sometimes (API docs, style guides) or a workflow you trigger with `/<name>` (deploy, review, release).

77 

78 **Rule of thumb:** Keep CLAUDE.md under \~500 lines. If it's growing, move reference content to skills.

79 </Tab>

80 

81 <Tab title="MCP vs Skill">

82 MCP connects Claude to external services. Skills extend what Claude knows, including how to use those services effectively.

83 

84 | Aspect | MCP | Skill |

85 | -------------- | ---------------------------------------------------- | ------------------------------------------------------- |

86 | **What it is** | Protocol for connecting to external services | Knowledge, workflows, and reference material |

87 | **Provides** | Tools and data access | Knowledge, workflows, reference material |

88 | **Examples** | Slack integration, database queries, browser control | Code review checklist, deploy workflow, API style guide |

89 

90 These solve different problems and work well together:

91 

92 **MCP** gives Claude the ability to interact with external systems. Without MCP, Claude can't query your database or post to Slack.

93 

94 **Skills** give Claude knowledge about how to use those tools effectively, plus workflows you can trigger with `/<name>`. A skill might include your team's database schema and query patterns, or a `/post-to-slack` workflow with your team's message formatting rules.

95 

96 Example: An MCP server connects Claude to your database. A skill teaches Claude your data model, common query patterns, and which tables to use for different tasks.

97 </Tab>

98</Tabs>

99 

100### Combine features

101 

102Each extension solves a different problem: CLAUDE.md handles always-on context, skills handle on-demand knowledge and workflows, MCP handles external connections, subagents handle isolation, and hooks handle automation. Real setups combine them based on your workflow.

103 

104For example, you might use CLAUDE.md for project conventions, a skill for your deployment workflow, MCP to connect to your database, and a hook to run linting after every edit. Each feature handles what it's best at.

105 

106| Pattern | How it works | Example |

107| ---------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |

108| **Skill + MCP** | MCP provides the connection; a skill teaches Claude how to use it well | MCP connects to your database, a skill documents your schema and query patterns |

109| **Skill + Subagent** | A skill spawns subagents for parallel work | `/review` skill kicks off security, performance, and style subagents that work in isolated context |

110| **CLAUDE.md + Skills** | CLAUDE.md holds always-on rules; skills hold reference material loaded on demand | CLAUDE.md says "follow our API conventions," a skill contains the full API style guide |

111| **Hook + MCP** | A hook triggers external actions through MCP | Post-edit hook sends a Slack notification when Claude modifies critical files |

112 

113## Understand context costs

114 

115Every feature you add consumes some of Claude's context. Too much can fill up your context window, but it can also add noise that makes Claude less effective; skills may not trigger correctly, or Claude may lose track of your conventions. Understanding these trade-offs helps you build an effective setup.

116 

117### Context cost by feature

118 

119Each feature has a different loading strategy and context cost:

120 

121| Feature | When it loads | What loads | Context cost |

122| --------------- | ------------------------- | --------------------------------------------- | -------------------------------------------- |

123| **CLAUDE.md** | Session start | Full content | Every request |

124| **Skills** | Session start + when used | Descriptions at start, full content when used | Low (descriptions every request)\* |

125| **MCP servers** | Session start | All tool definitions and schemas | Every request |

126| **Subagents** | When spawned | Fresh context with specified skills | Isolated from main session |

127| **Hooks** | On trigger | Nothing (runs externally) | Zero, unless hook returns additional context |

128 

129\*By default, skill descriptions load at session start so Claude can decide when to use them. Set `disable-model-invocation: true` in a skill's frontmatter to hide it from Claude entirely until you invoke it manually. This reduces context cost to zero for skills you only trigger yourself.

130 

131### Understand how features load

132 

133Each feature loads at different points in your session. The tabs below explain when each one loads and what goes into context.

134 

135<img src="https://mintcdn.com/claude-code/ELkJZG54dIaeldDC/images/context-loading.svg?fit=max&auto=format&n=ELkJZG54dIaeldDC&q=85&s=bd2e24b8e6a99b31ecfffb63f5b23bf5" alt="Context loading: CLAUDE.md and MCP load at session start and stay in every request. Skills load descriptions at start, full content on invocation. Subagents get isolated context. Hooks run externally." data-og-width="720" width="720" data-og-height="410" height="410" data-path="images/context-loading.svg" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/claude-code/ELkJZG54dIaeldDC/images/context-loading.svg?w=280&fit=max&auto=format&n=ELkJZG54dIaeldDC&q=85&s=aebaadd1f484f285dd9cb4e0ea6d49b9 280w, https://mintcdn.com/claude-code/ELkJZG54dIaeldDC/images/context-loading.svg?w=560&fit=max&auto=format&n=ELkJZG54dIaeldDC&q=85&s=030c9b46126d750de315612560082727 560w, https://mintcdn.com/claude-code/ELkJZG54dIaeldDC/images/context-loading.svg?w=840&fit=max&auto=format&n=ELkJZG54dIaeldDC&q=85&s=6c73f8b0389da4f3190843140c810fe9 840w, https://mintcdn.com/claude-code/ELkJZG54dIaeldDC/images/context-loading.svg?w=1100&fit=max&auto=format&n=ELkJZG54dIaeldDC&q=85&s=9844c55d08d2c386672447f2e8518669 1100w, https://mintcdn.com/claude-code/ELkJZG54dIaeldDC/images/context-loading.svg?w=1650&fit=max&auto=format&n=ELkJZG54dIaeldDC&q=85&s=21a9522d0e4bd10ced146aab850ede76 1650w, https://mintcdn.com/claude-code/ELkJZG54dIaeldDC/images/context-loading.svg?w=2500&fit=max&auto=format&n=ELkJZG54dIaeldDC&q=85&s=d318525915aee1a1a6a4215cfaa61fb9 2500w" />

136 

137<Tabs>

138 <Tab title="CLAUDE.md">

139 **When:** Session start

140 

141 **What loads:** Full content of all CLAUDE.md files (managed, user, and project levels).

142 

143 **Inheritance:** Claude reads CLAUDE.md files from your working directory up to the root, and discovers nested ones in subdirectories as it accesses those files. See [How Claude looks up memories](/en/memory#how-claude-looks-up-memories) for details.

144 

145 <Tip>Keep CLAUDE.md under \~500 lines. Move reference material to skills, which load on-demand.</Tip>

146 </Tab>

147 

148 <Tab title="Skills">

149 Skills are extra capabilities in Claude's toolkit. They can be reference material (like an API style guide) or invocable workflows you trigger with `/<name>` (like `/deploy`). Some are built-in; you can also create your own. Claude uses skills when appropriate, or you can invoke one directly.

150 

151 **When:** Depends on the skill's configuration. By default, descriptions load at session start and full content loads when used. For user-only skills (`disable-model-invocation: true`), nothing loads until you invoke them.

152 

153 **What loads:** For model-invocable skills, Claude sees names and descriptions in every request. When you invoke a skill with `/<name>` or Claude loads it automatically, the full content loads into your conversation.

154 

155 **How Claude chooses skills:** Claude matches your task against skill descriptions to decide which are relevant. If descriptions are vague or overlap, Claude may load the wrong skill or miss one that would help. To tell Claude to use a specific skill, invoke it with `/<name>`. Skills with `disable-model-invocation: true` are invisible to Claude until you invoke them.

156 

157 **Context cost:** Low until used. User-only skills have zero cost until invoked.

158 

159 **In subagents:** Skills work differently in subagents. Instead of on-demand loading, skills passed to a subagent are fully preloaded into its context at launch. Subagents don't inherit skills from the main session; you must specify them explicitly.

160 

161 <Tip>Use `disable-model-invocation: true` for skills with side effects. This saves context and ensures only you trigger them.</Tip>

162 </Tab>

163 

164 <Tab title="MCP servers">

165 **When:** Session start.

166 

167 **What loads:** All tool definitions and JSON schemas from connected servers.

168 

169 **Context cost:** [Tool search](/en/mcp#scale-with-mcp-tool-search) (enabled by default) loads MCP tools up to 10% of context and defers the rest until needed.

170 

171 **Reliability note:** MCP connections can fail silently mid-session. If a server disconnects, its tools disappear without warning. Claude may try to use a tool that no longer exists. If you notice Claude failing to use an MCP tool it previously could access, check the connection with `/mcp`.

172 

173 <Tip>Run `/mcp` to see token costs per server. Disconnect servers you're not actively using.</Tip>

174 </Tab>

175 

176 <Tab title="Subagents">

177 **When:** On demand, when you or Claude spawns one for a task.

178 

179 **What loads:** Fresh, isolated context containing:

180 

181 * The system prompt (shared with parent for cache efficiency)

182 * Full content of skills listed in the agent's `skills:` field

183 * CLAUDE.md and git status (inherited from parent)

184 * Whatever context the lead agent passes in the prompt

185 

186 **Context cost:** Isolated from main session. Subagents don't inherit your conversation history or invoked skills.

187 

188 <Tip>Use subagents for work that doesn't need your full conversation context. Their isolation prevents bloating your main session.</Tip>

189 </Tab>

190 

191 <Tab title="Hooks">

192 **When:** On trigger. Hooks can run before or after tool executions, at session start, before compaction, and at other lifecycle events. See [Hooks](/en/hooks) for the full list.

193 

194 **What loads:** Nothing by default. Hooks run as external scripts.

195 

196 **Context cost:** Zero, unless the hook returns output that gets added as messages to your conversation.

197 

198 <Tip>Hooks are ideal for side effects (linting, logging) that don't need to affect Claude's context.</Tip>

199 </Tab>

200</Tabs>

201 

202## Learn more

203 

204Each feature has its own guide with setup instructions, examples, and configuration options.

205 

206<CardGroup cols={2}>

207 <Card title="CLAUDE.md" icon="file-lines" href="/en/memory">

208 Store project context, conventions, and instructions

209 </Card>

210 

211 <Card title="Skills" icon="brain" href="/en/skills">

212 Give Claude domain expertise and reusable workflows

213 </Card>

214 

215 <Card title="Subagents" icon="users" href="/en/sub-agents">

216 Offload work to isolated context

217 </Card>

218 

219 <Card title="MCP" icon="plug" href="/en/mcp">

220 Connect Claude to external services

221 </Card>

222 

223 <Card title="Hooks" icon="bolt" href="/en/hooks">

224 Run scripts on Claude Code events

225 </Card>

226 

227 <Card title="Plugins" icon="puzzle-piece" href="/en/plugins">

228 Bundle and share feature sets

229 </Card>

230 

231 <Card title="Marketplaces" icon="store" href="/en/plugin-marketplaces">

232 Host and distribute plugin collections

233 </Card>

234</CardGroup>

235 

236 

237---

238 

239> To find navigation and other pages in this documentation, fetch the llms.txt file at: https://code.claude.com/docs/llms.txt

hooks.md +55 −4

Details

53 * `prompt`: (For `type: "prompt"`) The prompt to send to the LLM for evaluation53 * `prompt`: (For `type: "prompt"`) The prompt to send to the LLM for evaluation

54 * `timeout`: (Optional) How long a hook should run, in seconds, before canceling that specific hook54 * `timeout`: (Optional) How long a hook should run, in seconds, before canceling that specific hook

55 55 

56For events like `UserPromptSubmit`, `Stop`, and `SubagentStop`56For events like `UserPromptSubmit`, `Stop`, `SubagentStop`, and `Setup`

57that don't use matchers, you can omit the matcher field:57that don't use matchers, you can omit the matcher field:

58 58 

59```json theme={null}59```json theme={null}


411* `manual` - Invoked from `/compact`411* `manual` - Invoked from `/compact`

412* `auto` - Invoked from auto-compact (due to full context window)412* `auto` - Invoked from auto-compact (due to full context window)

413 413 

414### Setup

415 

416Runs when Claude Code is invoked with repository setup and maintenance flags (`--init`, `--init-only`, or `--maintenance`). Use this hook for operations you don't want on every session—such as installing dependencies, running migrations, or periodic maintenance tasks.

417 

418<Note>

419 Use **Setup** hooks for one-time or occasional operations (dependency installation, migrations, cleanup). Use **SessionStart** hooks for things you want on every session (loading context, setting environment variables). Setup hooks require explicit flags because running them automatically would slow down every session start.

420</Note>

421 

422**Matchers:**

423 

424* `init` - Invoked from `--init` or `--init-only` flags

425* `maintenance` - Invoked from `--maintenance` flag

426 

427Setup hooks have access to the `CLAUDE_ENV_FILE` environment variable for persisting environment variables, similar to SessionStart hooks.

428 

414### SessionStart429### SessionStart

415 430 

416Runs when Claude Code starts a new session or resumes an existing session (which431Runs when Claude Code starts a new session or resumes an existing session (which

417currently does start a new session under the hood). Useful for loading in432currently does start a new session under the hood). Useful for loading development context like existing issues or recent changes to your codebase, or setting up environment variables.

418development context like existing issues or recent changes to your codebase, installing dependencies, or setting up environment variables.433 

434<Note>

435 For one-time operations like installing dependencies or running migrations, use [Setup hooks](#setup) instead. SessionStart runs on every session, so keep these hooks fast.

436</Note>

419 437 

420**Matchers:**438**Matchers:**

421 439 


687}705}

688```706```

689 707 

708### Setup Input

709 

710```json theme={null}

711{

712 "session_id": "abc123",

713 "transcript_path": "~/.claude/projects/.../00893aaf-19fa-41d2-8238-13269b9b3ca0.jsonl",

714 "cwd": "/Users/...",

715 "permission_mode": "default",

716 "hook_event_name": "Setup",

717 "trigger": "init"

718}

719```

720 

721The `trigger` field will be either `"init"` (from `--init` or `--init-only`) or `"maintenance"` (from `--maintenance`).

722 

690### SessionStart Input723### SessionStart Input

691 724 

692```json theme={null}725```json theme={null}


750| `Stop` | Blocks stoppage, shows stderr to Claude |783| `Stop` | Blocks stoppage, shows stderr to Claude |

751| `SubagentStop` | Blocks stoppage, shows stderr to Claude subagent |784| `SubagentStop` | Blocks stoppage, shows stderr to Claude subagent |

752| `PreCompact` | N/A, shows stderr to user only |785| `PreCompact` | N/A, shows stderr to user only |

786| `Setup` | N/A, shows stderr to user only |

753| `SessionStart` | N/A, shows stderr to user only |787| `SessionStart` | N/A, shows stderr to user only |

754| `SessionEnd` | N/A, shows stderr to user only |788| `SessionEnd` | N/A, shows stderr to user only |

755 789 


928}962}

929```963```

930 964 

965#### `Setup` Decision Control

966 

967`Setup` hooks allow you to load context and configure the environment during repository initialization or maintenance.

968 

969* `"hookSpecificOutput.additionalContext"` adds the string to the context.

970* Multiple hooks' `additionalContext` values are concatenated.

971* Setup hooks have access to `CLAUDE_ENV_FILE` for persisting environment variables.

972 

973```json theme={null}

974{

975 "hookSpecificOutput": {

976 "hookEventName": "Setup",

977 "additionalContext": "Repository initialized with custom configuration"

978 }

979}

980```

981 

931#### `SessionStart` Decision Control982#### `SessionStart` Decision Control

932 983 

933`SessionStart` hooks allow you to load in context at the start of a session.984`SessionStart` hooks allow you to load in context at the start of a session.


1203* **Output**:1254* **Output**:

1204 * PreToolUse/PermissionRequest/PostToolUse/Stop/SubagentStop: Progress shown in verbose mode (ctrl+o)1255 * PreToolUse/PermissionRequest/PostToolUse/Stop/SubagentStop: Progress shown in verbose mode (ctrl+o)

1205 * Notification/SessionEnd: Logged to debug only (`--debug`)1256 * Notification/SessionEnd: Logged to debug only (`--debug`)

1206 * UserPromptSubmit/SessionStart: stdout added as context for Claude1257 * UserPromptSubmit/SessionStart/Setup: stdout added as context for Claude

1207 1258 

1208## Debugging1259## Debugging

1209 1260 

hooks-guide.md +1 −0

Details

47* **Stop**: Runs when Claude Code finishes responding47* **Stop**: Runs when Claude Code finishes responding

48* **SubagentStop**: Runs when subagent tasks complete48* **SubagentStop**: Runs when subagent tasks complete

49* **PreCompact**: Runs before Claude Code is about to run a compact operation49* **PreCompact**: Runs before Claude Code is about to run a compact operation

50* **Setup**: Runs when Claude Code is invoked with `--init`, `--init-only`, or `--maintenance` flags

50* **SessionStart**: Runs when Claude Code starts a new session or resumes an existing session51* **SessionStart**: Runs when Claude Code starts a new session or resumes an existing session

51* **SessionEnd**: Runs when Claude Code session ends52* **SessionEnd**: Runs when Claude Code session ends

52 53 

how-claude-code-works.md +239 −0 created

Details

1# How Claude Code works

2 

3> Understand the agentic loop, built-in tools, and how Claude Code interacts with your project.

4 

5Claude Code is an agentic assistant that runs in your terminal. While it excels at coding, it can help with anything you can do from the command line: writing docs, running builds, searching files, researching topics, and more.

6 

7This guide covers the core architecture, built-in capabilities, and [tips for working effectively](#work-effectively-with-claude-code). For step-by-step walkthroughs, see [Common workflows](/en/common-workflows). For extensibility features like skills, MCP, and hooks, see [Extend Claude Code](/en/features-overview).

8 

9## The agentic loop

10 

11When you give Claude a task, it works through three phases: **gather context**, **take action**, and **verify results**. These phases blend together. Claude uses tools throughout, whether searching files to understand your code, editing to make changes, or running tests to check its work.

12 

13<img src="https://mintcdn.com/claude-code/ELkJZG54dIaeldDC/images/agentic-loop.svg?fit=max&auto=format&n=ELkJZG54dIaeldDC&q=85&s=e30acfc80d6ff01ec877dd19c7af58b2" alt="The agentic loop: Your prompt leads to Claude gathering context, taking action, verifying results, and repeating until task complete. You can interrupt at any point." data-og-width="720" width="720" data-og-height="280" height="280" data-path="images/agentic-loop.svg" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/claude-code/ELkJZG54dIaeldDC/images/agentic-loop.svg?w=280&fit=max&auto=format&n=ELkJZG54dIaeldDC&q=85&s=8620f6ebce761a1e8bbf7f0a0255cc15 280w, https://mintcdn.com/claude-code/ELkJZG54dIaeldDC/images/agentic-loop.svg?w=560&fit=max&auto=format&n=ELkJZG54dIaeldDC&q=85&s=7b46b5ff4454aa4a03725eee625b39a0 560w, https://mintcdn.com/claude-code/ELkJZG54dIaeldDC/images/agentic-loop.svg?w=840&fit=max&auto=format&n=ELkJZG54dIaeldDC&q=85&s=7fa0397bc37d147e3bf3bb6296c6477f 840w, https://mintcdn.com/claude-code/ELkJZG54dIaeldDC/images/agentic-loop.svg?w=1100&fit=max&auto=format&n=ELkJZG54dIaeldDC&q=85&s=73b2a7040c4c93821c4d5bbee9f4a2d4 1100w, https://mintcdn.com/claude-code/ELkJZG54dIaeldDC/images/agentic-loop.svg?w=1650&fit=max&auto=format&n=ELkJZG54dIaeldDC&q=85&s=17703cbeb6f59b40a00ab24f56d5f8f9 1650w, https://mintcdn.com/claude-code/ELkJZG54dIaeldDC/images/agentic-loop.svg?w=2500&fit=max&auto=format&n=ELkJZG54dIaeldDC&q=85&s=20dedb60b95d45a1bd60a0cccaf3e1ff 2500w" />

14 

15The loop adapts to what you ask. A question about your codebase might only need context gathering. A bug fix cycles through all three phases repeatedly. A refactor might involve extensive verification. Claude decides what each step requires based on what it learned from the previous step, chaining dozens of actions together and course-correcting along the way.

16 

17You're part of this loop too. You can interrupt at any point to steer Claude in a different direction, provide additional context, or ask it to try a different approach. Claude works autonomously but stays responsive to your input.

18 

19The agentic loop is powered by two components: [models](#models) that reason and [tools](#tools) that act. Claude Code serves as the **agentic harness** around Claude: it provides the tools, context management, and execution environment that turn a language model into a capable coding agent.

20 

21### Models

22 

23Claude Code uses Claude models to understand your code and reason about tasks. Claude can read code in any language, understand how components connect, and figure out what needs to change to accomplish your goal. For complex tasks, it breaks work into steps, executes them, and adjusts based on what it learns.

24 

25[Multiple models](/en/model-config) are available with different tradeoffs. Sonnet handles most coding tasks well. Opus provides stronger reasoning for complex architectural decisions. Switch with `/model` during a session or start with `claude --model <name>`.

26 

27When this guide says "Claude chooses" or "Claude decides," it's the model doing the reasoning.

28 

29### Tools

30 

31Tools are what make Claude Code agentic. Without tools, Claude can only respond with text. With tools, Claude can act: read your code, edit files, run commands, search the web, and interact with external services. Each tool use returns information that feeds back into the loop, informing Claude's next decision.

32 

33The built-in tools generally fall into four categories, each representing a different kind of agency.

34 

35| Category | What Claude can do |

36| ------------------- | ------------------------------------------------------------------- |

37| **File operations** | Read files, edit code, create new files, rename and reorganize |

38| **Search** | Find files by pattern, search content with regex, explore codebases |

39| **Execution** | Run shell commands, start servers, run tests, use git |

40| **Web** | Search the web, fetch documentation, look up error messages |

41 

42These are the primary capabilities. Claude also has tools for spawning subagents, asking you questions, and other orchestration tasks. See [Tools available to Claude](/en/settings#tools-available-to-claude) for the complete list.

43 

44Claude chooses which tools to use based on your prompt and what it learns along the way. When you say "fix the failing tests," Claude might:

45 

461. Run the test suite to see what's failing

472. Read the error output

483. Search for the relevant source files

494. Read those files to understand the code

505. Edit the files to fix the issue

516. Run the tests again to verify

52 

53Each tool use gives Claude new information that informs the next step. This is the agentic loop in action.

54 

55**Extending the base capabilities:** The built-in tools are the foundation. You can extend what Claude knows with [skills](/en/skills), connect to external services with [MCP](/en/mcp), automate workflows with [hooks](/en/hooks), and offload tasks to [subagents](/en/sub-agents). These extensions form a layer on top of the core agentic loop. See [Extend Claude Code](/en/features-overview) for guidance on choosing the right extension for your needs.

56 

57## What Claude can access

58 

59This guide focuses on the terminal. Claude Code also runs in [VS Code, JetBrains IDEs, and other environments](/en/ide-integrations).

60 

61When you run `claude` in a directory, Claude Code gains access to:

62 

63* **Your project.** Files in your directory and subdirectories, plus files elsewhere with your permission.

64* **Your terminal.** Any command you could run: build tools, git, package managers, system utilities, scripts. If you can do it from the command line, Claude can too.

65* **Your git state.** Current branch, uncommitted changes, and recent commit history.

66* **Your [CLAUDE.md](/en/memory).** A markdown file where you store project-specific instructions, conventions, and context that Claude should know every session.

67* **Extensions you configure.** [MCP servers](/en/mcp) for external services, [skills](/en/skills) for workflows, [subagents](/en/sub-agents) for delegated work, and [Claude in Chrome](/en/chrome) for browser interaction.

68 

69Because Claude sees your whole project, it can work across it. When you ask Claude to "fix the authentication bug," it searches for relevant files, reads multiple files to understand context, makes coordinated edits across them, runs tests to verify the fix, and commits the changes if you ask. This is different from inline code assistants that only see the current file.

70 

71## Work with sessions

72 

73Claude Code saves your conversation locally as you work. Each message, tool use, and result is stored, which enables [rewinding](#undo-changes-with-checkpoints), [resuming, and forking](#resume-or-fork-sessions) sessions. Before Claude makes code changes, it also snapshots the affected files so you can revert if needed.

74 

75**Sessions are ephemeral.** Unlike claude.ai, Claude Code has no persistent memory between sessions. Each new session starts fresh. Claude doesn't "learn" your preferences over time or remember what you worked on last week. If you want Claude to know something across sessions, put it in your [CLAUDE.md](/en/memory).

76 

77### Work across branches

78 

79Each Claude Code conversation is a session tied to your current directory. When you resume, you only see sessions from that directory.

80 

81Claude sees your current branch's files. When you switch branches, Claude sees the new branch's files, but your conversation history stays the same. Claude remembers what you discussed even after switching.

82 

83Since sessions are tied to directories, you can run parallel Claude sessions by using [git worktrees](/en/common-workflows#run-parallel-claude-code-sessions-with-git-worktrees), which create separate directories for individual branches.

84 

85### Resume or fork sessions

86 

87When you resume a session with `claude --continue` or `claude --resume`, you pick up where you left off using the same session ID. New messages append to the existing conversation. Your full conversation history is restored, but session-scoped permissions are not. You'll need to re-approve those.

88 

89<img src="https://mintcdn.com/claude-code/ELkJZG54dIaeldDC/images/session-continuity.svg?fit=max&auto=format&n=ELkJZG54dIaeldDC&q=85&s=f671b603cc856119c95475b9084ebfef" alt="Session continuity: resume continues the same session, fork creates a new branch with a new ID." data-og-width="560" width="560" data-og-height="280" height="280" data-path="images/session-continuity.svg" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/claude-code/ELkJZG54dIaeldDC/images/session-continuity.svg?w=280&fit=max&auto=format&n=ELkJZG54dIaeldDC&q=85&s=bddf1f33d419a27d7427acdf06058804 280w, https://mintcdn.com/claude-code/ELkJZG54dIaeldDC/images/session-continuity.svg?w=560&fit=max&auto=format&n=ELkJZG54dIaeldDC&q=85&s=417478eb9b86003b8eebaac058a8618a 560w, https://mintcdn.com/claude-code/ELkJZG54dIaeldDC/images/session-continuity.svg?w=840&fit=max&auto=format&n=ELkJZG54dIaeldDC&q=85&s=1d89d26e2c0487f067d187c3fa5f7170 840w, https://mintcdn.com/claude-code/ELkJZG54dIaeldDC/images/session-continuity.svg?w=1100&fit=max&auto=format&n=ELkJZG54dIaeldDC&q=85&s=8ea739a1f7860e4edbbcf74d444e37b2 1100w, https://mintcdn.com/claude-code/ELkJZG54dIaeldDC/images/session-continuity.svg?w=1650&fit=max&auto=format&n=ELkJZG54dIaeldDC&q=85&s=9cb5095d6a8920f04c3b78d31a69c809 1650w, https://mintcdn.com/claude-code/ELkJZG54dIaeldDC/images/session-continuity.svg?w=2500&fit=max&auto=format&n=ELkJZG54dIaeldDC&q=85&s=d67e1744e4878813d20c6c3f39d9459d 2500w" />

90 

91To branch off and try a different approach without affecting the original session, use the `--fork-session` flag:

92 

93```bash theme={null}

94claude --continue --fork-session

95```

96 

97This creates a new session ID while preserving the conversation history up to that point. The original session remains unchanged. Like resume, forked sessions don't inherit session-scoped permissions.

98 

99**Same session in multiple terminals**: If you resume the same session in multiple terminals, both terminals write to the same session file. Messages from both get interleaved, like two people writing in the same notebook. Nothing corrupts, but the conversation becomes jumbled. Each terminal only sees its own messages during the session, but if you resume that session later, you'll see everything interleaved. For parallel work from the same starting point, use `--fork-session` to give each terminal its own clean session.

100 

101### The context window

102 

103Claude's context window holds your conversation history, file contents, command outputs, [CLAUDE.md](/en/memory), loaded skills, and system instructions. As you work, context fills up. Claude compacts automatically, but instructions from early in the conversation can get lost. Put persistent rules in CLAUDE.md, and run `/context` to see what's using space.

104 

105#### When context fills up

106 

107Claude Code manages context automatically as you approach the limit. It clears older tool outputs first, then summarizes the conversation if needed. Your requests and key code snippets are preserved; detailed instructions from early in the conversation may be lost. Put persistent rules in CLAUDE.md rather than relying on conversation history.

108 

109To control what's preserved during compaction, add a "Compact Instructions" section to CLAUDE.md or run `/compact` with a focus (like `/compact focus on the API changes`).

110 

111Run `/context` to see what's using space. MCP servers add tool definitions to every request, so a few servers can consume significant context before you start working. Run `/mcp` to check per-server costs.

112 

113#### Manage context with skills and subagents

114 

115Beyond compaction, you can use other features to control what loads into context.

116 

117[Skills](/en/skills) load on demand. Claude sees skill descriptions at session start, but the full content only loads when a skill is used. For skills you invoke manually, set `disable-model-invocation: true` to keep descriptions out of context until you need them.

118 

119[Subagents](/en/sub-agents) get their own fresh context, completely separate from your main conversation. Their work doesn't bloat your context. When done, they return a summary. This isolation is why subagents help with long sessions.

120 

121See [context costs](/en/features-overview#understand-context-costs) for what each feature costs, and [reduce token usage](/en/costs#reduce-token-usage) for tips on managing context.

122 

123## Stay safe with checkpoints and permissions

124 

125Claude has two safety mechanisms: checkpoints let you undo file changes, and permissions control what Claude can do without asking.

126 

127### Undo changes with checkpoints

128 

129**Every file edit is reversible.** Before Claude edits any file, it snapshots the current contents. If something goes wrong, press `Esc` twice to rewind to a previous state, or ask Claude to undo.

130 

131Checkpoints are local to your session, separate from git. They only cover file changes. Actions that affect remote systems (databases, APIs, deployments) can't be checkpointed, which is why Claude asks before running commands with external side effects.

132 

133### Control what Claude can do

134 

135Press `Shift+Tab` to cycle through permission modes:

136 

137* **Default**: Claude asks before file edits and shell commands

138* **Auto-accept edits**: Claude edits files without asking, still asks for commands

139* **Plan mode**: Claude uses read-only tools only, creating a plan you can approve before execution

140 

141You can also allow specific commands in `.claude/settings.json` so Claude doesn't ask each time. This is useful for trusted commands like `npm test` or `git status`. Settings can be scoped from organization-wide policies down to personal preferences. See [Permissions](/en/iam) for details.

142 

143***

144 

145## Work effectively with Claude Code

146 

147These tips help you get better results from Claude Code.

148 

149### Ask Claude Code for help

150 

151Claude Code can teach you how to use it. Ask questions like "how do I set up hooks?" or "what's the best way to structure my CLAUDE.md?" and Claude will explain.

152 

153Built-in commands also guide you through setup:

154 

155* `/init` walks you through creating a CLAUDE.md for your project

156* `/agents` helps you configure custom subagents

157* `/doctor` diagnoses common issues with your installation

158 

159### It's a conversation

160 

161Claude Code is conversational. You don't need perfect prompts. Start with what you want, then refine:

162 

163```

164> Fix the login bug

165 

166[Claude investigates, tries something]

167 

168> That's not quite right. The issue is in the session handling.

169 

170[Claude adjusts approach]

171```

172 

173When the first attempt isn't right, you don't start over. You iterate.

174 

175#### Interrupt and steer

176 

177You can interrupt Claude at any point. If it's going down the wrong path, just type your correction and press Enter. Claude will stop what it's doing and adjust its approach based on your input. You don't have to wait for it to finish or start over.

178 

179### Be specific upfront

180 

181The more precise your initial prompt, the fewer corrections you'll need. Reference specific files, mention constraints, and point to example patterns.

182 

183```

184> The checkout flow is broken for users with expired cards.

185> Check src/payments/ for the issue, especially token refresh.

186> Write a failing test first, then fix it.

187```

188 

189Vague prompts like "fix the login bug" work, but you'll spend more time steering. Specific prompts like the above often succeed on the first attempt.

190 

191### Give Claude something to verify against

192 

193Claude performs better when it can check its own work. Include test cases, paste screenshots of expected UI, or define the output you want.

194 

195```

196> Implement validateEmail. Test cases: 'user@example.com' → true,

197> 'invalid' → false, 'user@.com' → false. Run the tests after.

198```

199 

200For visual work, paste a screenshot of the design and ask Claude to compare its implementation against it.

201 

202### Explore before implementing

203 

204For complex problems, separate research from coding. Use plan mode (`Shift+Tab` twice) to analyze the codebase first:

205 

206```

207> Read src/auth/ and understand how we handle sessions.

208> Then create a plan for adding OAuth support.

209```

210 

211Review the plan, refine it through conversation, then let Claude implement. This two-phase approach produces better results than jumping straight to code.

212 

213### Delegate, don't dictate

214 

215Think of delegating to a capable colleague. Give context and direction, then trust Claude to figure out the details:

216 

217```

218> The checkout flow is broken for users with expired cards.

219> The relevant code is in src/payments/. Can you investigate and fix it?

220```

221 

222You don't need to specify which files to read or what commands to run. Claude figures that out.

223 

224## What's next

225 

226<CardGroup cols={2}>

227 <Card title="Extend with features" icon="puzzle-piece" href="/en/features-overview">

228 Add Skills, MCP connections, and custom commands

229 </Card>

230 

231 <Card title="Common workflows" icon="graduation-cap" href="/en/common-workflows">

232 Step-by-step guides for typical tasks

233 </Card>

234</CardGroup>

235 

236 

237---

238 

239> To find navigation and other pages in this documentation, fetch the llms.txt file at: https://code.claude.com/docs/llms.txt

memory.md +1 −1

Details

10 10 

11| Memory Type | Location | Purpose | Use Case Examples | Shared With |11| Memory Type | Location | Purpose | Use Case Examples | Shared With |

12| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------- | -------------------------------------------------------------------- | ------------------------------- |12| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------- | -------------------------------------------------------------------- | ------------------------------- |

13| **Enterprise policy** | • macOS: `/Library/Application Support/ClaudeCode/CLAUDE.md`<br />• Linux: `/etc/claude-code/CLAUDE.md`<br />• Windows: `C:\Program Files\ClaudeCode\CLAUDE.md` | Organization-wide instructions managed by IT/DevOps | Company coding standards, security policies, compliance requirements | All users in organization |13| **Managed policy** | • macOS: `/Library/Application Support/ClaudeCode/CLAUDE.md`<br />• Linux: `/etc/claude-code/CLAUDE.md`<br />• Windows: `C:\Program Files\ClaudeCode\CLAUDE.md` | Organization-wide instructions managed by IT/DevOps | Company coding standards, security policies, compliance requirements | All users in organization |

14| **Project memory** | `./CLAUDE.md` or `./.claude/CLAUDE.md` | Team-shared instructions for the project | Project architecture, coding standards, common workflows | Team members via source control |14| **Project memory** | `./CLAUDE.md` or `./.claude/CLAUDE.md` | Team-shared instructions for the project | Project architecture, coding standards, common workflows | Team members via source control |

15| **Project rules** | `./.claude/rules/*.md` | Modular, topic-specific project instructions | Language-specific guidelines, testing conventions, API standards | Team members via source control |15| **Project rules** | `./.claude/rules/*.md` | Modular, topic-specific project instructions | Language-specific guidelines, testing conventions, API standards | Team members via source control |

16| **User memory** | `~/.claude/CLAUDE.md` | Personal preferences for all projects | Code styling preferences, personal tooling shortcuts | Just you (all projects) |16| **User memory** | `~/.claude/CLAUDE.md` | Personal preferences for all projects | Code styling preferences, personal tooling shortcuts | Just you (all projects) |

Details

115* `Stop`: When Claude attempts to stop115* `Stop`: When Claude attempts to stop

116* `SubagentStart`: When a subagent is started116* `SubagentStart`: When a subagent is started

117* `SubagentStop`: When a subagent attempts to stop117* `SubagentStop`: When a subagent attempts to stop

118* `Setup`: When `--init`, `--init-only`, or `--maintenance` flags are used

118* `SessionStart`: At the beginning of sessions119* `SessionStart`: At the beginning of sessions

119* `SessionEnd`: At the end of sessions120* `SessionEnd`: At the end of sessions

120* `PreCompact`: Before conversation history is compacted121* `PreCompact`: Before conversation history is compacted

sub-agents.md +3 −3

Details

202| `description` | Yes | When Claude should delegate to this subagent |202| `description` | Yes | When Claude should delegate to this subagent |

203| `tools` | No | [Tools](#available-tools) the subagent can use. Inherits all tools if omitted |203| `tools` | No | [Tools](#available-tools) the subagent can use. Inherits all tools if omitted |

204| `disallowedTools` | No | Tools to deny, removed from inherited or specified list |204| `disallowedTools` | No | Tools to deny, removed from inherited or specified list |

205| `model` | No | [Model](#choose-a-model) to use: `sonnet`, `opus`, `haiku`, or `inherit`. Defaults to `sonnet` |205| `model` | No | [Model](#choose-a-model) to use: `sonnet`, `opus`, `haiku`, or `inherit`. Defaults to `inherit` |

206| `permissionMode` | No | [Permission mode](#permission-modes): `default`, `acceptEdits`, `dontAsk`, `bypassPermissions`, or `plan` |206| `permissionMode` | No | [Permission mode](#permission-modes): `default`, `acceptEdits`, `dontAsk`, `bypassPermissions`, or `plan` |

207| `skills` | No | [Skills](/en/skills) to load into the subagent's context at startup. The full skill content is injected, not just made available for invocation. Subagents don't inherit skills from the parent conversation |207| `skills` | No | [Skills](/en/skills) to load into the subagent's context at startup. The full skill content is injected, not just made available for invocation. Subagents don't inherit skills from the parent conversation |

208| `hooks` | No | [Lifecycle hooks](#define-hooks-for-subagents) scoped to this subagent |208| `hooks` | No | [Lifecycle hooks](#define-hooks-for-subagents) scoped to this subagent |


212The `model` field controls which [AI model](/en/model-config) the subagent uses:212The `model` field controls which [AI model](/en/model-config) the subagent uses:

213 213 

214* **Model alias**: Use one of the available aliases: `sonnet`, `opus`, or `haiku`214* **Model alias**: Use one of the available aliases: `sonnet`, `opus`, or `haiku`

215* **inherit**: Use the same model as the main conversation (useful for consistency)215* **inherit**: Use the same model as the main conversation

216* **Omitted**: If not specified, uses the default model configured for subagents (`sonnet`)216* **Omitted**: If not specified, defaults to `inherit` (uses the same model as the main conversation)

217 217 

218### Control subagent capabilities218### Control subagent capabilities

219 219 

Details

1532. Close Claude Code1532. Close Claude Code

1543. Restart with `claude` and complete the authentication process again1543. Restart with `claude` and complete the authentication process again

155 155 

156If the browser doesn't open automatically during login, press `c` to copy the OAuth URL to your clipboard, then paste it into your browser manually.

157 

156If problems persist, try:158If problems persist, try:

157 159 

158```bash theme={null}160```bash theme={null}