COURSES / CLAUDE-CODE / CHEAT SHEET

Commands cheat sheet

← Claude Code: from beginner to expert Reference

Claude Code commands cheat sheet

The 48 commands worth knowing in Claude Code, sorted by use — each with what it does and a concrete example. Type to filter by command, action or keyword.

Start & quit

The terminal commands to start, resume or quit a session.

claude terminal

Starts an interactive session in the current folder.

Go into your project (cd my-project) then type claude.

claude "votre question" terminal

Starts by asking a question straight away.

claude "explain this project structure in three sentences".

claude -c terminal

Resumes the most recent conversation in the current folder.

Closed the terminal yesterday? claude -c picks up where you left off.

claude --resume terminal

Lists your past sessions so you pick one to resume.

Short alias: claude -r. Handy to find a specific task.

claude update terminal

Updates Claude Code to the latest version.

Run it now and then; the tool evolves fast.

claude doctor terminal

Diagnoses the installation and configuration.

Odd behaviour? Run claude doctor first.

claude --version terminal

Prints the installed version number.

Useful to confirm an update or report a bug.

Drive the session

The slash commands typed during a session to drive it day to day.

/help command

Shows the list of all available commands.

The built-in cheat sheet: no need to memorise commands.

/clear command

Starts from an empty context, for an unrelated task.

Switching from CSS to an import script? /clear tidies up.

/compact command

Summarises the conversation to free context, keeping the essentials.

Long session getting fuzzy? /compact keeps what matters.

/context command

Visualises how full the session context is.

To tell whether it is time to /compact or /clear.

/model command

Switches model: fast and cheap, or more powerful.

Small task → a fast model; tricky problem → a powerful one.

/usage command

Shows your usage and costs (alias: /cost).

To keep an eye on the bill when paying per API use.

/config command

Opens settings (theme, editor mode, preferences).

Turn on vim editor mode for input, for instance.

/resume command

Returns to an earlier conversation without leaving the session.

Like claude --resume, but from inside the current session.

/rewind command

Rolls back code AND conversation to a checkpoint.

A change you dislike? /rewind cleanly reverts it.

/export command

Exports the conversation as plain text.

Handy to archive or share a session.

Stay in control

Permissions, plan mode and guardrails: you stay the pilot, Claude the copilot.

Shift + Tab shortcut

Cycles modes: normal → auto-accept edits → plan.

The key shortcut: switch to plan mode in one keystroke.

claude --permission-mode plan terminal

Starts straight in plan mode: read-only, then a plan to approve.

Ideal before any refactor: Claude proposes without touching anything.

/permissions command

Manages the allow / ask / deny rules for tools.

Allow npm test once and for all; deny reading .env.

/hooks command

Views and configures hooks (commands run automatically).

E.g. run prettier after every file Claude edits.

--dangerously-skip-permissions terminal

Skips all permission prompts. Reserve for isolated environments.

Fine in a throwaway CI container; never on your machine.

Memory & customisation

Give Claude a lasting memory and tailor it to how you work.

/init command

Generates a starter CLAUDE.md by analysing the project.

First reflex on a new project: run /init, then refine.

/memory command

Opens and edits the CLAUDE.md memory files.

To add a team convention or a test command.

/agents command

Creates and manages specialised subagents (separate context).

E.g. a read-only "code reviewer" subagent.

.claude/commands/nom.md command

A markdown file here (or a skill) creates a custom /name command.

Create .claude/commands/review.md to get /review.

Extend: MCP & GitHub

Connect Claude Code to external tools: databases, browser, services, GitHub repos.

claude mcp add <nom> -- <commande> terminal

Adds a local MCP server (a capability plugged into Claude).

claude mcp add playwright -- npx @playwright/mcp@latest (browser).

claude mcp add --transport http <nom> <url> terminal

Adds a remote MCP server, reachable via a URL.

For a hosted service (Sentry, Notion…) rather than a local one.

claude mcp list terminal

Lists your MCP servers and their status.

claude mcp get <name> for details, claude mcp remove <name> to remove.

/mcp command

Shows MCP server status and starts authentication (OAuth).

A server needs sign-in? Type /mcp and follow the browser.

/install-github-app command

Wires your repo: mentioning @claude in an issue/PR triggers the agent.

"@claude fix this bug" in a comment, and the GitHub action runs.

Prefixes & keyboard shortcuts

The special leading characters and the keys worth knowing to move fast.

/ prefix

At the start of a line: runs a command or a skill.

Type / to reveal the full, filterable list.

! prefix

Runs a shell command directly, without going through Claude.

! git status shows the status and adds it to the conversation.

@ prefix

References a project file, with autocomplete.

Explain @src/auth.js: Claude reads the file itself.

# prefix

Saves the following instruction into the CLAUDE.md file.

# Always run npm run lint before a commit → saved for good.

Échap shortcut

Interrupts Claude mid-action, keeping the work done so far.

Going the wrong way? Esc, then rephrase.

Échap Échap shortcut

Clears the current draft, or opens the rewind menu.

On empty input, double Esc steps back through history.

↑ (flèche haut) shortcut

Recalls your previous messages to reuse or edit them.

Reuse a request without retyping it all.

Tab shortcut

Completes a filename, or accepts the greyed-out suggestion.

After @ or /, Tab speeds up typing.

Ctrl + V shortcut

Pastes an image into the prompt (Claude reads images).

A screenshot beats ten lines of description. Alt+V if Windows grabs Ctrl+V.

Ctrl + C shortcut

Clears the current input; twice in a row, quits Claude Code.

Started a long request and changed your mind? Ctrl+C.

Ctrl + O shortcut

Toggles the detailed transcript view: every tool call.

To see exactly what Claude did, step by step.

Ctrl + B shortcut

Moves a long command to the background so you keep working.

A dev server running? Background it and move on.

Automate (headless & CI)

Claude Code as a Unix command: scriptable, embeddable in your pipelines.

claude -p "prompt" terminal

"Print" mode: one answer, then exits. The heart of headless mode.

cat errors.log | claude -p "explain the root cause".

--output-format json terminal

Returns structured output a script can parse (with jq, say).

claude -p "summarise" --output-format json | jq -r ".result".

--allowedTools "Read,Bash(git diff:*)" terminal

Strict allowlist of tools permitted without confirmation.

Essential in CI: Claude can ONLY do what you list.

--max-turns N terminal

Limits the agent’s number of turns (a circuit breaker).

E.g. --max-turns 10 to cap the cost of an automated task.

claude setup-token terminal

Generates a long-lived token for CI and scripts.

Store it in your pipeline secrets, never in plain text.