REFERENCE

Claude Code, at your fingertips.

Every shortcut, slash command, and CLI flag worth knowing — organized, explained, and one click away from your clipboard.

129 commands10 categoriesClick any command to copy

Keyboard Shortcuts

Control input, history, and permission modes without leaving the keyboard.

General controls

Ctrl C

Cancels whatever is happening right now — clears typed input, or stops a response that's still generating.

Ctrl D

Exits the current session and returns you to your regular shell.

Ctrl L

Clears the terminal screen without touching the conversation itself.

Ctrl R

Opens reverse-search so you can find and re-run something you typed earlier.

Tab

Autocompletes file paths, slash commands, and @ mentions as you type.

Up / Down

Steps backward and forward through this session's input history.

Mode switching

Shift Tab

Cycles the permission mode: default (asks before edits) → auto-accept edits → plan mode (research only, no edits).

Esc

Cancels the current input before you've sent it.

Esc Esc

Rewind — press twice to jump back and edit an earlier message, undoing everything that happened after it.

Input

Enter

Sends the current message to Claude.

Ctrl V

Pastes an image straight from your clipboard — handy for sharing screenshots or mockups.

\ + Enter

Inserts a newline in your message instead of sending it, for multi-line prompts.

Prefixes

/

Starts a slash command — built-in tools like /clear, /init, or /model.

!

Runs a bash command directly against your shell, bypassing the model entirely.

#

Appends a quick note to memory (CLAUDE.md) without breaking your flow.

@

Mentions a specific file so Claude reads it straight into context.

Slash Commands

Built-in commands for managing context, sessions, and the tool itself.

Session

/clear

Wipes the conversation and starts completely fresh, keeping your working directory the same.

/compact [focus]

Summarizes older context to free up space so long sessions don't run out of room. Point it at a topic to keep that part detailed.

/cost

Prints how many tokens this session has used and roughly what it cost.

/resume

Lists your recent sessions so you can jump back into one instead of starting over.

/status

Shows your signed-in account, active model, and connection health at a glance.

/export

Exports the full conversation transcript to a file you can share or archive.

Setup & config

/init

Scans the current codebase and writes a starter CLAUDE.md so future sessions understand your project immediately.

/config

Opens interactive settings for the CLI — theme, notifications, and defaults.

/permissions

Shows which tools are allowed, denied, or ask-first, and lets you edit the rules.

/terminal-setup

Installs terminal key bindings so shortcuts like Shift+Enter behave correctly.

/vim

Switches the input editor to Vim-style modal keybindings.

/doctor

Runs a health check on your installation and configuration, and flags anything broken.

Extending Claude

/agents

Opens the manager for custom subagents — create, edit, or remove specialized helpers.

/hooks

Configures hooks that fire automatically on events like a tool running or a session starting.

/mcp

Lists connected MCP servers and lets you authenticate or reconnect them from inside a session.

/memory

Opens your CLAUDE.md files directly for editing, instead of asking Claude to update them.

/add-dir

Grants the current session access to another directory outside the one you started in.

/ide

Connects the session to a supported IDE extension for inline diffs and selections.

Account & feedback

/login

Signs in to your Anthropic account.

/logout

Signs out of the account currently in use.

/model

Switches which model handles the rest of this session.

/review

Reviews an open pull request and leaves structured feedback.

/pr_comments

Pulls in review comments from a pull request so Claude can act on them directly.

/security-review

Runs a security-focused pass over your pending changes before you ship them.

/bug

Reports a bug straight to Anthropic, including relevant session context.

CLI Flags & Modes

Launch and script Claude Code from the command line.

Starting a session

claude

Starts an interactive session in the current directory.

claude "prompt"

Starts a session with an initial prompt already queued up, ready to run.

claude -p "prompt"

Print mode — runs once, prints the result, and exits. Built for scripts and pipelines, not conversation.

claude --continue

Picks up your most recent conversation right where it left off.

claude --resume

Shows a list of previous sessions so you can choose one to resume.

Scoping the session

--model <name>

Sets which model handles this run.

--add-dir <path>

Grants access to an extra directory beyond the current working folder.

--permission-mode <mode>

Sets the starting permission mode: default, plan, acceptEdits, or bypassPermissions.

--allowedTools <list>

Whitelists specific tools Claude is allowed to use in this run.

--disallowedTools <list>

Blacklists specific tools, even if they'd otherwise be permitted.

Automation & output

--output-format json

Returns structured JSON instead of plain text — built for piping into other tools.

--max-turns <n>

Caps how many back-and-forth turns a non-interactive run can take before stopping.

--mcp-config <file>

Loads a specific set of MCP servers from a config file for just this run.

--verbose

Shows detailed logging for every tool call, useful when debugging automation.

--dangerously-skip-permissions

Skips every permission prompt. Only use inside an isolated sandbox — never on a machine with real data.

More flags

--session-id <id>

Assigns a specific ID to the session, so you can reference or resume it precisely later.

--fork-session

Branches off a copy of an existing session instead of continuing it in place.

--settings <file>

Loads settings from a specific file instead of the default settings.json.

--append-system-prompt <text>

Adds extra instructions on top of the default system prompt for this run.

--input-format stream-json

Accepts streaming JSON input, for feeding messages in programmatically.

MCP Servers

Connect external tools and data sources over the Model Context Protocol.

Add & manage

claude mcp add <name> <cmd>

Registers a new local MCP server that runs as a subprocess.

claude mcp add --transport http <url>

Connects a remote server over HTTP — the recommended transport for hosted servers.

claude mcp add --transport sse <url>

Connects a remote server over Server-Sent Events, for servers that stream responses.

claude mcp list

Lists every MCP server configured for this project, with its connection status.

claude mcp get <name>

Shows the full configuration and status for one specific server.

claude mcp remove <name>

Removes a server from the project's configuration.

--env KEY=value

Passes an environment variable through to a local MCP server when adding it.

Scopes

local

Available only to you, only in this project. Stored in your personal ~/.claude.json.

project (.mcp.json)

Shared with your whole team — checked into version control alongside the code.

user

Available globally, across every project on your machine, regardless of which repo you're in.

Inside a session

/mcp

Opens an interactive panel to inspect, authenticate, or reconnect servers without leaving the chat.

alwaysAllow: true

A server config flag that keeps it connected and trusted across sessions, skipping repeat approval prompts.

Memory & Project Files

Give every session lasting context about your codebase and conventions.

Memory files

./CLAUDE.md

Project memory — conventions, architecture notes, and context shared with your whole team via git.

./CLAUDE.local.md

Your personal notes for this project. Not committed, so it stays out of your teammates' way.

~/.claude/CLAUDE.md

Global memory that applies no matter which project you're working in.

Configuration

.claude/settings.json

Project-level settings — permissions, hooks, and defaults — checked into git so the whole team shares them.

.claude/settings.local.json

Your personal overrides for this project. Gitignored by default.

Skills & Subagents

Package up expertise once, then reuse it across every future session.

Building blocks

.claude/agents/*.md

Defines a custom subagent — its own system prompt, tool access, and area of expertise — that the main session can delegate to.

.claude/skills/*.md

Defines a reusable skill: packaged instructions for a specific task, triggered by name or by description matching.

Task tool

The mechanism the main agent uses to hand off a chunk of work to a subagent, often running in the background.

subagent_type

The parameter that picks which agent persona — general-purpose, a custom one, or a built-in specialist — handles a delegated task.

SKILL.md frontmatter

The name and description fields at the top of a skill file, which is how Claude decides when to trigger it automatically.

allowed-tools

A frontmatter field that restricts exactly which tools a skill or subagent is permitted to use.

Hooks & Automation

Run your own scripts automatically at key points in the agent loop.

Hook events

PreToolUse

Fires right before a tool runs — can inspect the call and block it before anything happens.

PostToolUse

Fires right after a tool finishes, useful for logging, formatting, or triggering a follow-up check.

UserPromptSubmit

Fires the moment you submit a message, before Claude sees it.

SessionStart / SessionEnd

Fire when a session opens or closes — handy for setup and cleanup scripts.

Stop

Fires when Claude finishes responding, before control returns to you.

Environment Variables

Configure how Claude Code connects and behaves at the system level.

Key variables

ANTHROPIC_API_KEY

Your API key, used to authenticate requests when you're not signed in interactively.

ANTHROPIC_MODEL

Overrides the default model for every session, without passing --model each time.

DISABLE_TELEMETRY

Opts out of anonymous usage analytics.

DISABLE_AUTOUPDATER

Turns off automatic updates, useful for pinned or managed environments.

CLAUDE_CODE_USE_BEDROCK

Routes model requests through AWS Bedrock instead of the Anthropic API directly.

CLAUDE_CODE_USE_VERTEX

Routes model requests through Google Vertex AI instead of the Anthropic API directly.

HTTPS_PROXY

Sends all network traffic through a proxy — standard for locked-down corporate networks.

Workflows & Pro Tips

Habits that make longer sessions faster, safer, and easier to steer.

The default loop

Explore → Plan → Code → Commit

Let Claude read and understand the codebase before it writes a single line — the highest-leverage habit there is.

Plan mode

Shift+Tab into plan mode to get a proposal before anything is edited, so you can course-correct for free.

Course-correct early

Hit Esc the moment an approach looks wrong, rather than letting a bad direction run to completion.

Working faster

Paste screenshots

Drop in a mockup or a bug screenshot for UI work — Claude reads images directly, no description needed.

Document once, reuse always

Put conventions in CLAUDE.md so every future session inherits them instead of you re-explaining.

Checkpoints

Use Esc Esc to rewind after Claude heads down the wrong path, instead of trying to talk it back.

Delegate in parallel

Use subagents for independent research so the main thread stays focused on the task at hand.

Keep CLAUDE.md short

A tight, high-signal memory file gets read carefully; a sprawling one gets skimmed.

Ask for a second opinion

Spin up a fresh subagent to review a risky change independently, without the original context biasing it.

Best Skills by Domain

Custom .claude/skills/*.md worth building for frontend, backend, QA, and motion work.

Frontend

component-scaffold

Generates a new UI component that matches the project's existing props, styling, and file conventions.

accessibility-audit

Checks a component against WCAG basics — contrast, ARIA labels, keyboard navigation, and focus order.

responsive-check

Renders a layout at mobile, tablet, and desktop widths and flags overflow, clipping, or broken wrapping.

design-tokens-sync

Keeps colors, spacing, and typography aligned with the project's design tokens instead of one-off values.

state-review

Flags state that's colocated wrong, causing unnecessary re-renders or prop-drilling.

bundle-size-check

Flags a new dependency or import that meaningfully grows the client bundle.

Backend

api-scaffold

Generates a new endpoint with validation, error handling, and types matching project conventions.

db-migration-review

Writes or reviews a database migration for backward compatibility, locking, and missing indexes.

security-review

Scans changed code for injection, auth bypass, leaked secrets, and unsafe deserialization.

schema-validation

Confirms request and response bodies are validated against a schema, not just typed.

error-handling-audit

Ensures errors are caught, logged, and returned in one consistent shape across endpoints.

rate-limit-check

Verifies new endpoints have rate limiting and abuse protection appropriate to their cost.

QA & Testing

test-coverage-gap

Finds code paths touched in a diff that have no test covering them.

e2e-flow

Writes an end-to-end test for a critical user flow, like checkout or signup.

flaky-test-diagnose

Investigates a flaky failure and finds the real cause — timing, ordering, or leaked state.

bug-repro

Turns a vague bug report into a minimal, reliable reproduction case.

regression-checklist

Generates a manual QA checklist straight from a diff, before sign-off.

visual-diff-review

Compares before/after screenshots and flags unintended visual regressions.

Motion & Animation

easing-recommender

Suggests the right easing curve and duration for an interaction — entrance, exit, hover, drag.

reduced-motion-fallback

Adds a prefers-reduced-motion fallback so a new animation degrades gracefully.

fps-profile

Profiles an animation for jank and suggests fixes — compositing, will-change, layout thrashing.

micro-interaction-spec

Specs a hover, press, or focus micro-interaction, including timing and every state.

scroll-animation-review

Reviews scroll-linked animations for performance and motion-sickness triggers.

transition-consistency

Checks that transition durations and easings match the project's motion system.