Claude Code ships updates almost daily, so most cheat sheets online are already stale. This one is checked against Claude Code 2.1.30x (late October to early November 2026). I have grouped the commands the way you actually use them: getting set up, the slash commands you will type every day, keyboard shortcuts, CLI flags for scripts, and the config files where memory, skills, subagents, hooks and MCP servers live. Bookmark it and use Ctrl+F.
/initcreates a CLAUDE.md for your project./memoryedits it./clearstarts fresh;/compactsummarizes a long session;/contextshows what fills the window./modeland/effortpick the model and how hard it thinks./resumeandclaude -ccontinue earlier work;/rewindundoes back to a checkpoint./usageshows plan limits;/mcpmanages tool servers;/doctorfixes installs.- Shift+Tab cycles permission modes; Esc stops a turn; ! runs a shell command; @ mentions a file.
Install, Update and Sign In
# macOS / Linux
curl -fsSL https://claude.ai/install.sh | bash
# macOS with Homebrew
brew install --cask claude-code
# Windows PowerShell
irm https://claude.ai/install.ps1 | iex
# check and sign in
claude --version
claude auth login
# update
claude update
Claude Code works with a Claude Pro, Max, Team or Enterprise plan, or with API billing. If you are not sure which plan fits, see my Claude Free vs Pro vs Max vs Ultra guide; for API costs see Claude API pricing.
Session and Context Commands
| Command | What it does |
|---|---|
/clear |
Wipe the conversation and start fresh (keeps your project files and CLAUDE.md) |
/compact [focus] |
Summarize the session to free context; add a focus like “keep the API design” |
/autocompact [size|auto] |
Set when automatic compaction kicks in |
/context |
Show what is filling the context window |
/resume |
Pick an earlier session to continue |
/rename [name] |
Name the current session so you can find it later |
/rewind |
Roll the conversation and code back to a checkpoint |
/diff |
Show the changes made in this session |
/copy |
Copy the last response |
/export [file] |
Save the conversation to a file |
/cd [path] |
Change working directory |
/background (/bg) |
Send the current work to the background |
/tasks |
List background tasks and shells |
/btw [question] |
Ask a quick side question without derailing the main task |
Model, Effort and Config Commands
| Command | What it does |
|---|---|
/model [name] |
Switch model (opus, sonnet, haiku, fable, opusplan) |
/effort [level] |
Set reasoning effort: low, medium, high, xhigh, max or auto |
/fast |
Toggle fast mode |
/config [key=value] |
Open or change settings |
/permissions |
Allow or deny specific tools and commands |
/mcp |
List, connect and authenticate MCP servers (/mcp reconnect all) |
/skills, /reload-skills |
List skills and reload them after editing |
/plugin, /reload-plugins |
Install and manage plugins |
/hooks |
View configured hooks |
/output-style [name] |
Change how responses are formatted |
/statusline, /theme, /keybindings, /terminal-setup |
Customize the terminal UI |
/sandbox |
Configure sandboxed command execution |
/fewer-permission-prompts |
Scan past sessions and suggest an allowlist so you get asked less |
Project, Review and Planning Commands
| Command | What it does |
|---|---|
/init |
Scan the repo and write a starter CLAUDE.md |
/memory |
Edit CLAUDE.md memory files |
/plan |
Plan first without editing files |
/code-review [level] [--fix] [--comment] |
Review the current diff or a PR for bugs; optionally fix or comment |
/review [PR] |
Review a pull request |
/security-review |
Security review of pending changes |
/simplify [target] |
Clean up and simplify changed code |
/run, /verify |
Launch the app or verify a change actually works |
/debug [description] |
Guided debugging |
/branch [name], /fork, /subtask |
Branch the conversation or spin off a side task |
/goal [condition], /batch [task], /loop [interval] [prompt] |
Keep working toward a goal, run batch jobs, or repeat a prompt on a timer |
/add-dir [path] |
Give Claude access to another folder |
/import [codex|gemini|cursor] |
Import settings from another coding agent |
/advisor [model|off] |
Add a second model as an advisor |
/deep-research [question] |
Run a multi-source research task |
Account, Usage and System Commands
| Command | What it does |
|---|---|
/usage (alias /cost) |
Plan limits used and remaining, or token cost on API billing |
/status, /stats, /insights |
Version, account, model and usage stats |
/doctor (/checkup) |
Diagnose install and config problems |
/login, /logout |
Switch accounts |
/release-notes |
What changed in recent versions |
/ide, /chrome, /desktop |
Connect to your IDE, Chrome extension or desktop app |
/remote-control, /teleport |
Control the session from another device or move it to the cloud |
/schedule |
Schedule recurring agent tasks |
/install-github-app |
Set up the GitHub app for PR reviews |
/voice |
Voice input |
/bug |
Report a problem to Anthropic |
/help, /exit |
Help and quit |
Keyboard Shortcuts
| Shortcut | Action |
|---|---|
| Esc | Stop the current turn |
| Esc Esc | Clear the draft or open rewind |
| Ctrl+C | Interrupt; twice on an empty prompt exits |
| Shift+Tab or Alt+M | Cycle permission mode (manual, accept edits, plan, auto) |
| Alt+P (Option+P) | Model picker |
| Alt+T (Option+T) | Toggle extended thinking |
| Alt+O (Option+O) | Toggle fast mode |
| Ctrl+B | Send a running command or agent to the background |
| Ctrl+T | Show task list |
| Ctrl+O | Transcript viewer |
| Ctrl+R | Search prompt history |
| Ctrl+G | Edit the prompt in your external editor |
| Ctrl+S | Stash the current prompt |
| Ctrl+J, Alt+Enter, or backslash then Enter | New line in the prompt |
| Ctrl+V / Cmd+V | Paste an image |
| /, !, @ | Start a command, run a shell command, mention a file |
CLI Flags and Subcommands
claude "fix the failing test" # start with a prompt
claude -c # continue last session
claude -r my-feature # resume a named session
claude -w feature/login # work in a new git worktree
claude --model opus --effort high # pick model and effort
claude --permission-mode plan # start read-only
# non-interactive (scripts, CI)
claude -p "summarize changes since main" --output-format json
claude -p "..." --max-turns 10 --max-budget-usd 2 --allowedTools "Read,Grep"
# background agents
claude --bg "upgrade dependencies and run tests"
claude agents # list running agents
claude attach <id> # attach to one
claude logs <id> # read its output
claude stop <id>
# MCP servers
claude mcp add --transport http github https://example.com/mcp
claude mcp add --scope user mytool -e API_KEY=xxx -- npx my-mcp
claude mcp list
claude mcp remove github
# maintenance
claude update
claude purge --dry-run
claude import codex --dry-run
Want good servers to add? See my 20 best MCP servers with install commands.
Permission Modes, Models and Effort Levels
Permission modes
- manual (config value
default): asks before edits and commands. - plan: read-only, Claude proposes a plan.
- acceptEdits: file edits go through, commands still ask.
- dontAsk: only pre-approved tools run.
- auto: a safety classifier decides; the default for new interactive sessions with no mode set.
- bypassPermissions: no checks. Use only inside containers or sandboxes.
Model aliases
| Alias | Model |
|---|---|
opus |
Claude Opus 5.5 |
sonnet |
Claude Sonnet 5.5 |
haiku |
Claude Haiku 5.5 |
fable |
Claude Fable 5.1 |
opusplan |
Opus plans, Sonnet executes |
opus[1m], sonnet[1m] |
1M-token context versions |
Effort levels
low, medium, high, xhigh, max and auto, set with /effort, --effort or the CLAUDE_CODE_EFFORT_LEVEL environment variable. Higher effort means better answers on hard problems but uses your limits faster.
Config Files: CLAUDE.md, Settings, Skills, Agents, MCP
| What | User level (all projects) | Project level |
|---|---|---|
| Memory / instructions | ~/.claude/CLAUDE.md |
CLAUDE.md or .claude/CLAUDE.md; CLAUDE.local.md for personal notes. AGENTS.md is read only if no CLAUDE.md exists |
| Settings | ~/.claude/settings.json |
.claude/settings.json (shared), .claude/settings.local.json (gitignored) |
| Path-specific rules | ~/.claude/rules/ |
.claude/rules/*.md with paths: frontmatter |
| Skills | ~/.claude/skills/<name>/SKILL.md |
.claude/skills/<name>/SKILL.md |
| Subagents | ~/.claude/agents/<name>.md |
.claude/agents/<name>.md |
| MCP servers | ~/.claude.json (via --scope user) |
.mcp.json |
| Keybindings | ~/.claude/keybindings.json |
– |
Skill frontmatter takes name, description, argument-hint and user-invocable. Subagent frontmatter takes name, description, tools, model and omitClaudeMd. I go deeper on skills in my Claude Skills guide.
Hook Events
Hooks run your own scripts at fixed points, configured under hooks in settings.json. Available events:
SessionStart, UserPromptSubmit, PreToolUse, PermissionRequest, PostToolUse, PostToolUseFailure, Stop, SubagentStop, PreCompact, Notification, SessionEnd, FileChanged, CwdChanged, DirectoryAdded, WorktreeCreate, PreModelSwitch.
Common uses: run a formatter in PostToolUse after every file edit, block edits to secrets in PreToolUse, or play a sound on Notification when Claude needs you.
Removed or Changed Commands
/vimand/pr-commentswere removed./agentsno longer runs a creation wizard. Write the agent file in.claude/agents/yourself.claude project purgebecameclaude purge./costis now an alias of/usage.
If something is missing in your install, run claude update and /release-notes; commands vary by version and plan.
Quick Start: Your First Session in 6 Steps
If you have just installed Claude Code, this is the order I’d use the commands above in a real project. It takes about ten minutes and leaves you with a setup you can reuse.
- Install and check the version. Run the installer for your system, then
claude --version. If the shell says the command is not found, see the troubleshooting table below. - Start inside your project.
cdinto the repo and runclaude. Sign in with your Claude account in the browser window that opens, or useclaude auth loginon a remote machine. - Create project memory. Run
/initso Claude scans the repo and writes a starter CLAUDE.md. Open it with/memoryand add your build, test and lint commands. - Plan before editing. Press Shift+Tab until plan mode is active, describe the change, and review the plan. Switch back to an editing mode once you are happy with it.
- Review and keep context lean. Check the work with
/diff, and use/compactwith a focus when the session gets long, or/clearwhen you move to an unrelated task. - Check your limits and resume later. Run
/usageto see how much of your plan you used, name the session with/rename, and pick it up next time withclaude -cor/resume.
Troubleshooting Common Claude Code Problems
When something breaks, start with /doctor inside a session, or claude doctor from your shell if Claude Code will not start at all. These are the problems I see asked about most, with the fixes from Anthropic’s troubleshooting pages.
| Problem | Likely cause | Fix |
|---|---|---|
command not found: claude after install |
The native installer puts the binary at ~/.local/bin/claude, and that folder is not in your PATH |
Add it: echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc (or ~/.bashrc), then source the file or open a new terminal. On Windows the folder is %USERPROFILE%\.local\bin. |
| Login fails or keeps looping | Stale or expired credentials, or the browser opened on a different machine over SSH | Run /logout, close Claude Code, start claude again and sign in. If the browser does not open, press c to copy the login URL and open it on your local machine. |
| “Organization has been disabled” despite an active subscription | An old ANTHROPIC_API_KEY in your shell overrides your subscription login |
Run unset ANTHROPIC_API_KEY, remove the export line from your shell profile, and confirm the active login with /status. |
403 Request not allowed after login |
Inactive subscription, missing Console role, or a corporate proxy | Check your plan at claude.ai/settings; Console users need the Claude Code or Developer role; set up proxy settings if you are behind one. |
| Context fills up, or “Autocompact is thrashing” | A huge file or tool output keeps refilling the window | Ask Claude to read the file in smaller chunks, run /compact with a focus, move big jobs to a subagent, or /clear. Use /context to see what is taking space. |
| Too many permission prompts | You are in manual mode with no allow rules | Cycle modes with Shift+Tab, add rules in /permissions, or run /fewer-permission-prompts. |
| MCP server not connecting or shows zero tools | Project server never approved, relative paths in command, or .mcp.json in the wrong place |
Open /mcp to approve or reconnect. Keep .mcp.json at the repo root with servers under mcpServers, use absolute paths, and run claude --debug=mcp to read the server’s errors. |
| Session slow, frozen or using lots of memory | A large context, or a plugin, hook or MCP server misbehaving | Press Ctrl+C, restart, and resume with claude --continue. Start with claude --safe-mode to test without your customizations. |
If settings, hooks or skills do not seem to apply, remember that ~/.claude.json holds app state, while permissions, hooks and env belong in ~/.claude/settings.json. Mixing those two files up is one of the most common configuration mistakes.
Frequently Asked Questions
How do I see all Claude Code commands?
Type / in the prompt to get the live list for your version, or /help. Press ? in the transcript viewer for shortcuts.
What is the difference between /clear and /compact?
/clear drops the conversation entirely. /compact replaces it with a summary, so Claude keeps the key decisions while freeing context.
How do I check my Claude Code usage limits?
Run /usage (or /cost). If you keep hitting limits or errors, see my Claude 429 and 529 error fix guide.
How do I stop Claude Code asking for permission every time?
Use Shift+Tab to switch to accept-edits or auto mode, add allow rules with /permissions, or run /fewer-permission-prompts to build an allowlist from your history.
Claude Code vs Codex vs Cursor: which should I use?
See my coding agent comparison and OpenAI Codex guide.
Why does my terminal say claude: command not found?
The install worked but the folder holding the binary, ~/.local/bin on macOS and Linux, is not on your PATH. Add it to your shell profile, reload the shell, and run claude --version again. If you only installed the VS Code extension, run the standalone installer too, because the extension keeps its own private copy.
How do I fix an MCP server that will not connect?
Run /mcp to see its status. Project servers from .mcp.json need a one-time approval there, failed servers often use relative paths, and a connected server with zero tools usually needs a Reconnect. For details, start with claude --debug=mcp.




