Tool cheatsheet
Claude Code Cheatsheet
Run Claude Code in the terminal: starting sessions, slash commands, permissions, CLAUDE.md, hooks, MCP servers and headless use.
Install and start
- Install Claude Code — Install the CLI with npm. A native installer is also available; see the quickstart.
- Start a session — Start an interactive session in the current project. You are asked to sign in on first use.
- Start with a prompt — Open a session that begins with your question.
- Check the version — Print the installed version.
- Update Claude Code — Update to the latest release.
- Diagnose problems — Check the installation and configuration for common problems. Inside a session, /doctor does the same.
Sessions and flags
- Run one prompt and exit — Print mode runs the prompt, prints the answer and exits, which suits scripts.
- Pipe content in — Send a file or command output to Claude as context.
- Continue the last session — Pick up the most recent conversation in this directory.
- Resume an earlier session — Choose from earlier sessions, or pass a session ID.
- Choose a model — Start with a specific model, by alias or full name.
- Start in plan mode — Plan mode lets Claude read and plan without making changes.
- Give access to another folder — Let Claude work with files outside the current directory.
- Get machine-readable output — Return the result as JSON so scripts can parse it.
- Add to the system prompt — Add instructions for this run while keeping Claude Code's defaults.
Inside a session
- List commands — Show the available slash commands.
- Create a CLAUDE.md — Analyze the project and write a CLAUDE.md with build commands and conventions.
- Start a fresh conversation — Clear the context window. Use it between unrelated tasks.
- Shrink a long conversation — Summarize the history to free up context. Add instructions about what to keep.
- Switch model — Choose a different model for the rest of the session.
- Manage permissions — View and change which tools Claude may use without asking.
- Check MCP servers — See connected MCP servers and sign in to remote ones.
- See usage and cost — Show token use for the session.
- Run a shell command — Start a line with ! to run it in your shell and add the output to the conversation.
- Mention a file — Type @ then a path to add that file to the conversation.
- Learn the keyboard shortcuts — Shift+Tab cycles permission modes, Esc interrupts Claude, and pressing Esc twice lets you go back and edit an earlier message.
Configuration files
- Write a CLAUDE.md — Project memory that Claude reads at the start of every session: commands, conventions and gotchas.
- Allow and deny tools — In .claude/settings.json, allow safe commands without prompts and block sensitive files.
- Run a command after edits — A hook runs your command automatically at an event, here after Claude edits or writes a file.
- Create a slash command — A Markdown file in .claude/commands becomes a command. This one is /review-pr, and $ARGUMENTS holds what you type after it.
- Define a subagent — A Markdown file with front matter in .claude/agents defines a specialist Claude can delegate to.
- Add a remote MCP server — Connect Claude Code to a remote MCP server by URL.
- Add a local MCP server — Run a local MCP server as a subprocess. Everything after -- is the command that starts it.
- List MCP servers — Show the configured MCP servers.
Automation and CI
- Run Claude Code in CI — Run a non-interactive task with only the tools it needs and a turn limit. Review the changes before merging.
- Use an API key — Authenticate with an API key from the environment instead of signing in, which suits CI.
- Review a diff in a script — Pipe a diff to Claude and get a review back.
- Draft a commit message — Ask for a commit message from the staged changes.
Related cheatsheets
- Ansible 2 cheatsheet — Run ad-hoc commands and playbooks, manage inventories, roles, collections and secrets with Ansible.
- Argo CD 3 cheatsheet — Install Argo CD, define Applications declaratively, and manage sync, diffs, history and rollbacks with the argocd CLI.
- AWS CLI 2 cheatsheet — Configure credentials and manage S3, EC2, Lambda, logs, containers and secrets with the AWS CLI v2.
- Azure CLI 2 cheatsheet — Sign in and manage resource groups, VMs, web apps, storage, Kubernetes, registries and secrets with the az command.
- Bash and Linux 5 cheatsheet — Everyday shell and Linux commands for files, searching text, permissions, processes and servers.
- Claude API cheatsheet — Call Claude from Python, TypeScript or curl: messages, streaming, thinking, tools, structured output, caching, batches and error handling.