Agentic AI with Java: Live Cohort
Claude CodeSlash Commands

Introduction to Slash Commands

What slash commands are, why they exist, and the three kinds you will use in Claude Code.

When you work with any coding assistant, you talk to it through prompts, and better prompts give better results. Models keep improving, so even rough prompts often work. But some activities you repeat again and again: initialise a project, check usage, clear the context, switch models.

Typing a fresh prompt for each of those is a waste of time. So Claude Code gives you slash commands: short, fixed commands that start with /. Some control Claude Code directly (like /clear), and others are packaged prompts that always do the same job well (like /init).

Seeing all the commands

Type a single / in the prompt. A list of available commands appears, and it filters as you type.

/

You have already used a few without thinking of them as "commands":

CommandWhat it did for us
/initAnalysed the project and created CLAUDE.md
/modelSwitched between Opus, Sonnet and Haiku
/usageShowed session and weekly usage
/login, /logoutSwitched accounts
/rewindOpened the checkpoint menu
/exitClosed the session

Three kinds of slash commands

Built-in commands, bundled skills and your own skills
KindWhat it isExamples
Built-in commandsControl Claude Code itself: sessions, context, models, settings/clear, /compact, /context, /model, /status
Bundled skillsPrompt-based workflows that ship with Claude Code/code-review, /simplify, /batch, /debug
Your own skillsCommands you create for your project or team/telusko-status, /scaffold-endpoint (Section 9)

What happens behind the scenes

How built-in commands and skills are handled

When you press Enter, Claude Code first checks whether the text starts with a known command name.

  • Built-in commands like /clear, /model or /compact run fixed logic inside Claude Code. /clear does not ask the model anything. It simply starts a fresh conversation.
  • Skills, bundled or your own, are turned into instructions for Claude. /review loads a carefully written review prompt, and Claude then works through it with its normal agentic loop.

This is why a skill can take a while and use tokens, while most built-in commands react instantly.

Anatomy of a command

Many commands accept arguments after the name, separated by a space:

You typeCommandArgumentEffect
/model sonnet/modelsonnetSwitch straight to Sonnet, without opening the picker
/compact keep the API decisions/compactfocus textSummarise, but keep what you asked for
/rename backend-crud/renamea nameLabel the current session
/effort high/efforta levelChange the effort level
/scaffold-endpoint GET /api/xyour skillverb and pathPassed to the skill as $ARGUMENTS (Section 9)

Run a command without arguments and it usually opens an interactive picker instead.

Finding the right command

MethodHow
Type /Shows the list and filters as you keep typing, for example /co shows /compact, /config, /context
/helpLists the commands available in your version
/skillsLists only skills, including your own
The commands referenceFull descriptions of every built-in command and bundled skill

Commands, shell mode and shortcuts

These look similar but do very different things:

InputWhat it isExample
/nameA slash command or skill/context
!commandShell mode: runs the command directly in your terminal, without the model!git status
@pathAttaches a file to your promptRead @specs/api-contract.md
Shift+Tab, Esc, Ctrl+OKeyboard shortcutsChange permission mode, stop Claude, open transcript

MCP servers can add commands too

Some MCP servers (Section 11) expose ready-made prompts. They appear as commands with the server name in them, such as /mcp__github__pr_review.

You do not need to memorise them

There are dozens of commands, and new ones arrive regularly. You will not use all of them. In daily work, most developers rely on a handful: /clear, /compact, /context, /model, /resume and a couple of custom skills.

In the next lesson we go through the essential ones in a logical order. Others, like /agents and /mcp, will appear when we need them.

Run /help at any time to see the commands available in your version. Since Claude Code updates frequently, /help and the commands reference are always more current than any tutorial.

Official references


Written By: Shramik Masti

How is this guide?

Last updated on