New: Skill bounties are live. Post a request, fund the bounty, and creators compete for 7 days to build it -> See open bounties

    Format & Reference
    claude-code
    commands
    reference

    Claude Code Commands: Complete Reference and Cheat Sheet (2026)

    Every Claude Code slash command, keyboard shortcut, and CLI flag in one place. Includes a printable cheat sheet and how to build custom commands.

    July 31, 20266 min read
    Share:

    Claude Code has more built-in commands than most people use. This is the full list, grouped by what you're trying to do, plus how to add your own.

    Quick Answer: Type / in Claude Code to see available slash commands. The ones worth memorising are /clear (reset context), /compact (summarise and continue), /plan (read-only planning), /mcp (check server connections), and /resume (return to a previous session). Custom commands go in .claude/commands/ as markdown files.

    Session and context commands

    Context management is where most Claude Code sessions go wrong. These are the commands that fix it.

    /clear          Wipe conversation history, keep the session open
    /compact        Summarise the conversation and continue with less context
    /resume         Reopen a previous session
    /cost           Show token usage and cost for this session
    /status         Show current model, mode, and working directory
    

    Use /clear when switching to an unrelated task. Use /compact when you're deep in something and running out of context but need the history. The difference matters: /clear loses everything, /compact keeps a summary.

    What this fixes: the slow degradation where Claude gets worse over a long session because early context crowds out what's relevant now.

    Recommended skills

    Permission and mode commands

    /plan           Enter Plan Mode for the next prompt (read-only)
    Shift+Tab       Cycle permission modes: Default → Auto-Accept → Plan
    /permissions    View and edit tool permissions for this project
    

    Plan Mode blocks every write tool until you approve a plan. Auto-Accept applies edits without asking. Default asks per action.

    Full detail in Claude Code Plan Mode.

    What this fixes: approving 40 individual edits during a refactor, or the opposite, Claude rewriting eleven files before you noticed.

    Configuration and integration commands

    /mcp            List connected MCP servers and their status
    /config         Open configuration settings
    /model          Switch model mid-session
    /init           Generate a CLAUDE.md for the current project
    /memory         Edit the project's CLAUDE.md
    

    /mcp is the first thing to run when a server isn't working. It tells you whether the server connected before you start editing config files.

    What this fixes: guessing whether a config change took effect.

    Keyboard shortcuts

    Shift+Tab       Cycle permission modes
    Ctrl+C          Cancel the current operation
    Ctrl+D          Exit the session
    Ctrl+L          Clear the terminal display (not the context)
    Esc             Interrupt Claude mid-response
    Esc Esc         Edit your previous message
    Up / Down       Navigate message history
    

    Esc Esc is the most underused shortcut in Claude Code. It lets you rewrite your last prompt and re-run it, instead of adding a correction on top of a bad instruction.

    What this fixes: the pattern where a vague first prompt produces a wrong answer and every follow-up inherits the confusion.

    CLI flags

    claude                              # Start an interactive session
    claude "fix the failing test"       # Start with an initial prompt
    claude -c                           # Continue the most recent session
    claude -r                           # Pick a session to resume
    claude -p "summarise this repo"     # Print mode: run once, output, exit
    claude --permission-mode plan       # Start in Plan Mode
    claude --model claude-opus-4-5      # Start with a specific model
    claude mcp list                     # List configured MCP servers
    

    Print mode (-p) is the one to know for scripting. It runs a single prompt and exits, so you can pipe Claude into shell scripts, git hooks, and CI.

    git diff --staged | claude -p "write a conventional commit message"
    

    What this enables: Claude Code as a Unix tool rather than only an interactive session.

    Writing custom commands

    Custom slash commands are markdown files in .claude/commands/. The filename becomes the command.

    Create .claude/commands/review.md:

    Review the staged changes.
    
    For each file:
    1. Read the full file, not just the diff
    2. Check for logic errors, security issues, and missing error handling
    3. Rate each finding Critical, Warning, or Suggestion
    4. Show a concrete fix for anything Critical
    
    Skip style nits. Focus on things that will break.
    

    Now /review runs that prompt.

    Use $ARGUMENTS to accept input:

    Write tests for $ARGUMENTS.
    
    Detect the existing test framework from package.json.
    Match the naming and assertion style already used in the project.
    Cover the happy path, edge cases, and error cases.
    

    Called as /test src/auth.ts.

    What this demonstrates: custom commands are prompt templates, not code. Anything you type repeatedly should be one.

    Custom commands vs skills

    They solve different problems and the distinction matters.

    A custom command is a prompt you invoke deliberately. It lives in one project. You type /review and it runs.

    A skill is a capability the agent loads automatically when the description matches what you asked. It works across every SKILL.md-compatible agent, Claude Code, Cursor, OpenClaw, Codex CLI.

    Use a command for a project-specific workflow you trigger by hand. Use a skill for a method you want applied consistently without remembering to invoke it.

    The most installed skills that replace common custom commands: code-reviewer (764 installs, free), git-commit-writer (232 installs, free), and pr-description-writer (85 installs, free).

    Browse all Claude Code skills on Agensi.

    The cheat sheet

    CONTEXT              PERMISSIONS           CONFIG
    /clear               /plan                 /mcp
    /compact             Shift+Tab             /config
    /resume              /permissions          /model
    /cost                                      /init
    /status                                    /memory
    
    SHORTCUTS            CLI
    Esc      interrupt   claude -c      continue
    Esc Esc  edit last   claude -r      resume
    Ctrl+C   cancel      claude -p      print mode
    Ctrl+D   exit        claude mcp list
    

    For the wider Claude Code feature set, read Everything Claude Code.

    Keep reading

    Frequently Asked Questions