Claude Code Commands Cheat Sheet (2026)

Explore the complete Claude Code commands list with 50+ verified slash commands, syntax, examples, MCP commands, and developer workflows. Updated for 2026.

A complete reference of Claude Code slash commands, including built-in commands, MCP-generated commands, bundled workflows, and custom commands.

This page reflects the current behavior of Claude Code (v2.1.x series). All commands are organized by real development scenarios, with syntax and practical usage notes so you can apply them directly in your workflow.

More than 50 commands are included, along with updates introduced in 2026.

Session & Conversation Management

CommandDescription
/clearClears all conversation history from the current session.
/compact [instructions]Summarizes the conversation to reduce context usage. You can pass instructions like “keep only API decisions”.
/resume [session]Reopens a previous session by name or ID.
/rename [name]Assigns a readable name to the current session.
/export [filename]Exports the session as a Markdown file or copies it to clipboard.
/rewindRestores a previous checkpoint in the session.
/exitEnds the current session and returns to the terminal.
/copyLets you select and copy specific code blocks from the conversation.

Context & Cost

CommandDescription
/contextShows how the context window is being used across messages and files.
/costDisplays token usage and estimated cost for the current session.
/statsShows usage statistics such as sessions and token totals.
/usageDisplays your plan limits and current quota usage.

Project & Memory

CommandDescription
/initCreates a CLAUDE.md file that describes your project structure and conventions.
/memoryOpens persistent memory for viewing and editing.
/todosDisplays the task list Claude maintains during multi-step work.

Code Review & Analysis

CommandDescription
/reviewReviews current changes for quality, structure, and completeness.
/security-reviewScans for common security issues such as injection risks or exposed secrets.
/pr-comments [id]Retrieves pull request comments so you can address feedback directly.

Model & Mode Control

CommandDescription
/model [name]Switches the active model or shows the current one.
/planEnables approval mode where each action requires confirmation.
/effort [low|medium|high]Controls how much reasoning effort Claude uses.
/fastEnables faster responses for rapid iteration.
/output-style [style]Sets the default format for responses, such as concise or detailed.

System, Tools & Permissions

CommandDescription
/permissionsControls which tools can run automatically and which require approval.
/hooksConfigures actions that run at specific events during execution.
/sandboxRuns commands in an isolated environment.
/configOpens configuration settings such as API keys and defaults.
/add-dir [path]Adds additional directories to the working scope.
/terminal-setupConfigures terminal behavior such as multiline input.
/keybindingsCustomizes keyboard shortcuts.
/loginAuthenticates your account.
/logoutLogs out and clears stored credentials.

IDE, Integrations & Remote

CommandDescription
/ideDisplays connected IDE integrations such as VS Code or JetBrains.
/mcpOpens the MCP server manager for external tool integrations.
/install-github-appSets up GitHub integration for pull request workflows.
/teleportConnects CLI sessions with web sessions.
/rcStarts a remote control session for long-running tasks.
/remote-envConfigures remote development environments.
/agentsManages subagents used during complex workflows.
/pluginOpens the plugin manager.

MCP Server Commands

MCP commands are generated dynamically based on connected servers. The available commands depend on which services you connect.

CommandDescription
/mcp__[server]__[prompt] [args]Executes a command provided by an MCP server.
/mcp__github__list_prsLists pull requests from GitHub.
/mcp__jira__create_issueCreates a Jira issue.
/mcp__linear__get_sprintRetrieves sprint data from Linear.

Bundle Commands (Multi-Agent Workflows)

CommandDescription
/simplifyRefactors code across the project using coordinated agents.
/batchApplies the same change across multiple files.
/loopRepeats a workflow until a condition is met.
/debugRuns a structured debugging workflow.

Custom Commands

Custom commands are defined in:

  • .claude/commands/
  • .claude/skills/

They support:

  • Passing arguments ($ARGUMENTS, $1, $2)
  • Injecting files (@file)
  • Running shell commands
  • YAML frontmatter configuration for tools and models

Community / Unofficial Commands

These are not included by default but are commonly used in shared setups.

CommandDescription
/commitGenerates and runs a commit message workflow.
/pushPushes changes to the repository.
/branchCreates a new branch from a description.
/lintRuns linters based on the project setup.
/vitestRuns tests using Vitest.
/prOpens a pull request.
/merge-to-mainHandles merge workflow with checks.
/fix-pipelineAttempts to fix failing CI pipelines.

Real Workflows

1. Starting a New Project

When you open a repository for the first time, you usually want Claude to understand the project before doing any work.

/init
/status

This creates a CLAUDE.md file that describes your project structure and confirms your current configuration.

2. Refactoring Existing Code

A typical refactor involves reviewing the current code, applying changes across files, and verifying the result.

/review
/simplify
/batch rename oldFunction newFunction
  • /review helps you understand current issues
  • /simplify proposes structural improvements
  • /batch applies consistent changes across multiple files

3. Fixing Bugs

When something breaks, you usually want to inspect, debug, and iterate until the issue is resolved.

/debug
/loop
  • /debug analyzes the issue and proposes fixes
  • /loop repeats the process until the problem is resolved

4. Managing Long Sessions

As conversations grow, context becomes expensive and harder to manage.

/context
/compact keep only important decisions
/cost
  • /context shows what is consuming tokens
  • /compact reduces history while keeping key information
  • /cost helps you keep usage under control

5. Working with Pull Requests

Before opening or merging a PR, you usually want a full review and to address feedback.

/review
/security-review
/pr-comments

This workflow checks code quality, identifies risks, and pulls in reviewer comments.

6. Switching Between Tasks

When you work on multiple features, it helps to separate sessions.

/rename feature-auth
/clear
/resume feature-auth

You can save one task, start another, and return later without losing context.

FAQs:

Q: What is Claude Code?
A: Claude Code is Anthropic’s terminal-based AI coding agent. It runs locally via the CLI (npm install -g @anthropic-ai/claude-code), reads and edits your actual project files, executes shell commands, runs tests, and manages git operations.

Q: What is the difference between a slash command and a prompt in Claude Code?
A: A prompt is what you type to give Claude a coding task: “refactor this function,” “write a test for this endpoint.” A slash command controls the session itself.

Q: What is CLAUDE.md and what goes in it?
A: CLAUDE.md is a Markdown file in your project root that Claude reads at the start of every session in that repository. It acts as a persistent project brief.

Q: What is the difference between /clear and /compact?
A: /clear deletes all conversation history. The context window is empty after running it, but file edits made during the session remain. /compact replaces conversation history with a compressed summary, preserving the thread of what was discussed. Use /compact when you want Claude to remember context from earlier in the session but need to free up token budget. Use /clear when you are switching to a completely different task and do not need any prior context.

Q: What does /plan actually do in Claude Code?
A: /plan toggles plan permission mode. In this mode, Claude proposes each tool action and waits for your approval before executing it. Use it when working in an unfamiliar codebase or before a large refactor you want to review step by step.

Q: How do I create a custom slash command in Claude Code?
A: Create a Markdown file at .claude/commands/[name].md in your project (for team-shared commands) or ~/.claude/commands/[name].md (for personal commands available in all projects). The filename without the .md extension becomes the command name. The file content is the prompt Claude receives when the command runs. Add a YAML-style frontmatter block at the top to specify which tools the command can use, which model to run it with, and a description that appears in /help. Use $ARGUMENTS in the file content to capture whatever text is passed after the command name.

Q: Can Claude Code connect to GitHub?
A: Yes, in two ways. First, /install-github-app sets up the Claude GitHub App, which lets Claude participate in pull request workflows via GitHub Actions. Second, connecting a GitHub MCP server via /mcp exposes GitHub API operations as slash commands directly in your session (e.g., /mcp__github__list_prs, /mcp__github__create_pr).

Q: How do I reduce costs when using Claude Code?
A: Several approaches work well in combination. Switch to Haiku for mechanical tasks (/model haiku) and back to Opus or Sonnet for complex reasoning. Use /effort low for quick iteration tasks where deep reasoning is not necessary. Run /compact before context gets very large, since larger contexts cost more per token. For custom commands that run frequently, add model: haiku to the frontmatter.

Q: What is the difference between /doctor and /status in Claude Code?
A: /doctor actively tests your environment. It reports failures with actionable error messages. /status reads and displays your current configuration, such as the active model, permission mode, connected MCP servers, and tool state. Run /doctor after installation, after upgrading, or when Claude Code behaves unexpectedly. Run /status at the start of a session to confirm settings before starting work.

Q: Can Claude Code be used in a CI/CD pipeline?
A: Yes. Claude Code supports a non-interactive print mode (claude -p "your prompt") that executes a single prompt and exits, making it scriptable in any CI environment. The --output-format json flag structures the output for programmatic parsing. For GitHub specifically, /install-github-app sets up the official Claude GitHub Actions integration. The /hooks command also allows HTTP webhooks on lifecycle events, which can trigger external CI systems when Claude completes a task or uses a specific tool.

Q: What MCP servers work with Claude Code?
A: Any server that implements the Model Context Protocol can be connected. Once connected via /mcp, each server’s prompts appear as slash commands in the /mcp__[server]__[prompt] format.

Related Resources

Last audited: March 2026

Leave a Reply

Your email address will not be published. Required fields are marked *

Get the latest & top AI tools sent directly to your email.

Subscribe now to explore the latest & top AI tools and resources, all in one convenient newsletter. No spam, we promise!