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¶
| Goal | Sections to Read |
|---|---|
| Check basic commands | CLI Commands then Slash Commands |
| Use for automation | CLI Flags > Output Control then Environment Variables then DevOps Workflows |
| Look up settings | Configuration File Structure then Hook Configuration |
| Quick reference | Shortcuts then Prompt Notation |
Start Here: Most Readers Need One Answer, Not the Whole Reference¶
Need fewer approval prompts?
Read the Auto Approve Guide.
Installing on Windows?
Use the Windows Install Guide.
Automating checks and guardrails?
Jump to the Hooks Complete Guide.
Trying to understand
/buddy?
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
--agentsflag - 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 commandclaude authsubcommands:login/status/logout--from-pr: Resume sessions by PR number--json-schema: Structured output validation--worktreeflag: 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)
/copycommand: Code block selection and copy (SSH-friendly; v2.1.59+)/effortcommand: Simplified effort levels (3 levels + auto)- Opus 4.6 effort default change:
mediumis now the default for Max/Team subscribers ultrathinkkeyword reintroduction: High effort for the next turn only/review,/pr-comments,/security-review: PR integration command suite- Worktree-aware hooks:
WorktreeCreate/WorktreeRemove InstructionsLoadedhook: 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.
| Command | Description | Usage |
|---|---|---|
claude | Start 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 -c | Resume the most recent session | ★★★★★ |
claude -r "ID" | Resume a session by ID | ★★★☆☆ |
claude update | Update to the latest version | ★★★★☆ |
claude mcp | Manage MCP servers | ★★★★☆ |
claude auth login | Authenticate (login) | ★★★☆☆ |
claude auth status | Check authentication status | ★★★☆☆ |
claude auth logout | Log out | ★★☆☆☆ |
claude agents | List configured agents | ★★★☆☆ |
claude rc | Start a Remote Control session | ★★★☆☆ |
claude plugin / claude plugins | Plugin 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¶
| Flag | Description | Usage |
|---|---|---|
--continue, -c | Resume the most recent session | ★★★★★ |
--resume, -r | Resume a session by ID | ★★★☆☆ |
--from-pr <PR> | Resume by PR number or URL | ★★★★☆ |
--fork-session | Fork into a new session ID when resuming | ★★★☆☆ |
--session-id <UUID> | Explicitly specify a session ID | ★★☆☆☆ |
--max-turns N | Set the turn limit for non-interactive mode | ★★★★☆ |
--worktree, -w | Create a git worktree and isolate the session (foundation for parallel development; random name if omitted) | ★★★★★ |
--tmux | Launch Claude Code inside a tmux session (combine with --worktree for parallel session management) | ★★★☆☆ |
Model & Mode Control¶
| Flag | Description | Usage |
|---|---|---|
--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¶
| Flag | Description | Usage |
|---|---|---|
--output-format json | Output in JSON format | ★★★★★ |
--output-format stream-json | Streaming JSON output | ★★★☆☆ |
--output-format text | Text format (default) | ★★★★☆ |
--json-schema '<json>' | Validate JSON against a specified schema after agent completion (print mode only) | ★★★☆☆ |
--verbose | Verbose logging (show per-turn output) | ★★★★☆ |
--input-format <format> | Specify input format (text, stream-json) | ★★☆☆☆ |
--include-partial-messages | Include streaming intermediate events in output | ★★☆☆☆ |
System Prompt Control¶
Claude Code provides three types of system prompt flags for different use cases.
| Flag | Behavior | Mode | Usage |
|---|---|---|---|
--system-prompt "..." | Completely replaces the default prompt | Interactive + print | ★★★☆☆ |
--system-prompt-file <path> | Completely replaces the prompt with file contents | Print only | ★★★☆☆ |
--append-system-prompt "..." | Appends to the end of the default prompt | Interactive + 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¶
| Flag | Description | Usage |
|---|---|---|
--allowedTools <tools> | Additional tools to allow | ★★★★★ |
--disallowedTools <tools> | Additional tools to disallow | ★★★☆☆ |
--dangerously-skip-permissions | Skip 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¶
| Flag | Description | Usage |
|---|---|---|
--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-config | Use only --mcp-config and ignore other MCP settings | ★★☆☆☆ |
--plugin-dir <path> | Add a plugin directory for the session | ★★☆☆☆ |
--teleport | Transfer a session over a remote connection | ★★☆☆☆ |
--agents Flag Format¶
The --agents flag defines one or more sub-agents as a JSON object.
| Field | Required | Description |
|---|---|---|
description | Yes | Description of the sub-agent's purpose |
prompt | Yes | System 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¶
| Flag | Description | Usage |
|---|---|---|
--debug | Enable debug mode (supports category filtering) | ★★★☆☆ |
--debug "api,mcp" | Debug specific categories only | ★★★☆☆ |
--debug "!statsig,!file" | Exclude specific categories | ★★☆☆☆ |
Miscellaneous¶
| Flag | Description | Usage |
|---|---|---|
--ide | Auto-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, -v | Show 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¶
| Command | Description | Usage |
|---|---|---|
claude config list | Display all settings | ★★★☆☆ |
claude config get <key> | Get a specific setting | ★★★☆☆ |
claude config set <key> <value> | Update a setting | ★★★☆☆ |
MCP Server Management Commands¶
| Command | Description | Usage |
|---|---|---|
claude mcp | Interactive MCP server setup (step-by-step) | ★★★★☆ |
claude mcp list | List 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-desktop | Import settings from Claude Desktop | ★★★☆☆ |
claude mcp remove <n> | Remove an MCP server | ★★★☆☆ |
claude mcp serve | Run 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¶
| Command | Description | Usage |
|---|---|---|
/init | Auto-generate CLAUDE.md | ★★★★★ |
/memory | Edit the memory file (CLAUDE.md) | ★★★★☆ |
/context | Visualize context window usage | ★★★★☆ |
/compact | Compress context (can specify what to retain) | ★★★★☆ |
/clear | Reset conversation history (CLAUDE.md is preserved) | ★★★★★ |
/resume | Resume a past session (picker shows 50 entries; supports branch search; press R to rename) | ★★★★☆ |
/fork | Fork (branch) the current conversation into a new session | ★★★☆☆ |
/rename | Rename the session (auto-generates if no arguments) | ★★☆☆☆ |
/add-dir <path> | Add a directory to the context | ★★★☆☆ |
/copy | Select 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¶
| Command | Description | Usage |
|---|---|---|
/usage | Check token usage against plan limits | ★★★★★ |
/cost | Show current session cost (token count and amount) | ★★★★★ |
/help | List available commands (including custom and MCP) | ★★★★☆ |
/tasks | Check background tasks | ★★★★☆ |
/doctor | Run environment diagnostics (checks API connectivity, Node.js version, auth, MCP status, etc.) | ★★★☆☆ |
/stats | Generate usage statistics as an HTML report | ★★★☆☆ |
/debug | Display troubleshooting information for the current session | ★★★☆☆ |
/effort <level> | Switch thinking level (low/medium/high; /effort auto resets to default). Symbols: ○ ◐ ● | ★★★★☆ |
/extra-usage | Enable additional usage capacity | ★★★☆☆ |
Mode & Model Control¶
| Command | Description | Usage |
|---|---|---|
/model | Switch the model (sonnet, opus, haiku) | ★★★★☆ |
/fast | Toggle 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) | ★★★★★ |
/vim | Toggle Vim-style editing mode | ★★☆☆☆ |
/output-style | Change 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¶
| Command | Description | Usage |
|---|---|---|
/hooks | Configure and manage hooks | ★★★★★ |
/agents | Create and manage sub-agents | ★★★★★ |
/permissions | Change permission settings | ★★★★☆ |
/sandbox | Enable sandbox execution mode | ★★★★☆ |
/config | Open settings interface (20+ configurable items) | ★★★☆☆ |
/login | Re-authenticate | ★★☆☆☆ |
/rewind | Rewind 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¶
| Command | Description | Usage |
|---|---|---|
/install-github-app | Set up GitHub PR auto-review | ★★★★☆ |
/plugin | Plugin management (add, remove, marketplace) | ★★★☆☆ |
/mcp | Check MCP status / OAuth authentication | ★★★★☆ |
/rc | Switch the current session to Remote Control | ★★★☆☆ |
/review <PR#> | Code review for a specified PR (requires gh CLI) | ★★★★☆ |
/pr-comments | Show PR comments for the current branch (GitHub CLI integration) | ★★★☆☆ |
/security-review | Security audit of uncommitted changes (--merge-base error on old git is fixed) | ★★★★☆ |
/skills | Skill 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.
| Command | Description | Usage |
|---|---|---|
/simplify | 3-agent review pipeline (detects architectural issues, duplicate logic, performance inefficiencies; recommended before PRs) | ★★★★★ |
/batch | Large-scale parallel changes (parallel execution with worktree isolation → planning → parallel Worker launch → automatic PR creation; useful for migrations, pattern application, etc.) | ★★★★★ |
Environment Settings¶
| Command | Description | Usage |
|---|---|---|
/terminal-setup | Set up Shift+Enter keybinding (for VS Code, Alacritty, Zed, Warp) | ★★★☆☆ |
/keybindings | Open/create the keybindings configuration file | ★★★☆☆ |
/status-line | Set 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.
| Location | Description | Usage |
|---|---|---|
.claude/skills/<name>/SKILL.md | Project skills (shared with team) | ★★★★★ |
~/.claude/skills/<name>/SKILL.md | Personal skills | ★★★★☆ |
.claude/commands/<name>.md | Legacy command format (maintained for compatibility) | ★★★★☆ |
~/.claude/commands/<name>.md | Personal 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¶
| Shortcut | Description | Usage |
|---|---|---|
Esc | Stop processing | ★★★★★ |
Esc x 2 | Rewind menu (selective rollback for conversation/code) | ★★★★☆ |
Enter | Send message | ★★★★★ |
Shift+Enter | Insert a newline (natively supported in iTerm2, WezTerm, Ghostty, Kitty; others require /terminal-setup) | ★★★★☆ |
\ + Enter | Insert a newline (works in all terminals) | ★★★★☆ |
Up | Browse command history | ★★★★☆ |
Ctrl+C | Fully exit session (press twice) | ★★★☆☆ |
Ctrl+F | Stop all background agents | ★★★☆☆ |
Ctrl+R | Reverse search command history | ★★★☆☆ |
Ctrl+Y | Readline-style paste (reinsert deleted text) | ★★☆☆☆ |
Ctrl+S | Stash the current prompt (temporarily save) | ★★☆☆☆ |
? | Show available shortcuts | ★★★☆☆ |
Mode Switching¶
| Shortcut | Description | Usage |
|---|---|---|
Shift+Tab | Cycle modes (normal -> auto-accept -> plan) | ★★★★★ |
Tab | Toggle extended thinking on/off (persists across sessions) | ★★★★☆ |
Ctrl+T | Toggle task list display | ★★★☆☆ |
Ctrl+O | Toggle verbose display on/off (shows thinking content) | ★★★☆☆ |
Ctrl+G | Open plan in an external text editor | ★★★☆☆ |
Shift+Down | Navigate 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¶
| Shortcut | Description | Usage |
|---|---|---|
Shift + Drag | Add a file as a reference | ★★★★☆ |
Ctrl+V | Paste 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.
| Notation | Description | Usage |
|---|---|---|
@<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 Method | Description | Usage |
|---|---|---|
Tab | Toggle extended thinking on/off during a session (persists across sessions) | ★★★★★ |
Ctrl+O | Show/hide thinking content (verbose display) | ★★★★☆ |
CLAUDE_CODE_EFFORT_LEVEL env var | Control thinking level with low / medium / high | ★★★★☆ |
Special Notation in Custom Commands (Skills)¶
| Notation | Description | Usage |
|---|---|---|
$ARGUMENTS | Receive 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:
- CLAUDE.md: Project-specific instructions for Claude (team-shared / personal)
- Auto Memory: Notes automatically learned from conversations (
~/.claude/projects/<project>/memory/) .claude/rules/: Modular rule files separated by conditionsettings.json: Permissions, allowed tools, hook settings, environment variables- Hooks: Lifecycle events that automate terminal commands and scripts
- Skills: Custom slash commands and support files
- 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):
| Priority | Setting Source | Description |
|---|---|---|
| 1 (Highest) | Managed (Admin settings) | managed-settings.json (placed by enterprise admins) |
| 2 | CLI Options | Command-line arguments like --model at launch |
| 3 | Local | .claude/settings.local.json (personal settings outside Git) |
| 4 | Project | .claude/settings.json (team-shared settings) |
| 5 (Lowest) | User | ~/.claude/settings.json (global personal settings) |
Project-Specific (Team-Shared)¶
| File / Directory | Description | Usage |
|---|---|---|
CLAUDE.md | Project context and rule definitions (<!-- --> comments are hidden from Claude during auto-injection but visible when explicitly read with the Read tool) | ★★★★★ |
.claude/settings.json | Project 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.json | MCP server configuration | ★★★★★ |
Personal (Local)¶
| File / Directory | Description | Usage |
|---|---|---|
.claude/settings.local.json | Local personal settings (outside Git) | ★★★★☆ |
~/.claude/CLAUDE.md | Global context | ★★★☆☆ |
~/.claude/commands/ | Personal slash commands | ★★★★☆ |
~/.claude/skills/ | Personal skills | ★★★☆☆ |
~/.claude/agents/ | Personal sub-agents | ★★★☆☆ |
~/.claude/settings.json | User global settings | ★★★☆☆ |
~/.claude/keybindings.json | Custom 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
}
}
~/.claude/settings.json applies the behavior across all projects.Hook Configuration¶
Hook events configured within .claude/settings.json (19 types total).
Core Events¶
| Hook Event | Description | Usage |
|---|---|---|
PreToolUse | Runs before tool use | ★★★★☆ |
PostToolUse | Runs automatically after tool use | ★★★★★ |
PostToolUseFailure | Runs when tool use fails | ★★★☆☆ |
Stop | Runs when the session ends | ★★★☆☆ |
Session & Permission Events¶
| Hook Event | Description | Usage |
|---|---|---|
SessionStart | On session start | ★★★☆☆ |
SessionEnd | On full session termination | ★★☆☆☆ |
UserPromptSubmit | On prompt submission | ★★★☆☆ |
PermissionRequest | On permission request | ★★★☆☆ |
Notification | On notification | ★★☆☆☆ |
InstructionsLoaded | When CLAUDE.md or .claude/rules/*.md is loaded into context | ★★★☆☆ |
ConfigChange | On configuration change | ★★☆☆☆ |
Sub-Agent & Task Events¶
| Hook Event | Description | Usage |
|---|---|---|
SubagentStart | On sub-agent launch | ★★★☆☆ |
SubagentStop | On sub-agent termination | ★★★☆☆ |
TeammateIdle | When a teammate is idle in Agent Teams | ★★★☆☆ |
TaskCompleted | On task completion (critical for /batch completion notifications) | ★★★★☆ |
PreCompact | Before context compaction | ★★☆☆☆ |
Worktree Events (New Category)¶
| Hook Event | Description | Usage |
|---|---|---|
WorktreeCreate | On worktree creation (supports custom VCS setup) | ★★★☆☆ |
WorktreeRemove | On worktree removal | ★★☆☆☆ |
Hook Handler Types¶
| Type | Description | Primary Use |
|---|---|---|
command | Execute a shell command | Running linters, formatters |
prompt | Send an additional prompt to Claude | Automated feedback |
agent | Launch a sub-agent | Delegation to specialized agents |
http | POST 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)¶
| OS | Path |
|---|---|
| macOS | /Library/Application Support/ClaudeCode/managed-settings.json |
| Linux | /etc/claude-code/managed-settings.json |
Environment Variables¶
| Environment Variable | Description | Default | Usage |
|---|---|---|---|
CLAUDE_CODE_EFFORT_LEVEL | Thinking level (low / medium / high). For Opus 4.6, medium is the default for Max/Team subscribers | high | ★★★★★ |
CLAUDE_CODE_DISABLE_AUTO_MEMORY | Force-disable the Auto Memory (automatic learning) feature | 0 | ★★★★☆ |
MAX_MCP_OUTPUT_TOKENS | Max tokens for MCP tool output | 25000 | ★★★☆☆ |
CLAUDE_CODE_MAX_OUTPUT_TOKENS | Max tokens for model output | 32000 | ★★★☆☆ |
BASH_DEFAULT_TIMEOUT_MS | Default timeout for Bash commands (ms) | 120000 | ★★★☆☆ |
BASH_MAX_TIMEOUT_MS | Max timeout for Bash commands (ms) | 600000 | ★★☆☆☆ |
SLASH_COMMAND_TOOL_CHAR_BUDGET | Override the character budget for skill descriptions | Dynamic (2% of context) | ★★☆☆☆ |
CLAUDE_CODE_DISABLE_CRON | Immediately stop scheduled cron jobs | (unset) | ★★☆☆☆ |
ENABLE_CLAUDEAI_MCP_SERVERS | Enable/disable claude.ai MCP servers | true | ★★★☆☆ |
CLAUDE_CODE_DISABLE_1M_CONTEXT | Disable 1M context window | (unset) | ★★☆☆☆ |
ENABLE_TOOL_SEARCH | Enable tool search. Control threshold with auto:N syntax (auto:5 = 5% context, auto:10 = default) | auto:10 | ★★★☆☆ |
CLAUDE_CODE_DISABLE_TERMINAL_TITLE | Disable 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¶
| Frontmatter | Description |
|---|---|
context: fork | Run the skill in an isolated sub-agent (no access to conversation history) |
isolation: worktree | Run 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/local | Specify the persistent memory scope for the agent |
disable-model-invocation: true | Disable 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¶
Related Articles¶
Tips for streamlining daily development
From the basics to advanced event-driven automation
Auto-Approval Configuration Guide
Safe operation of the auto-approve mode
Design patterns and practical examples for skills
Reference Links¶
- Claude Code Official Documentation
- CLI Reference
- Interactive Mode
- Slash Commands / Skills
- Common Workflows
- Fast Mode
- Hooks Documentation
- MCP Integration
- Settings