Claude Code Cheat Sheet: Every Command, Shortcut & Workflow (2026)
A complete Claude Code reference: slash commands, keyboard shortcuts, CLI flags, hooks, subagents, and skills — organized into scannable tables you can bookmark and use daily.
Claude Code Cheat Sheet: Every Command, Shortcut & Workflow (2026)
Claude Code has grown from a simple terminal chatbot into a full agentic development environment — slash commands, background sessions, hooks, subagents, skills, and a plugin ecosystem all layered on top of the core CLI. That's a lot of surface area to remember mid-flow, which is exactly the problem a cheat sheet solves: you shouldn't have to re-read the docs every time you want to spin up a background agent or figure out whether a task needs a skill or a subagent.
This is a working reference, not a marketing page. Every table below is something you can act on the next time you're in a terminal with Claude Code open.
Getting Oriented: Core CLI Commands
These are the commands you type before Claude Code even starts a session, or that manage the session itself.
| Command | What it does |
|---|---|
claude | Start an interactive session in the current directory |
claude "prompt" | Start a session with an initial prompt already queued |
claude -p "prompt" | Run a single prompt non-interactively and print the result (good for scripts/CI) |
claude --continue | Resume your most recent session in this directory |
claude --resume | Pick a previous session from a list to resume |
claude agents | Open the agent view to manage background sessions |
claude mcp | Manage MCP server connections (add, remove, list, authenticate) |
claude --model | Start a session pinned to a specific model |
claude update | Update Claude Code to the latest version |
/model opus when a task needs deeper reasoning (architecture decisions, gnarly bugs, multi-file refactors), and drop to Haiku 4.5 for cheap, high-volume mechanical work. Effort and cost scale together — don't reach for Opus on a one-line fix.
Slash Commands You'll Actually Use
Slash commands are typed shortcuts that trigger a specific, predictable action — as opposed to skills, which Claude loads implicitly when it decides they're relevant. If you want something to happen exactly when you type it, it belongs in this table.
| Command | Purpose |
|---|---|
/init | Scaffold a new CLAUDE.md by scanning the current repo |
/compact | Summarize the conversation to free up context without losing key facts |
/context | Show current context window usage broken down by category |
/review | Review a GitHub pull request |
/code-review | Review the current diff for bugs and cleanup opportunities |
/code-review --fix | Review the diff and apply the fixes automatically |
/simplify | Cleanup-only pass on changed code (no bug hunting) |
/security-review | Run a security-focused review of pending changes |
/agents | List, create, or edit subagent definitions |
/model | Switch the active model for the session |
/permissions | View or edit tool permission settings |
/config | Open quick settings (theme, model, notifications) |
/clear | Clear the conversation and start fresh in the same directory |
/help | List available commands and get contextual help |
Custom slash commands live in .claude/commands/*.md — a Markdown file with frontmatter becomes a reusable prompt template you invoke with /your-command-name. This is the fastest way to codify a repeated workflow (a deploy checklist, a commit-message format, a test-writing template) without building a full skill.
Keyboard Shortcuts and Input Prefixes
Inside an interactive session, a handful of prefixes and keystrokes change how your input is treated:
| Input | Effect |
|---|---|
!command at the start of a line | Runs command as a raw shell command and includes the output in context |
#note at the start of a line | Adds a note to memory/CLAUDE.md rather than sending a prompt |
/ | Opens the slash command menu |
Shift+Tab | Cycles between permission modes (ask / auto-accept edits / plan-only) |
Ctrl+C (once) | Interrupts the current response |
Ctrl+C (twice) | Exits the session |
Esc | Cancels the current input or stops a running tool call |
Ctrl+R | Search session history |
These prefixes matter more than they look — ! and # let you inject shell output or durable notes into a conversation without breaking your typing flow, which adds up over a long session.
Hooks, Subagents, and Skills: Picking the Right Tool
This is the part of Claude Code that trips people up most, because the three mechanisms overlap in what they can do but differ sharply in when they fire and how much you control them. A simple rule of thumb:
| Mechanism | Fires when | Best for |
|---|---|---|
| Slash command | You type it, explicitly | Manual, repeatable actions ("run my deploy checklist now") |
| Skill | Claude decides it's relevant | Domain knowledge and helper files Claude should pull in automatically |
| Subagent | You (or Claude) delegate work to it | Isolated, parallelizable, or context-heavy exploration |
| Hook | A defined lifecycle event occurs (PreToolUse, PostToolUse, Stop, etc.) | Deterministic enforcement — rules that must never depend on the model remembering |
The distinction that matters most: hooks are code, not instructions. A CLAUDE.md rule that says "never run rm -rf" depends on Claude reading and following it every single time. A PreToolUse hook that blocks the command pattern is enforced at the system level regardless of what the model decides. If a rule is genuinely non-negotiable — blocking destructive commands, injecting required context, logging every tool call for audit — put it in a hook, not a prompt.
A basic hook lives in .claude/settings.json:
json{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "./scripts/block-dangerous-commands.sh"
}
]
}
]
}
}Subagents, by contrast, are about context isolation, not enforcement. When you fork exploratory work — "search the whole codebase for every place we call this deprecated function" — into a subagent, that search's verbose output stays in the subagent's own context window instead of polluting your main conversation. You get the answer back; you don't get the noise. This is the single biggest lever for keeping long sessions coherent: delegate anything that would otherwise dump thousands of tokens of grep output into your main thread.
CLAUDE.md: The File That Sets the Rules
CLAUDE.md is the project-level memory Claude reads at the start of every session in a repo. A few hard-earned rules for writing one:
- Brevity is a performance requirement, not a nice-to-have. The longer CLAUDE.md gets, the more the probability of any individual instruction being followed drops. A 40-line file with five load-bearing rules beats a 400-line file with fifty half-remembered ones.
- Put durable facts here, not task state. Architecture decisions, naming conventions, and "always do X" rules belong in CLAUDE.md. "I'm currently refactoring the auth module" belongs in your conversation, not the file.
- Nest CLAUDE.md files in subdirectories for monorepos — Claude Code reads the nearest one up the directory tree, so a
packages/api/CLAUDE.mdcan add API-specific rules without bloating the root file. - Use
/initto bootstrap, then prune. The auto-generated version tends to over-document obvious things (like the fact thatpackage.jsonlists dependencies). Cut anything a competent engineer could infer from the code itself.
MCP Servers: Connecting Claude to the Outside World
MCP (Model Context Protocol) servers give Claude Code tools beyond its built-in file and shell access — GitHub, databases, Slack, browser automation, and dozens of other integrations. Manage them with claude mcp:
| Command | Purpose |
|---|---|
claude mcp add | Add a new MCP server connection |
claude mcp list | List configured MCP servers and their connection status |
claude mcp remove | Remove a server |
/mcp | Manage MCP connections from inside a session |
A permissions note worth internalizing: deny-first is safer than block-with-hooks for sensitive files. Setting a path to deny in permissions makes it invisible to Claude entirely — it can't read it, can't be tricked into reading it, can't accidentally surface its contents in a response. A hook that blocks access after Claude has already tried to read the file is a weaker guarantee than a permission that stops the read from happening at all.
A Practical Workflow Checklist
Putting it together, a solid default working pattern looks like this:
/init on a new repo, then prune the generated CLAUDE.md down to what actually matters.Key Takeaways
- Slash commands are explicit triggers; skills are things Claude decides to load — pick based on whether you want manual control or automatic context.
- Hooks enforce rules deterministically at the system level; CLAUDE.md instructions depend on the model remembering — use hooks for anything truly non-negotiable.
- Subagents exist primarily for context isolation, not just parallelism — delegate noisy exploratory work so it doesn't pollute your main session.
- Keep CLAUDE.md short. A shorter file with fewer, sharper rules outperforms a long one every time.
!and#prefixes let you inject shell output and durable notes into a session without leaving the prompt.
Next Steps
Bookmark this page — it's built to be a working reference, not a one-time read. If you're studying for the Claude Certified Architect (CCA) exam, the sections on hooks, subagents, and skills map directly onto tested material around agentic tool design and context management. AI for Anything's CCA practice test bank covers exactly this territory with exam-style questions and explanations, so you can check whether you actually understand the distinctions above or just recognize the vocabulary.
Ready to Start Practicing?
300+ scenario-based practice questions covering all 5 CCA domains. Detailed explanations for every answer.
⚡ Get the hottest AI insights, daily
One short email a day — the AI news, tools, and how-tos that actually matter. Plus, be first to hear when the personalized 30-Day AI Mastery Challenge launches.