Home AI SkillsClaude Code Slash Commands Cheat Sheet: 20 Essential Commands

Claude Code Slash Commands Cheat Sheet: 20 Essential Commands

by Knowledge Base Linux
Claude Code slash commands cheat sheet with the essential command console

Claude Code slash commands are the controls of your session: typed directly into the prompt, they configure how the agent behaves instead of asking it to do work. Most users only ever discover /clear, but the built-in command set covers context management, project memory, code review, permissions, model selection and extensibility. This cheat sheet collects the 20 commands that cover 95% of daily use, grouped by what you are trying to do.

Session and Context: The Claude Code Slash Commands You Will Use Daily – Claude Code Slash Commands Cheat Sheet

Command What it does
/help Lists every available command, including your custom ones. Your first stop when you forget anything on this page.
/clear Wipes the conversation history completely. Use it when switching to an unrelated task so old context stops polluting answers.
/compact Summarizes the conversation and continues with the summary as context. Accepts instructions, e.g. /compact focus on the API changes. The mid-project alternative to /clear.
/context Shows a visual breakdown of what is consuming your context window — system prompt, memory files, conversation, tool results.
/resume Reopens a previous session so you can continue where you left off instead of re-briefing the agent.
/rewind Rolls the conversation (and optionally code changes) back to an earlier checkpoint — an undo button for agentic work.

The /compact versus /clear distinction is the one that matters most: compact keeps the thread of your current feature while freeing space; clear is for a genuinely new task. Checking /context before either tells you whether you actually have a problem.

Project and Memory Claude Code Slash Commands – Claude Code Slash Commands Cheat Sheet

Command What it does
/init Analyzes your codebase and generates a starter CLAUDE.md project memory file. Run it once per repository.
/memory Opens your memory files (user, project and local CLAUDE.md) in an editor so you can view and adjust what Claude remembers.
/add-dir Adds another directory to the session’s working set — essential for monorepos and multi-repo work.
/model Switches the active model mid-session, e.g. from Sonnet to Opus for a hard problem, or to Haiku for quick questions.
/plan Enters plan mode: Claude explores read-only and presents a plan for your approval before editing anything.
Claude Code slash commands for managing context with compact and clear

Review, Safety and Account Commands

Command What it does
/review Reviews your current changes or a pull request and reports issues like a human reviewer.
/security-review Focuses the review specifically on security problems in pending changes.
/permissions Manages allow, ask and deny rules for tools — for example auto-approving git status while blocking destructive shell commands.
/cost Shows token usage and cost for the session (most relevant for API-key users).
/usage Shows your plan usage and rate-limit status on subscription accounts.
/doctor Diagnoses installation and configuration problems. Run it first whenever something behaves strangely.
/config Opens the settings panel for theme, model defaults and other preferences.

Extending Claude Code: Slash Commands for Power Users

Command What it does
/mcp Manages connected MCP servers — check status, reconnect, and complete OAuth sign-ins for remote servers.
/agents Lists and manages your custom subagents, and helps you create new ones interactively.
/hooks Displays the hooks configured for your session so you can confirm which automations are active.

These three open the door to the platform features: MCP servers add external tools, subagents add specialized workers, and hooks add deterministic automation around everything.

Bonus: Create Your Own Custom Slash Commands

Any Markdown file in .claude/commands/ becomes a project slash command named after the file. A file called .claude/commands/fix-tests.md gives you /fix-tests:

Run the project test suite. For every failure:
1. Read the failing test and the code under test
2. Explain the root cause in one sentence
3. Apply the smallest fix and re-run the suite

Focus on: $ARGUMENTS

The $ARGUMENTS placeholder is replaced by whatever you type after the command, so /fix-tests auth module passes “auth module” into the prompt. Personal commands live in ~/.claude/commands/ and follow you across projects.

One More Thing: Skills Appear as Commands Too

Claude Code also supports skills — packaged, on-demand workflows stored as SKILL.md files — and installed skills surface in the same slash-command menu as built-ins. The /skills command lists everything available in the current project, which typically mixes Anthropic’s built-ins, your team’s shared skills from .claude/skills/, and your personal ones. The practical takeaway: the command list is not fixed. Between custom commands and skills, a mature project may offer dozens of project-specific commands, and /help remains the source of truth for what your setup actually provides today.

Conclusion

Print this page mentally as five habits: /init in every new repo, /plan before big changes, /context and /compact to keep sessions healthy, /review before every commit, and /permissions tuned so the agent moves fast without moving dangerously. The full, always-current list lives in Anthropic’s official slash commands reference. For the workflow that ties these commands together, read our Claude Code best practices guide next.

You may also like

KbLinux

Typically replies within a day

Hello, Welcome to the site. Please click below button for chatting me through Telegram.