REFERENCE
Claude Code, at your fingertips.
Every shortcut, slash command, and CLI flag worth knowing — organized, explained, and one click away from your clipboard.
Keyboard Shortcuts
Control input, history, and permission modes without leaving the keyboard.
General controls
Ctrl CCancels whatever is happening right now — clears typed input, or stops a response that's still generating.
Ctrl DExits the current session and returns you to your regular shell.
Ctrl LClears the terminal screen without touching the conversation itself.
Ctrl ROpens reverse-search so you can find and re-run something you typed earlier.
TabAutocompletes file paths, slash commands, and @ mentions as you type.
Up / DownSteps backward and forward through this session's input history.
Mode switching
Shift TabCycles the permission mode: default (asks before edits) → auto-accept edits → plan mode (research only, no edits).
EscCancels the current input before you've sent it.
Esc EscRewind — press twice to jump back and edit an earlier message, undoing everything that happened after it.
Input
EnterSends the current message to Claude.
Ctrl VPastes an image straight from your clipboard — handy for sharing screenshots or mockups.
\ + EnterInserts 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
/clearWipes 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.
/costPrints how many tokens this session has used and roughly what it cost.
/resumeLists your recent sessions so you can jump back into one instead of starting over.
/statusShows your signed-in account, active model, and connection health at a glance.
/exportExports the full conversation transcript to a file you can share or archive.
Setup & config
/initScans the current codebase and writes a starter CLAUDE.md so future sessions understand your project immediately.
/configOpens interactive settings for the CLI — theme, notifications, and defaults.
/permissionsShows which tools are allowed, denied, or ask-first, and lets you edit the rules.
/terminal-setupInstalls terminal key bindings so shortcuts like Shift+Enter behave correctly.
/vimSwitches the input editor to Vim-style modal keybindings.
/doctorRuns a health check on your installation and configuration, and flags anything broken.
Extending Claude
/agentsOpens the manager for custom subagents — create, edit, or remove specialized helpers.
/hooksConfigures hooks that fire automatically on events like a tool running or a session starting.
/mcpLists connected MCP servers and lets you authenticate or reconnect them from inside a session.
/memoryOpens your CLAUDE.md files directly for editing, instead of asking Claude to update them.
/add-dirGrants the current session access to another directory outside the one you started in.
/ideConnects the session to a supported IDE extension for inline diffs and selections.
Account & feedback
/loginSigns in to your Anthropic account.
/logoutSigns out of the account currently in use.
/modelSwitches which model handles the rest of this session.
/reviewReviews an open pull request and leaves structured feedback.
/pr_commentsPulls in review comments from a pull request so Claude can act on them directly.
/security-reviewRuns a security-focused pass over your pending changes before you ship them.
/bugReports a bug straight to Anthropic, including relevant session context.
CLI Flags & Modes
Launch and script Claude Code from the command line.
Starting a session
claudeStarts 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 --continuePicks up your most recent conversation right where it left off.
claude --resumeShows 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 jsonReturns 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.
--verboseShows detailed logging for every tool call, useful when debugging automation.
--dangerously-skip-permissionsSkips 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-sessionBranches 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-jsonAccepts 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 listLists 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=valuePasses an environment variable through to a local MCP server when adding it.
Scopes
localAvailable 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.
userAvailable globally, across every project on your machine, regardless of which repo you're in.
Inside a session
/mcpOpens an interactive panel to inspect, authenticate, or reconnect servers without leaving the chat.
alwaysAllow: trueA 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.mdProject memory — conventions, architecture notes, and context shared with your whole team via git.
./CLAUDE.local.mdYour personal notes for this project. Not committed, so it stays out of your teammates' way.
~/.claude/CLAUDE.mdGlobal memory that applies no matter which project you're working in.
Configuration
.claude/settings.jsonProject-level settings — permissions, hooks, and defaults — checked into git so the whole team shares them.
.claude/settings.local.jsonYour 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/*.mdDefines a custom subagent — its own system prompt, tool access, and area of expertise — that the main session can delegate to.
.claude/skills/*.mdDefines a reusable skill: packaged instructions for a specific task, triggered by name or by description matching.
Task toolThe mechanism the main agent uses to hand off a chunk of work to a subagent, often running in the background.
subagent_typeThe parameter that picks which agent persona — general-purpose, a custom one, or a built-in specialist — handles a delegated task.
SKILL.md frontmatterThe name and description fields at the top of a skill file, which is how Claude decides when to trigger it automatically.
allowed-toolsA 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
PreToolUseFires right before a tool runs — can inspect the call and block it before anything happens.
PostToolUseFires right after a tool finishes, useful for logging, formatting, or triggering a follow-up check.
UserPromptSubmitFires the moment you submit a message, before Claude sees it.
SessionStart / SessionEndFire when a session opens or closes — handy for setup and cleanup scripts.
StopFires 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_KEYYour API key, used to authenticate requests when you're not signed in interactively.
ANTHROPIC_MODELOverrides the default model for every session, without passing --model each time.
DISABLE_TELEMETRYOpts out of anonymous usage analytics.
DISABLE_AUTOUPDATERTurns off automatic updates, useful for pinned or managed environments.
CLAUDE_CODE_USE_BEDROCKRoutes model requests through AWS Bedrock instead of the Anthropic API directly.
CLAUDE_CODE_USE_VERTEXRoutes model requests through Google Vertex AI instead of the Anthropic API directly.
HTTPS_PROXYSends 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 → CommitLet Claude read and understand the codebase before it writes a single line — the highest-leverage habit there is.
Plan modeShift+Tab into plan mode to get a proposal before anything is edited, so you can course-correct for free.
Course-correct earlyHit Esc the moment an approach looks wrong, rather than letting a bad direction run to completion.
Working faster
Paste screenshotsDrop in a mockup or a bug screenshot for UI work — Claude reads images directly, no description needed.
Document once, reuse alwaysPut conventions in CLAUDE.md so every future session inherits them instead of you re-explaining.
CheckpointsUse Esc Esc to rewind after Claude heads down the wrong path, instead of trying to talk it back.
Delegate in parallelUse subagents for independent research so the main thread stays focused on the task at hand.
Keep CLAUDE.md shortA tight, high-signal memory file gets read carefully; a sprawling one gets skimmed.
Ask for a second opinionSpin 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-scaffoldGenerates a new UI component that matches the project's existing props, styling, and file conventions.
accessibility-auditChecks a component against WCAG basics — contrast, ARIA labels, keyboard navigation, and focus order.
responsive-checkRenders a layout at mobile, tablet, and desktop widths and flags overflow, clipping, or broken wrapping.
design-tokens-syncKeeps colors, spacing, and typography aligned with the project's design tokens instead of one-off values.
state-reviewFlags state that's colocated wrong, causing unnecessary re-renders or prop-drilling.
bundle-size-checkFlags a new dependency or import that meaningfully grows the client bundle.
Backend
api-scaffoldGenerates a new endpoint with validation, error handling, and types matching project conventions.
db-migration-reviewWrites or reviews a database migration for backward compatibility, locking, and missing indexes.
security-reviewScans changed code for injection, auth bypass, leaked secrets, and unsafe deserialization.
schema-validationConfirms request and response bodies are validated against a schema, not just typed.
error-handling-auditEnsures errors are caught, logged, and returned in one consistent shape across endpoints.
rate-limit-checkVerifies new endpoints have rate limiting and abuse protection appropriate to their cost.
QA & Testing
test-coverage-gapFinds code paths touched in a diff that have no test covering them.
e2e-flowWrites an end-to-end test for a critical user flow, like checkout or signup.
flaky-test-diagnoseInvestigates a flaky failure and finds the real cause — timing, ordering, or leaked state.
bug-reproTurns a vague bug report into a minimal, reliable reproduction case.
regression-checklistGenerates a manual QA checklist straight from a diff, before sign-off.
visual-diff-reviewCompares before/after screenshots and flags unintended visual regressions.
Motion & Animation
easing-recommenderSuggests the right easing curve and duration for an interaction — entrance, exit, hover, drag.
reduced-motion-fallbackAdds a prefers-reduced-motion fallback so a new animation degrades gracefully.
fps-profileProfiles an animation for jank and suggests fixes — compositing, will-change, layout thrashing.
micro-interaction-specSpecs a hover, press, or focus micro-interaction, including timing and every state.
scroll-animation-reviewReviews scroll-linked animations for performance and motion-sickness triggers.
transition-consistencyChecks that transition durations and easings match the project's motion system.