Skip to content

Claude Code Complete Guide

Claude Code Complete Command Reference | CLI, Slash Commands & Shortcuts Cheat Sheet [2026 Edition]

Claude Code is Anthropic's AI coding assistant CLI tool. This article provides a comprehensive reference covering CLI commands and flags, slash commands, keyboard shortcuts, and configuration files, all organized by usage frequency (5-star rating). The structure is designed so you can prioritize learning the features you use most in day-to-day work.

Audience: Engineers using Claude Code in production or evaluating it for team adoption

Key Takeaways

  • Complete coverage of CLI commands and flags All terminal options listed, from launch commands to sub-agent definitions
  • All slash commands organized by category In-session commands like /compact, /fast, /plan, and more, categorized by purpose
  • Keyboard shortcuts & configuration file quick reference Shortcuts for boosting efficiency and the configuration structure needed for team workflows

How to Read This Article

GoalSections to Read
Check basic commandsCLI Commands then Slash Commands
Use for automationCLI Flags > Output Control then Environment Variables then DevOps Workflows
Look up settingsConfiguration File Structure then Hook Configuration
Quick referenceShortcuts then Prompt Notation

Start Here: Most Readers Need One Answer, Not the Whole Reference

If you only need one workflow or one fix, the targeted guides above are faster. Stay on this page when you want the full command, shortcut, and config cheat sheet.

Major Changes from the 2025 Edition

The 2026 edition adds or updates the following features:

  • Fast Mode (/fast): A new mode that runs Opus 4.6 at 2.5x speed
  • Agent Teams: Multi-agent definitions via the --agents flag
  • Skills: Integration of custom commands and skills (.claude/skills/)
  • Plugins: Extension management from the marketplace
  • Remote Control: Mobile operation via claude rc / /rc
  • Enhanced /rewind: Selective rollback for conversation only or code only
  • /keybindings: Customizable key bindings
  • /doctor: Environment diagnostics command
  • claude auth subcommands: login / status / logout
  • --from-pr: Resume sessions by PR number
  • --json-schema: Structured output validation
  • --worktree flag: Parallel session isolation via git worktree (v2.1.55+)
  • /simplify & /batch: Bundle slash commands (multi-agent review & parallel changes; v2.1.63+)
  • HTTP hooks: CI/CD integration via JSON POST to a URL (4th hook handler type)
  • /copy command: Code block selection and copy (SSH-friendly; v2.1.59+)
  • /effort command: Simplified effort levels (3 levels + auto)
  • Opus 4.6 effort default change: medium is now the default for Max/Team subscribers
  • ultrathink keyword reintroduction: High effort for the next turn only
  • /review, /pr-comments, /security-review: PR integration command suite
  • Worktree-aware hooks: WorktreeCreate / WorktreeRemove
  • InstructionsLoaded hook: Detects when CLAUDE.md is loaded

Usage Rating Criteria

  • ★★★★★: Used daily, directly impacts work efficiency
  • ★★★★☆: Used frequently, high value for specific use cases
  • ★★★☆☆: Used regularly, useful depending on the situation
  • ★★☆☆☆: Limited use, for specialized cases

CLI Commands (Run from Terminal)

A list of base commands and subcommands available when running the claude command in the terminal.

CommandDescriptionUsage
claudeStart an interactive session★★★★★
claude "question"Start with an initial prompt★★★★★
claude -p "question"Run in non-interactive mode and exit★★★★★
cat file \| claude -p "question"Pass input via pipe★★★★☆
claude -cResume the most recent session★★★★★
claude -r "ID"Resume a session by ID★★★☆☆
claude updateUpdate to the latest version★★★★☆
claude mcpManage MCP servers★★★★☆
claude auth loginAuthenticate (login)★★★☆☆
claude auth statusCheck authentication status★★★☆☆
claude auth logoutLog out★★☆☆☆
claude agentsList configured agents★★★☆☆
claude rcStart a Remote Control session★★★☆☆
claude plugin / claude pluginsPlugin management CLI (plugins is an alias)★★★☆☆

Session Management Tips

claude -c (continue) resumes the most recent session in the current directory. To return to a session from a different directory, specify the session ID with -r. Using --from-pr, you can directly resume a session linked to a specific Pull Request.

The next section covers how to control behavior with flags at launch time.


CLI Flags (Launch Options)

You can fine-tune Claude Code's behavior by passing flags at launch time. Organized by purpose below.

Session Control

FlagDescriptionUsage
--continue, -cResume the most recent session★★★★★
--resume, -rResume a session by ID★★★☆☆
--from-pr <PR>Resume by PR number or URL★★★★☆
--fork-sessionFork into a new session ID when resuming★★★☆☆
--session-id <UUID>Explicitly specify a session ID★★☆☆☆
--max-turns NSet the turn limit for non-interactive mode★★★★☆
--worktree, -wCreate a git worktree and isolate the session (foundation for parallel development; random name if omitted)★★★★★
--tmuxLaunch Claude Code inside a tmux session (combine with --worktree for parallel session management)★★★☆☆

Model & Mode Control

FlagDescriptionUsage
--model <name>Specify the model (sonnet, opus, haiku, or full name)★★★★☆
--fallback-model <name>Auto-fallback model during overload (print mode only)★★★☆☆
--permission-mode <mode>Set the permission mode at launch (e.g., plan)★★★☆☆

Output Control

FlagDescriptionUsage
--output-format jsonOutput in JSON format★★★★★
--output-format stream-jsonStreaming JSON output★★★☆☆
--output-format textText format (default)★★★★☆
--json-schema '<json>'Validate JSON against a specified schema after agent completion (print mode only)★★★☆☆
--verboseVerbose logging (show per-turn output)★★★★☆
--input-format <format>Specify input format (text, stream-json)★★☆☆☆
--include-partial-messagesInclude streaming intermediate events in output★★☆☆☆

System Prompt Control

Claude Code provides three types of system prompt flags for different use cases.

FlagBehaviorModeUsage
--system-prompt "..."Completely replaces the default promptInteractive + print★★★☆☆
--system-prompt-file <path>Completely replaces the prompt with file contentsPrint only★★★☆☆
--append-system-prompt "..."Appends to the end of the default promptInteractive + print★★★★☆

--system-prompt and --system-prompt-file cannot be used together

In most cases, --append-system-prompt is the safe choice. It lets you add custom instructions while keeping the default Claude Code capabilities. Use --system-prompt only when you need full control, as it removes all default instructions.

Security & Permission Control

FlagDescriptionUsage
--allowedTools <tools>Additional tools to allow★★★★★
--disallowedTools <tools>Additional tools to disallow★★★☆☆
--dangerously-skip-permissionsSkip all permission checks (increasingly discouraged as sandbox improves)★★☆☆☆
--permission-prompt-tool <tool>Specify a tool for handling permission prompts in non-interactive mode★★☆☆☆
--tools <tools>Explicitly specify the list of built-in tools to use ("" to disable all, "default" to enable all)★★☆☆☆

Conditions for using --dangerously-skip-permissions

Use only in trusted container environments. See the Auto-Approval Safe Usage Guide for details.

Agents & Extensions

FlagDescriptionUsage
--agent <name>Specify an agent for the session★★★☆☆
--agents '<json>'Define custom sub-agents in JSON★★★★★
--add-dir <path>Add extra working directories (multiple allowed)★★★☆☆
--mcp-config <path>Load MCP server config from a JSON file★★★☆☆
--strict-mcp-configUse only --mcp-config and ignore other MCP settings★★☆☆☆
--plugin-dir <path>Add a plugin directory for the session★★☆☆☆
--teleportTransfer a session over a remote connection★★☆☆☆

--agents Flag Format

The --agents flag defines one or more sub-agents as a JSON object.

FieldRequiredDescription
descriptionYesDescription of the sub-agent's purpose
promptYesSystem prompt for the sub-agent
tools-Array of available tools (inherits all tools if omitted)
model-Model specification (sonnet, opus, haiku)
claude --agents '{
  "code-reviewer": {
    "description": "コード変更後に自動レビュー",
    "prompt": "セキュリティ、パフォーマンス、ベストプラクティスに焦点を当てたコードレビューを行う。",
    "tools": ["Read", "Grep", "Glob", "Bash"],
    "model": "sonnet"
  },
  "debugger": {
    "description": "エラーとテスト失敗のデバッグ専門",
    "prompt": "エラーの根本原因を特定し修正案を提示する。"
  }
}'

Debug & Diagnostics

FlagDescriptionUsage
--debugEnable debug mode (supports category filtering)★★★☆☆
--debug "api,mcp"Debug specific categories only★★★☆☆
--debug "!statsig,!file"Exclude specific categories★★☆☆☆

Miscellaneous

FlagDescriptionUsage
--ideAuto-connect to IDE at launch (when only one valid IDE exists)★★☆☆☆
--setting-sources <list>Comma-separated list of setting sources to load★★☆☆☆
--settings <path>Additional settings JSON file or JSON string★★☆☆☆
--version, -vShow version★★☆☆☆
--betas <headers>Specify beta headers (for API key users)★★☆☆☆

Now that you have an overview of all CLI flags, the next section covers slash commands used within sessions.


Configuration Management Commands

CommandDescriptionUsage
claude config listDisplay all settings★★★☆☆
claude config get <key>Get a specific setting★★★☆☆
claude config set <key> <value>Update a setting★★★☆☆

MCP Server Management Commands

CommandDescriptionUsage
claude mcpInteractive MCP server setup (step-by-step)★★★★☆
claude mcp listList configured MCP servers★★★★☆
claude mcp add <n> <cmd>Add an MCP server (stdio transport)★★★★★
claude mcp add --transport sse <n> <url>Add an MCP server via SSE transport★★★☆☆
claude mcp add --transport http <n> <url>Add an MCP server via HTTP transport★★★☆☆
claude mcp add-json <n> '<json>'Add an MCP server from a JSON definition★★★★☆
claude mcp add-from-claude-desktopImport settings from Claude Desktop★★★☆☆
claude mcp remove <n>Remove an MCP server★★★☆☆
claude mcp serveRun Claude Code itself as an MCP server★★★☆☆

Adding OAuth-Compatible MCP Servers

For MCP servers that do not support Dynamic Client Registration (e.g., Slack), specify --client-id and --client-secret when adding.

# Add GitHub integration
claude mcp add github -- npx -y @modelcontextprotocol/server-github

# Add with scope specification (user scope)
claude mcp add github -s user \
  -e GITHUB_PERSONAL_ACCESS_TOKEN=your-token \
  -- npx -y @modelcontextprotocol/server-github

# Verify the configuration
claude mcp list

See MCP Integration Strategy for more details on MCP.


Slash Commands (In-Session Commands)

Commands executed within a Claude interactive session by typing / at the beginning. Type / to see the full list, then continue typing to filter.

Project Management

CommandDescriptionUsage
/initAuto-generate CLAUDE.md★★★★★
/memoryEdit the memory file (CLAUDE.md)★★★★☆
/contextVisualize context window usage★★★★☆
/compactCompress context (can specify what to retain)★★★★☆
/clearReset conversation history (CLAUDE.md is preserved)★★★★★
/resumeResume a past session (picker shows 50 entries; supports branch search; press R to rename)★★★★☆
/forkFork (branch) the current conversation into a new session★★★☆☆
/renameRename the session (auto-generates if no arguments)★★☆☆☆
/add-dir <path>Add a directory to the context★★★☆☆
/copySelect and copy code blocks (w key to write to file; especially useful in SSH environments)★★★★☆

Using /compact Effectively

/compact lets you specify what information to retain as an argument (e.g., /compact retain the error handling patterns). The general rule is: use /compact when context usage exceeds 80%, and /clear when switching tasks. Since v2.0.64, compaction completes instantly.

Information & Status

CommandDescriptionUsage
/usageCheck token usage against plan limits★★★★★
/costShow current session cost (token count and amount)★★★★★
/helpList available commands (including custom and MCP)★★★★☆
/tasksCheck background tasks★★★★☆
/doctorRun environment diagnostics (checks API connectivity, Node.js version, auth, MCP status, etc.)★★★☆☆
/statsGenerate usage statistics as an HTML report★★★☆☆
/debugDisplay troubleshooting information for the current session★★★☆☆
/effort <level>Switch thinking level (low/medium/high; /effort auto resets to default). Symbols: ○ ◐ ●★★★★☆
/extra-usageEnable additional usage capacity★★★☆☆

Mode & Model Control

CommandDescriptionUsage
/modelSwitch the model (sonnet, opus, haiku)★★★★☆
/fastToggle Fast Mode on/off (runs Opus 4.6 at 2.5x speed)★★★★☆
/plan [description]Toggle Plan Mode on/off (read-only planning mode; optional description argument starts planning immediately)★★★★★
/vimToggle Vim-style editing mode★★☆☆☆
/output-styleChange output style★★☆☆☆

About Fast Mode

Fast Mode is not a different model -- it runs the same Opus 4.6 with speed-optimized API settings. It is ideal for interactive rapid iteration and live debugging. Turn it off when cost efficiency matters. Note that when enabling Fast Mode mid-session, the entire prior context is re-billed at Fast Mode rates.

Effort default change (from March 2026): For Opus 4.6, the default effort level for Max/Team subscribers is now medium (previously high). Use /effort high or the ultrathink keyword to explicitly set high effort. Use /effort auto to reset to the default.

Feature Management

CommandDescriptionUsage
/hooksConfigure and manage hooks★★★★★
/agentsCreate and manage sub-agents★★★★★
/permissionsChange permission settings★★★★☆
/sandboxEnable sandbox execution mode★★★★☆
/configOpen settings interface (20+ configurable items)★★★☆☆
/loginRe-authenticate★★☆☆☆
/rewindRewind conversation and/or code changes★★★★☆

Enhanced /rewind (2026)

The 2026 update added the ability to select conversation-only rollback or code-only rollback in /rewind. Press Esc twice to bring up the rewind menu, then choose "Rewind code only" to revert code changes while keeping the conversation history. This is convenient for experimental refactoring and trial-and-error.

See the Hooks Complete Guide for hook details and Permission Management Overview for permission details.

Integration & Extensions

CommandDescriptionUsage
/install-github-appSet up GitHub PR auto-review★★★★☆
/pluginPlugin management (add, remove, marketplace)★★★☆☆
/mcpCheck MCP status / OAuth authentication★★★★☆
/rcSwitch the current session to Remote Control★★★☆☆
/review <PR#>Code review for a specified PR (requires gh CLI)★★★★☆
/pr-commentsShow PR comments for the current branch (GitHub CLI integration)★★★☆☆
/security-reviewSecurity audit of uncommitted changes (--merge-base error on old git is fixed)★★★★☆
/skillsSkill management menu (shows skills with plugin names)★★★☆☆

Bundle Commands (v2.1.63+)

Commands where multiple agents collaborate. Use for quality assurance before PRs and large-scale changes.

CommandDescriptionUsage
/simplify3-agent review pipeline (detects architectural issues, duplicate logic, performance inefficiencies; recommended before PRs)★★★★★
/batchLarge-scale parallel changes (parallel execution with worktree isolation → planning → parallel Worker launch → automatic PR creation; useful for migrations, pattern application, etc.)★★★★★

Environment Settings

CommandDescriptionUsage
/terminal-setupSet up Shift+Enter keybinding (for VS Code, Alacritty, Zed, Warp)★★★☆☆
/keybindingsOpen/create the keybindings configuration file★★★☆☆
/status-lineSet up the terminal status line★★☆☆☆

Custom Slash Commands (Skills)

In the 2026 edition, the traditional custom commands (.claude/commands/) and Skills (.claude/skills/) have been unified. Existing .claude/commands/ files continue to work. Skills add frontmatter-based auto-invocation control and support file management on top of commands.

LocationDescriptionUsage
.claude/skills/<name>/SKILL.mdProject skills (shared with team)★★★★★
~/.claude/skills/<name>/SKILL.mdPersonal skills★★★★☆
.claude/commands/<name>.mdLegacy command format (maintained for compatibility)★★★★☆
~/.claude/commands/<name>.mdPersonal commands (maintained for compatibility)★★★☆☆

Skills conform to the Agent Skills Open Standard and are designed to be shared across multiple AI tools.

See the Custom Slash Commands Design Guide for details on skill design.

Once you have mastered slash commands, the next step is to boost your operational efficiency with keyboard shortcuts.


Keyboard Shortcuts

Shortcuts available during interactive mode.

Basic Operations

ShortcutDescriptionUsage
EscStop processing★★★★★
Esc x 2Rewind menu (selective rollback for conversation/code)★★★★☆
EnterSend message★★★★★
Shift+EnterInsert a newline (natively supported in iTerm2, WezTerm, Ghostty, Kitty; others require /terminal-setup)★★★★☆
\ + EnterInsert a newline (works in all terminals)★★★★☆
UpBrowse command history★★★★☆
Ctrl+CFully exit session (press twice)★★★☆☆
Ctrl+FStop all background agents★★★☆☆
Ctrl+RReverse search command history★★★☆☆
Ctrl+YReadline-style paste (reinsert deleted text)★★☆☆☆
Ctrl+SStash the current prompt (temporarily save)★★☆☆☆
?Show available shortcuts★★★☆☆

Mode Switching

ShortcutDescriptionUsage
Shift+TabCycle modes (normal -> auto-accept -> plan)★★★★★
TabToggle extended thinking on/off (persists across sessions)★★★★☆
Ctrl+TToggle task list display★★★☆☆
Ctrl+OToggle verbose display on/off (shows thinking content)★★★☆☆
Ctrl+GOpen plan in an external text editor★★★☆☆
Shift+DownNavigate between teammates in Agent Teams★★★☆☆

Understanding Mode Switching

Each press of Shift+Tab cycles through normal-mode -> auto-accept on -> plan mode on. The current mode is displayed below the prompt.

File & Image Operations

ShortcutDescriptionUsage
Shift + DragAdd a file as a reference★★★★☆
Ctrl+VPaste an image from clipboard★★☆☆☆

Keybinding Customization

Use /keybindings to create or edit ~/.claude/keybindings.json. Changes take effect immediately without restarting Claude Code.

{
  "$schema": "https://www.schemastore.org/claude-code-keybindings.json",
  "bindings": [
    {
      "context": "Chat",
      "bindings": {
        "ctrl+e": "chat:externalEditor",
        "ctrl+u": null
      }
    }
  ]
}

Available actions include chat:submit, app:toggleTodos, chat:externalEditor, and many more. Setting a binding to null disables the default binding.


Prompt Notation

Special notation used when typing messages.

NotationDescriptionUsage
@<filename>Reference a file or directory (line range specification supported)★★★★★
@terminal:<name>Reference terminal output (VS Code extension)★★★☆☆
#<content>Add content to CLAUDE.md (with save location selection)★★★★★
!<command>Execute a shell command directly★★★★☆
& <task>Run a task in the background★★★☆☆
@src/main.py を参照して、エラーハンドリングを改善してください

#このプロジェクトではPEP8に準拠したコードスタイルを使用

!git status

& npm run dev

Extended Thinking

Extended thinking is enabled by default. Opus 4.6 introduces Adaptive Reasoning, which dynamically allocates thinking tokens based on effort level.

Control MethodDescriptionUsage
TabToggle extended thinking on/off during a session (persists across sessions)★★★★★
Ctrl+OShow/hide thinking content (verbose display)★★★★☆
CLAUDE_CODE_EFFORT_LEVEL env varControl thinking level with low / medium / high★★★★☆

Special Notation in Custom Commands (Skills)

NotationDescriptionUsage
$ARGUMENTSReceive arguments within a slash command★★★★★
$1, $2, ...Argument placeholders (by position)★★★★☆
!`command`Embed command execution results within a skill★★★★☆
---
argument-hint: [issue-number] [priority]
description: GitHub Issueを修正
allowed-tools: Bash(git:*), Read, Edit
---
## コンテキスト
- 現在のgit status: !`git status`
- 現在のブランチ: !`git branch --show-current`

Issue #$1 を優先度 $2 で修正してください。

Configuration Files and Directory Structure

Claude Code's configuration is composed of seven layers:

  1. CLAUDE.md: Project-specific instructions for Claude (team-shared / personal)
  2. Auto Memory: Notes automatically learned from conversations (~/.claude/projects/<project>/memory/)
  3. .claude/rules/: Modular rule files separated by condition
  4. settings.json: Permissions, allowed tools, hook settings, environment variables
  5. Hooks: Lifecycle events that automate terminal commands and scripts
  6. Skills: Custom slash commands and support files
  7. MCP: External tool integration (GitHub, DB, Sentry, etc.)

Best-Practice Directory Layout

your-project/
├── CLAUDE.md                 # Shared project instructions (git-managed)
├── CLAUDE.local.md           # Personal instructions (.gitignore recommended)
├── .mcp.json                 # Shared MCP config (git-managed)
├── .claude/                  # Claude Code management directory
│   ├── settings.json         # Project shared settings (git-managed)
│   ├── settings.local.json   # Project personal settings (.gitignore recommended)
│   ├── rules/                # Modular rules (git-managed)
│   │   ├── code-style.md
│   │   └── security.md
│   ├── skills/               # Custom skills (git-managed)
│   │   └── review-pr/
│   │       └── SKILL.md
│   ├── agents/               # Sub-agents (git-managed)
│   └── hooks/                # Hook scripts (git-managed)
└── ...

Auto Memory Control

Claude Code automatically saves context and decisions to ~/.claude/projects/<project>/memory/. The MEMORY.md index only loads the first 200 lines, so when it grows too long, Claude automatically splits it into topic files.

# Temporarily force-disable (environment variable)
CLAUDE_CODE_DISABLE_AUTO_MEMORY=1 claude
// Permanently disable per project via .claude/settings.json
{
  "autoMemoryEnabled": false
}

Settings Priority

Settings are applied in the following priority order (highest priority first):

PrioritySetting SourceDescription
1 (Highest)Managed (Admin settings)managed-settings.json (placed by enterprise admins)
2CLI OptionsCommand-line arguments like --model at launch
3Local.claude/settings.local.json (personal settings outside Git)
4Project.claude/settings.json (team-shared settings)
5 (Lowest)User~/.claude/settings.json (global personal settings)

Project-Specific (Team-Shared)

File / DirectoryDescriptionUsage
CLAUDE.mdProject context and rule definitions (<!-- --> comments are hidden from Claude during auto-injection but visible when explicitly read with the Read tool)★★★★★
.claude/settings.jsonProject settings (permissions, hooks, tools; shared across git worktrees)★★★★☆
.claude/commands/Custom slash commands★★★★★
.claude/skills/Skill definitions (SKILL.md + support files)★★★★★
.claude/agents/Sub-agent definitions (supports worktree isolation, memory frontmatter, and other extensions)★★★★★
.claude/rules/Split management of rule files★★★★☆
.claude/worktrees/Worktree working directories (auto-generated)★★★★☆
.mcp.jsonMCP server configuration★★★★★

Personal (Local)

File / DirectoryDescriptionUsage
.claude/settings.local.jsonLocal personal settings (outside Git)★★★★☆
~/.claude/CLAUDE.mdGlobal context★★★☆☆
~/.claude/commands/Personal slash commands★★★★☆
~/.claude/skills/Personal skills★★★☆☆
~/.claude/agents/Personal sub-agents★★★☆☆
~/.claude/settings.jsonUser global settings★★★☆☆
~/.claude/keybindings.jsonCustom keybinding settings★★★☆☆

Commit / PR Attribution Control

By default, Claude Code automatically adds attribution such as Co-Authored-By: Claude to Git commits and PRs created from the CLI. To remove it or customize the message to match your team's conventions, configure the "attribution" field in .claude/settings.json (or settings.local.json).

{
  "attribution": {
    "commit": "",       // Empty string to fully hide
    "pr": "Generated with Claude Code" // Custom message
  }
}
※ Setting this in ~/.claude/settings.json applies the behavior across all projects.

Hook Configuration

Hook events configured within .claude/settings.json (19 types total).

Core Events

Hook EventDescriptionUsage
PreToolUseRuns before tool use★★★★☆
PostToolUseRuns automatically after tool use★★★★★
PostToolUseFailureRuns when tool use fails★★★☆☆
StopRuns when the session ends★★★☆☆

Session & Permission Events

Hook EventDescriptionUsage
SessionStartOn session start★★★☆☆
SessionEndOn full session termination★★☆☆☆
UserPromptSubmitOn prompt submission★★★☆☆
PermissionRequestOn permission request★★★☆☆
NotificationOn notification★★☆☆☆
InstructionsLoadedWhen CLAUDE.md or .claude/rules/*.md is loaded into context★★★☆☆
ConfigChangeOn configuration change★★☆☆☆

Sub-Agent & Task Events

Hook EventDescriptionUsage
SubagentStartOn sub-agent launch★★★☆☆
SubagentStopOn sub-agent termination★★★☆☆
TeammateIdleWhen a teammate is idle in Agent Teams★★★☆☆
TaskCompletedOn task completion (critical for /batch completion notifications)★★★★☆
PreCompactBefore context compaction★★☆☆☆

Worktree Events (New Category)

Hook EventDescriptionUsage
WorktreeCreateOn worktree creation (supports custom VCS setup)★★★☆☆
WorktreeRemoveOn worktree removal★★☆☆☆

Hook Handler Types

TypeDescriptionPrimary Use
commandExecute a shell commandRunning linters, formatters
promptSend an additional prompt to ClaudeAutomated feedback
agentLaunch a sub-agentDelegation to specialized agents
httpPOST JSON to a URL and receive a JSON response (environment variable expansion via allowedEnvVars)CI/CD integration, stateless backend connectivity

See the Claude Code Hooks Complete Guide for hook details.

Enterprise Admin Settings (Managed Settings)

OSPath
macOS/Library/Application Support/ClaudeCode/managed-settings.json
Linux/etc/claude-code/managed-settings.json

Environment Variables

Environment VariableDescriptionDefaultUsage
CLAUDE_CODE_EFFORT_LEVELThinking level (low / medium / high). For Opus 4.6, medium is the default for Max/Team subscribershigh★★★★★
CLAUDE_CODE_DISABLE_AUTO_MEMORYForce-disable the Auto Memory (automatic learning) feature0★★★★☆
MAX_MCP_OUTPUT_TOKENSMax tokens for MCP tool output25000★★★☆☆
CLAUDE_CODE_MAX_OUTPUT_TOKENSMax tokens for model output32000★★★☆☆
BASH_DEFAULT_TIMEOUT_MSDefault timeout for Bash commands (ms)120000★★★☆☆
BASH_MAX_TIMEOUT_MSMax timeout for Bash commands (ms)600000★★☆☆☆
SLASH_COMMAND_TOOL_CHAR_BUDGETOverride the character budget for skill descriptionsDynamic (2% of context)★★☆☆☆
CLAUDE_CODE_DISABLE_CRONImmediately stop scheduled cron jobs(unset)★★☆☆☆
ENABLE_CLAUDEAI_MCP_SERVERSEnable/disable claude.ai MCP serverstrue★★★☆☆
CLAUDE_CODE_DISABLE_1M_CONTEXTDisable 1M context window(unset)★★☆☆☆
ENABLE_TOOL_SEARCHEnable tool search. Control threshold with auto:N syntax (auto:5 = 5% context, auto:10 = default)auto:10★★★☆☆
CLAUDE_CODE_DISABLE_TERMINAL_TITLEDisable terminal title changes(unset)★★☆☆☆

Environment variables can also be set via the env field in settings.json, which is convenient for team-wide distribution.


DevOps Practical Workflows

1. Project Initialization

cd /path/to/project
claude

Within the session:

/init

2. CI/CD Integration

claude -p "セキュリティ脆弱性をレビュー" \
  --output-format json \
  --allowedTools Read,Grep,Glob \
  --max-turns 3 > security_report.json

Add --json-schema when structured output is needed:

claude -p "コード品質を分析" \
  --json-schema '{"type":"object","properties":{"score":{"type":"number"},"issues":{"type":"array"}}}' \
  --max-turns 5

3. Team Standardization

# Share skills and commands via Git
git add .claude/ CLAUDE.md .mcp.json
git commit -m "Add Claude Code team configuration"

4. External Integration Setup

# Add an MCP server
claude mcp add github -- npx -y @modelcontextprotocol/server-github

# Commit the configuration
git add .mcp.json
git commit -m "Add MCP server configuration"

Custom Skill Creation Example

Example of .claude/skills/review/SKILL.md:

---
name: review
description: セキュリティ、パフォーマンス、保守性に焦点を当てたコードレビュー。コード変更後に自動呼び出し。
allowed-tools: Read, Grep, Glob, Bash(git diff:*)
argument-hint: [file-or-directory]
---
以下の観点でコードレビューを行う:
1. セキュリティ脆弱性
2. パフォーマンス問題
3. コード品質と保守性
4. テストカバレッジ

対象: $ARGUMENTS

Usage:

/review src/authentication.py

Skills can also be automatically invoked by Claude based on their description content. To disable auto-invocation, add disable-model-invocation: true to the frontmatter.

Skills Frontmatter Extended Syntax

FrontmatterDescription
context: forkRun the skill in an isolated sub-agent (no access to conversation history)
isolation: worktreeRun the sub-agent/agent in an isolated git worktree
agent: <name>Specify the sub-agent to use (Explore, Plan, custom name, etc.)
memory: user/project/localSpecify the persistent memory scope for the agent
disable-model-invocation: trueDisable automatic invocation by the model

Frequently Asked Questions (FAQ)

Q: How do I check Claude Code's pricing and costs?

During a session, use /cost to check the current session cost (input tokens, output tokens, and amount). Use /usage to check your progress against plan usage limits.

Q: When should I use Fast Mode?

Fast Mode is ideal for interactive rapid iteration (live debugging, continuous code modifications). For batch processing or CI/CD where cost efficiency is the priority, standard mode is recommended. Fast Mode pricing is approximately 2x that of standard Opus 4.6.

Q: How do I continue where I left off?

Use claude -c for the most recent session, claude -r <ID> for a specific session, or claude --from-pr <number> for a session linked to a PR. Within a session, use /resume to display the session picker.

Q: How do I share Claude Code settings with a team?

Commit the .claude/ directory, CLAUDE.md, and .mcp.json to Git. Separate personal settings into .claude/settings.local.json (recommended to add to .gitignore).

Q: How do I prevent dangerous command execution?

Specify denial patterns in permissions.deny within .claude/settings.json. In CI/CD environments, explicitly restrict allowed tools using --allowedTools.

Q: What is a worktree and when should I use it?

Run claude --worktree feature-auth to create an isolated git worktree and start a session in it. This prevents code changes from interfering when processing multiple tasks in parallel. Applicable to sub-agents via the isolation: worktree frontmatter. Automatically cleaned up if no changes are made. Also used internally by the /batch command.

Q: What is the difference between /simplify and /batch?

/simplify is a quality check before PRs (3-agent review pipeline) that detects architectural issues, duplicate logic, and performance inefficiencies. /batch is batch processing that runs large-scale changes in parallel across multiple worktrees and automatically creates PRs. It is suited for migrations and pattern application.

Q: Why did the Opus 4.6 effort default change?

For Max/Team subscribers, the Opus 4.6 effort default changed from high to medium to improve cost efficiency. Use /effort high or the ultrathink keyword mid-conversation to set high effort for the next turn only. Use /effort auto to reset to the default (medium). The CLAUDE_CODE_EFFORT_LEVEL environment variable can also override it persistently.


Next Steps