148 Run `/init` to generate a starter CLAUDE.md file based on your current project structure, then refine over time.148 Run `/init` to generate a starter CLAUDE.md file based on your current project structure, then refine over time.
149</Tip>149</Tip>
150 150
151CLAUDE.md is a special file that Claude reads at the start of every conversation. Include Bash commands, code style, and workflow rules. This gives Claude persistent context **it can't infer from code alone**.151CLAUDE.md is a special file that Claude reads at the start of every conversation. Include Bash commands, code style, and workflow rules. This gives Claude persistent context it can't infer from code alone.
152 152
153The `/init` command analyzes your codebase to detect build systems, test frameworks, and code patterns, giving you a solid foundation to refine.153The `/init` command analyzes your codebase to detect build systems, test frameworks, and code patterns, giving you a solid foundation to refine.
154 154
194 194
195You can place CLAUDE.md files in several locations:195You can place CLAUDE.md files in several locations:
196 196
197* **Home folder (`~/.claude/CLAUDE.md`)**: Applies to all Claude sessions197* **Home folder (`~/.claude/CLAUDE.md`)**: applies to all Claude sessions
198* **Project root (`./CLAUDE.md`)**: Check into git to share with your team, or name it `CLAUDE.local.md` and `.gitignore` it198* **Project root (`./CLAUDE.md`)**: check into git to share with your team, or name it `CLAUDE.local.md` and `.gitignore` it
199* **Parent directories**: Useful for monorepos where both `root/CLAUDE.md` and `root/foo/CLAUDE.md` are pulled in automatically199* **Parent directories**: useful for monorepos where both `root/CLAUDE.md` and `root/foo/CLAUDE.md` are pulled in automatically
200* **Child directories**: Claude pulls in child CLAUDE.md files on demand when working with files in those directories200* **Child directories**: Claude pulls in child CLAUDE.md files on demand when working with files in those directories
201 201
202### Configure permissions202### Configure permissions
207 207
208By default, Claude Code requests permission for actions that might modify your system: file writes, Bash commands, MCP tools, etc. This is safe but tedious. After the tenth approval you're not really reviewing anymore, you're just clicking through. There are two ways to reduce these interruptions:208By default, Claude Code requests permission for actions that might modify your system: file writes, Bash commands, MCP tools, etc. This is safe but tedious. After the tenth approval you're not really reviewing anymore, you're just clicking through. There are two ways to reduce these interruptions:
209 209
210* **Permission allowlists**: Permit specific tools you know are safe (like `npm run lint` or `git commit`)210* **Permission allowlists**: permit specific tools you know are safe (like `npm run lint` or `git commit`)
211* **Sandboxing**: Enable OS-level isolation that restricts filesystem and network access, allowing Claude to work more freely within defined boundaries211* **Sandboxing**: enable OS-level isolation that restricts filesystem and network access, allowing Claude to work more freely within defined boundaries
212 212
213Alternatively, use `--dangerously-skip-permissions` to bypass all permission checks for contained workflows like fixing lint errors or generating boilerplate.213Alternatively, use `--dangerously-skip-permissions` to bypass all permission checks for contained workflows like fixing lint errors or generating boilerplate.
214 214
216 Letting Claude run arbitrary commands can result in data loss, system corruption, or data exfiltration via prompt injection. Only use `--dangerously-skip-permissions` in a sandbox without internet access.216 Letting Claude run arbitrary commands can result in data loss, system corruption, or data exfiltration via prompt injection. Only use `--dangerously-skip-permissions` in a sandbox without internet access.
217</Warning>217</Warning>
218 218
219Read more about [configuring permissions](/en/settings) and [enabling sandboxing](/en/sandboxing#sandboxing).219Read more about [configuring permissions](/en/permissions) and [enabling sandboxing](/en/sandboxing).
220 220
221### Use CLI tools221### Use CLI tools
222 222
356 356
357Claude asks about things you might not have considered yet, including technical implementation, UI/UX, edge cases, and tradeoffs.357Claude asks about things you might not have considered yet, including technical implementation, UI/UX, edge cases, and tradeoffs.
358 358
359```359```text theme={null}
360I want to build [brief description]. Interview me in detail using the AskUserQuestion tool.360I want to build [brief description]. Interview me in detail using the AskUserQuestion tool.
361 361
362Ask about technical implementation, UI/UX, edge cases, concerns, and tradeoffs. Don't ask obvious questions, dig into the hard parts I might not have considered.362Ask about technical implementation, UI/UX, edge cases, concerns, and tradeoffs. Don't ask obvious questions, dig into the hard parts I might not have considered.
380 380
381The best results come from tight feedback loops. Though Claude occasionally solves problems perfectly on the first attempt, correcting it quickly generally produces better solutions faster.381The best results come from tight feedback loops. Though Claude occasionally solves problems perfectly on the first attempt, correcting it quickly generally produces better solutions faster.
382 382
383* **`Esc`**: Stop Claude mid-action with the `Esc` key. Context is preserved, so you can redirect.383* **`Esc`**: stop Claude mid-action with the `Esc` key. Context is preserved, so you can redirect.
384* **`Esc + Esc` or `/rewind`**: Press `Esc` twice or run `/rewind` to open the rewind menu and restore previous conversation and code state, or summarize from a selected message.384* **`Esc + Esc` or `/rewind`**: press `Esc` twice or run `/rewind` to open the rewind menu and restore previous conversation and code state, or summarize from a selected message.
385* **`"Undo that"`**: Have Claude revert its changes.385* **`"Undo that"`**: have Claude revert its changes.
386* **`/clear`**: Reset context between unrelated tasks. Long sessions with irrelevant context can reduce performance.386* **`/clear`**: reset context between unrelated tasks. Long sessions with irrelevant context can reduce performance.
387 387
388If you've corrected Claude more than twice on the same issue in one session, the context is cluttered with failed approaches. Run `/clear` and start fresh with a more specific prompt that incorporates what you learned. A clean session with a better prompt almost always outperforms a long session with accumulated corrections.388If you've corrected Claude more than twice on the same issue in one session, the context is cluttered with failed approaches. Run `/clear` and start fresh with a more specific prompt that incorporates what you learned. A clean session with a better prompt almost always outperforms a long session with accumulated corrections.
389 389
411 411
412Since context is your fundamental constraint, subagents are one of the most powerful tools available. When Claude researches a codebase it reads lots of files, all of which consume your context. Subagents run in separate context windows and report back summaries:412Since context is your fundamental constraint, subagents are one of the most powerful tools available. When Claude researches a codebase it reads lots of files, all of which consume your context. Subagents run in separate context windows and report back summaries:
413 413
414```414```text theme={null}
415Use subagents to investigate how our authentication system handles token415Use subagents to investigate how our authentication system handles token
416refresh, and whether we have any existing OAuth utilities I should reuse.416refresh, and whether we have any existing OAuth utilities I should reuse.
417```417```
420 420
421You can also use subagents for verification after Claude implements something:421You can also use subagents for verification after Claude implements something:
422 422
423```423```text theme={null}
424use a subagent to review this code for edge cases424use a subagent to review this code for edge cases
425```425```
426 426
444 Run `claude --continue` to pick up where you left off, or `--resume` to choose from recent sessions.444 Run `claude --continue` to pick up where you left off, or `--resume` to choose from recent sessions.
445</Tip>445</Tip>
446 446
447Claude Code saves conversations locally. When a task spans multiple sessions (you start a feature, get interrupted, come back the next day) you don't have to re-explain the context:447Claude Code saves conversations locally. When a task spans multiple sessions, you don't have to re-explain the context:
448 448
449```bash theme={null}449```bash theme={null}
450claude --continue # Resume the most recent conversation450claude --continue # Resume the most recent conversation
451claude --resume # Select from recent conversations451claude --resume # Select from recent conversations
452```452```
453 453
454Use `/rename` to give sessions descriptive names (`"oauth-migration"`, `"debugging-memory-leak"`) so you can find them later. Treat sessions like branches. Different workstreams can have separate, persistent contexts.454Use `/rename` to give sessions descriptive names like `"oauth-migration"` or `"debugging-memory-leak"` so you can find them later. Treat sessions like branches: different workstreams can have separate, persistent contexts.
455 455
456***456***
457 457
458## Automate and scale458## Automate and scale
459 459
460Once you're effective with one Claude, multiply your output with parallel sessions, headless mode, and fan-out patterns.460Once you're effective with one Claude, multiply your output with parallel sessions, non-interactive mode, and fan-out patterns.
461 461
462Everything so far assumes one human, one Claude, and one conversation. But Claude Code scales horizontally. The techniques in this section show how you can get more done.462Everything so far assumes one human, one Claude, and one conversation. But Claude Code scales horizontally. The techniques in this section show how you can get more done.
463 463
464### Run headless mode464### Run non-interactive mode
465 465
466<Tip>466<Tip>
467 Use `claude -p "prompt"` in CI, pre-commit hooks, or scripts. Add `--output-format stream-json` for streaming JSON output.467 Use `claude -p "prompt"` in CI, pre-commit hooks, or scripts. Add `--output-format stream-json` for streaming JSON output.
468</Tip>468</Tip>
469 469
470With `claude -p "your prompt"`, you can run Claude headlessly, without an interactive session. Headless mode is how you integrate Claude into CI pipelines, pre-commit hooks, or any automated workflow. The output formats (plain text, JSON, streaming JSON) let you parse results programmatically.470With `claude -p "your prompt"`, you can run Claude non-interactively, without a session. Non-interactive mode is how you integrate Claude into CI pipelines, pre-commit hooks, or any automated workflow. The output formats let you parse results programmatically: plain text, JSON, or streaming JSON.
471 471
472```bash theme={null}472```bash theme={null}
473# One-off queries473# One-off queries
539 539
540Use `--verbose` for debugging during development, and turn it off in production.540Use `--verbose` for debugging during development, and turn it off in production.
541 541
542### Safe Autonomous Mode542### Safe autonomous mode
543 543
544Use `claude --dangerously-skip-permissions` to bypass all permission checks and let Claude work uninterrupted. This works well for workflows like fixing lint errors or generating boilerplate code.544Use `claude --dangerously-skip-permissions` to bypass all permission checks and let Claude work uninterrupted. This works well for workflows like fixing lint errors or generating boilerplate code.
545 545
580 580
581## Related resources581## Related resources
582 582
583<CardGroup cols={2}>583* [How Claude Code works](/en/how-claude-code-works): the agentic loop, tools, and context management
584 <Card title="How Claude Code works" icon="gear" href="/en/how-claude-code-works">584* [Extend Claude Code](/en/features-overview): skills, hooks, MCP, subagents, and plugins
585 Understand the agentic loop, tools, and context management585* [Common workflows](/en/common-workflows): step-by-step recipes for debugging, testing, PRs, and more
586 </Card>586* [CLAUDE.md](/en/memory): store project conventions and persistent context
587
588 <Card title="Extend Claude Code" icon="puzzle-piece" href="/en/features-overview">
589 Choose between skills, hooks, MCP, subagents, and plugins
590 </Card>
591
592 <Card title="Common workflows" icon="list-check" href="/en/common-workflows">
593 Step-by-step recipes for debugging, testing, PRs, and more
594 </Card>
595
596 <Card title="CLAUDE.md" icon="file-lines" href="/en/memory">
597 Store project conventions and persistent context
598 </Card>
599</CardGroup>