The 28 Essential Claude Code Commands I Use Most Often, Explained | Cheat Sheet
What each one does, when to use it, and a real example for every single one +
You’re reading Excellent AI Prompts.
AI prompt chains, agent skills, and agentic workflows for professionals learning to use AI to earn more, think sharper, and live better.
Copy them. Use them. Build with them.
Claude Code is Anthropic’s agentic coding tool that lives in your terminal, and most of what makes it fast to drive comes down to two kinds of commands: the slash commands you type inside a running session, and the CLI commands and flags you use to launch and script it. If you have ever found yourself pasting the same instructions into the chat over and over, or wishing you could steer a session without breaking your flow, the commands below are the answer. This guide walks through what each category does and when to use it.
This guide assumes you already have Claude Code installed and running; if you do not, the install steps and a quick start live in the official documentation at code.claude.com. Everything below works the same whether you are on the free tier or a paid plan, though a few features noted along the way are paid-only.
Official documentation: see the macOS and Windows setup guides at code.claude.com/docs/en/setup.
In this issue
Slash commands for steering a live session
Setting up the project
Configuring the session
Planning the work
Managing context as you work
Running work in the background
Reviewing what was built
Recovering and moving on
Diagnosing problems
Wrapping up
Turning repeated instructions into skills
Launching and scripting CLI commands from the terminal (or PowerShell)
Putting it together
Slash commands for steering a live session
A command is only recognized at the very start of your message, and any text after the command name gets passed to it as an argument or prompt. The fastest way to explore is to type a single slash to bring up the full menu, then keep typing letters to filter it down. Using these commands is mostly intuitive, but it helps to think about them in terms of a workflow.
Here are the commands you will likely use most often, grouped roughly in the order they come up, with a note on what each one does.
To make these concrete, the examples under each command follow a single project from start to finish: building a personal portfolio website, a small static site with a hero, a projects grid, an about section, and a contact form. The commands below are ordered roughly the way you would use them on that project, from setting up the repository through to shipping and reviewing the final result.
Quick reference
/init: generate a starter CLAUDE.md, run once per repo
/memory: edit your CLAUDE.md and auto-memory entries
/mcp: connect and manage MCP servers
/agents: configure and dispatch subagents
/permissions: set allow, ask, and deny rules for tools
/model: switch model and set the default
/effort: set how much reasoning effort to spend
/config: open settings (alias: /settings)
/plan: enter plan mode before touching code
/goal: keep working across turns until a goal is met
/context: visualize context-window usage
/compact: summarize the conversation to free up context
/btw: ask a quick side question off the main thread
/tasks: manage background work (alias: /bashes)
/background: detach the session as a background agent (alias: /bg)
/batch: run large-scale parallel changes across the codebase
/loop: run a prompt on repeat while the session stays open (alias: /proactive)
/diff: view uncommitted changes and per-turn diffs
/code-review: review the current diff, with an ultra option for a deeper cloud pass
/review: read-only review of a pull request locally
/security-review: scan pending changes for vulnerabilities
/clear: start a fresh conversation, keeping project memory
/resume: resume an earlier conversation (alias: /continue)
/branch: branch the conversation to try another direction
/rewind: roll code and chat back to a checkpoint (aliases: /undo, /checkpoint)
/doctor: diagnose your installation and settings
/debug: turn on debug logging to troubleshoot
/usage: see cost, limits, and stats (aliases: /cost, /stats)
Setting up the project
/init
Generates a starter CLAUDE.md file that captures your project’s conventions, structure, and commands. Run it the first time you open Claude Code in a repository so future sessions start with useful context already loaded.
Portfolio example: run /init in your new portfolio repo or folder so Claude knows that it is building a static HTML, CSS, and vanilla-JS site (describe what you want to build)
My example for this issue, a fiction author’s portfolio site:
/memory






