Claude Code Command Mastery: A Complete Guide to the Three-Layer System
If you have ever opened a terminal and typed claude only to feel overwhelmed by the number of available commands, you are not alone. Claude Code is a powerful assistant for developers, but its command structure can seem chaotic at first glance. The good news is that beneath the surface lies a simple, three-layer system. Once you understand this framework, you will never be confused again.
This guide is based on Claude Code version 2.1.74. While different versions, plans, plugins, and platforms may introduce slight variations, the core principles remain unchanged. Our goal is to give you a clear mental map, the most practical commands, and the confidence to use Claude Code effectively in your daily work.
1. The Three Layers of Claude Code Commands
Claude Code’s command system is built on only three layers. Memorise this structure and you will always know where to look for the right command.
| Layer | Name | What it does | Example |
|---|---|---|---|
| First | Main command | The program entry point you type in your shell | claude |
| Second | Subcommands | Manage features like authentication, MCP, plugins | claude auth login |
| Third | Slash commands | Control an active session from inside the REPL | /model, /clear |
In a nutshell:
The main command opens the program, subcommands manage features, and slash commands control the conversation.
2. Three Main Commands Every Beginner Should Know
These three commands will cover 90% of your interactions with Claude Code. Master them first.
| Command | Purpose | When to use |
|---|---|---|
claude |
Start an interactive Claude Code session | You need a multi‑turn conversation to solve a complex problem |
claude -p "task description" |
Non‑interactive mode: execute once and exit | Perfect for scripts, batch processing, or quick one‑off questions |
claude -c |
Continue the most recent session in the current directory | Resume an unfinished conversation right where you left off |
3. Most Useful Global Parameters (and How to Use Them)
Once you are comfortable with the basic commands, you will want to tailor Claude Code’s behaviour to each task. These parameters are the ones you will reach for most often.
Model and performance
-
--model– Choose which model version to use for this session. -
--effort– Set the thinking effort level (low,medium,high,max). Use lower effort for simple tasks to save resources. -
--fallback-model– Specify a backup model for--printmode when the primary model is congested.
Permissions and safety
-
--permission-mode– Define the permission strategy (default,auto,plan,dontAsk). -
--allowed-tools– Restrict the session to only the listed tools. -
--disallowed-tools– Explicitly forbid certain tools. -
--tools– Customise the set of tools available during the session.
Debugging and output
-
--debug– Enable debug mode to see detailed internal information. -
--debug-file– Write debug logs to a specified file. -
--verbose– Force verbose output. -
--output-format– Choose output format (text,json,stream-json). -
--input-format– Set the input format (usuallytextorstream-json).
Session and workspace
-
--add-dir– Grant Claude Code access to additional directories beyond the current one. Useful for cross‑directory read/write operations. -
--session-id– Manually specify a session ID. -
--fork-session– When resuming an old session, create a forked copy instead of overwriting. -
--no-session-persistence– Do not save the session to disk.
If you are new to these parameters, start with these five:
-
--model– Pick the right model for your task. -
--effort– Save time and tokens on simple requests. -
--permission-mode– Control how often you are asked for tool approval. -
--debug– Invaluable when something does not work as expected. -
--output-format– Usejsonwhen you need structured output for further processing.
4. Parameters That Deserve Extra Caution
The following parameters directly change Claude Code’s behaviour and its safety boundaries. Use them only when you fully understand their implications.
| Parameter | What it does | Why be careful |
|---|---|---|
--dangerously-skip-permissions |
Bypass all permission prompts | The AI can execute potentially system‑altering actions without asking you. |
--allow-dangerously-skip-permissions |
Permit skipping permissions | Effectively gives the AI broader autonomy. |
--tools |
Customise the available tool set | You might inadvertently enable or disable critical tools. |
--system-prompt |
Override the default system prompt | Changes the AI’s fundamental behaviour; can lead to unexpected results. |
--permission-mode |
Switch permission strategies | Affects what the AI can do and when it needs your consent. |
These parameters are powerful in the right hands, but always double‑check your settings before using them in production or with sensitive projects.
5. Subcommands: Managing Claude Code from the Terminal
Beyond the main command, claude can be followed by various subcommands to configure and maintain the tool. Here are the most common ones:
claude agents # List or manage agents
claude auth # Manage login status and account authentication
claude auto-mode # View auto‑mode classifier configuration
claude doctor # Check installation health and updater status
claude install # Install the native version of Claude Code
claude mcp # Manage MCP servers
claude plugin # Manage plugins (also works as "plugins")
claude setup-token # Set a long‑lived authentication token
claude update # Check for and install new versions (also "upgrade")
5.1 Authentication Commands
These are the first subcommands you will need when setting up Claude Code.
Login and logout
-
claude auth login– Log in to your Anthropic account. -
claude auth login --email your@email.com– Pre‑fill your email address. -
claude auth login --sso– Force Single Sign‑On (SSO) login. -
claude auth logout– Sign out of the current account.
Check authentication status
-
claude auth status– Show human‑readable status. -
claude auth status --json– Output detailed status in JSON format.
5.2 Auto‑Mode Commands
These commands help you understand how automatic mode selection works. They are especially useful when troubleshooting unexpected behaviour.
-
claude auto-mode config– Display the currently active auto‑mode configuration. -
claude auto-mode defaults– Show the default auto‑mode rules.
5.3 Doctor, Install, Update, and Setup‑Token
Keep your Claude Code installation healthy with these commands.
Diagnostics
-
claude doctor– Run a health check on the installation and the automatic updater.
Installation and version management
-
claude install stable– Install the latest stable version. -
claude install latest– Install the most recent build (may be less stable). -
claude install 1.2.3– Install a specific version. -
claude install --force– Force reinstallation even if the version is already present.
Updates and tokens
-
claude update/claude upgrade– Check for and install new versions. -
claude setup-token– Configure a long‑lived token for automated environments (like CI/CD pipelines).
5.4 MCP Commands in Depth
MCP stands for Model Context Protocol. Think of it as a bridge that lets Claude Code connect to external tools, services, and additional context. Through MCP, you can extend what Claude Code can do.
Basic MCP commands
| Command | Description |
|---|---|
claude mcp list |
List all configured MCP servers |
claude mcp get <name> |
Show detailed information about a specific MCP |
claude mcp add <name> <command_or_url> |
Add a new MCP server |
claude mcp add-json <name> <json> |
Add an MCP using a JSON configuration |
claude mcp add-from-claude-desktop |
Import MCP settings from Claude Desktop |
claude mcp remove <name> |
Delete an MCP server |
claude mcp reset-project-choices |
Reset approval/denial records for MCPs in the current project |
claude mcp serve |
Start Claude Code’s own MCP server |
Common parameters for claude mcp add
| Parameter | Purpose |
|---|---|
--transport |
Specify transport (stdio, sse, http) |
--env |
Inject environment variables into the MCP process |
--header |
Set headers for HTTP connections |
--scope |
Define configuration scope: local, user, project |
--client-id |
OAuth client ID (if needed) |
--client-secret |
OAuth client secret |
--callback-port |
Fix the OAuth callback port |
For everyday users, the three most common MCP scenarios are:
-
claude mcp listto see which services are connected. -
claude mcp addto attach a new local or remote MCP. -
claude mcp removeto clean up unused connections.
5.5 Plugin Commands
Plugins are internal extensions that enhance Claude Code’s own capabilities. You can manage them using either claude plugin or claude plugins.
Basic plugin commands
| Command | Description |
|---|---|
claude plugins list |
List installed plugins |
claude plugins list --json |
Show the list in JSON format |
claude plugins list --available --json |
Include plugins available from the marketplace |
claude plugins install <plugin_name> |
Install a new plugin |
claude plugins enable <plugin_name> |
Enable an installed plugin |
claude plugins disable <plugin_name> |
Disable a plugin |
claude plugins disable -a |
Disable all enabled plugins |
claude plugins update <plugin_name> |
Update a specific plugin |
claude plugins uninstall <plugin_name> |
Remove a plugin |
claude plugins validate <path> |
Validate a plugin or marketplace manifest |
Common scope parameters (for install/enable/disable):
-
user– Apply the change only to the current user. -
project– Apply the change to the current project. -
local– More fine‑grained, directory‑level configuration.
5.6 Plugin Marketplace Commands
Marketplaces are sources where plugins are published. These commands let you manage those sources.
| Command | Description |
|---|---|
claude plugins marketplace list |
List configured marketplaces |
claude plugins marketplace list --json |
Output as JSON |
claude plugins marketplace add <source> |
Add a new marketplace |
claude plugins marketplace remove <name> |
Remove a marketplace |
claude plugins marketplace update |
Update all marketplaces |
claude plugins marketplace update <name> |
Update only a specific marketplace |
Parameters for marketplace add:
-
--scope– Write the marketplace definition touser,project, orlocal. -
--sparse– If the source is a monorepo, use sparse checkout to fetch only a subset of directories.
6. Slash Commands: Controlling Your Interactive Session
Once you are inside an interactive Claude Code session (by typing claude), you can use slash commands – they all start with a /. These commands let you manage the conversation, adjust settings, and access advanced features.
Note: The exact list of slash commands can vary slightly depending on your version, account permissions, installed plugins, and enabled skills. The commands listed below are those available in a typical installation.
6.1 Context and Session Management
| Command | What it does | When to use |
|---|---|---|
/help |
Show help and available commands | Any time you need a reminder |
/exit |
Leave the current REPL session | When you are done |
/clear |
Wipe the conversation history, freeing up context | Starting a completely new topic |
/compact |
Compress the context but keep a summary | You are near the context limit but want to preserve the gist |
/resume |
Restore a previous conversation | Continue an older session |
/rewind |
Roll back the conversation to a specific point | You went down a wrong path and want to try again |
/fork |
Create a new session branching from the current point | Explore an alternative approach without losing the original |
/rename |
Give the current session a meaningful name | Keep your sessions organised |
/copy |
Copy Claude’s last response (or a code block from it) | Grab output to paste elsewhere |
/export |
Export the current conversation to a file or clipboard | Save a record for later reference |
/diff |
View uncommitted changes and differences between turns | Review code modifications step by step |
Key distinctions:
-
/clearis a hard reset – Claude forgets everything. -
/compactis a soft reset – Claude retains a condensed memory. -
/resumebrings back an old conversation. -
/rewindmoves the current conversation backwards in time. -
/forkcreates a parallel branch without affecting the original.
6.2 Environment and Interface Settings
| Command | Description |
|---|---|
/status |
Show current status: version, model, environment, etc. |
/stats |
View usage statistics and activity |
/usage |
Check plan limits and consumption |
/cost |
Display total cost and time spent in the current session |
/config |
Open the configuration panel |
/model |
Switch to a different model |
/plan |
Enter or view Plan mode |
/permissions |
Manage tool permission rules |
/sandbox |
View or configure sandbox state |
/theme |
Change the UI theme |
/vim |
Toggle between Vim mode and normal editing mode |
/fast |
Toggle Fast Mode |
/ide |
Manage IDE integration and connection status |
/add-dir |
Add a working directory |
/statusline |
Customise the status bar UI |
/terminal-setup |
Install support for Shift+Enter line breaks in the terminal |
6.3 Account, Installation, and Connections
| Command | Description |
|---|---|
/login |
Log in or switch Anthropic accounts |
/logout |
Sign out of the current account |
/upgrade |
Upgrade your plan |
/doctor |
Run installation diagnostics |
/init |
Initialise a new CLAUDE.md file |
/desktop |
Continue the current session on Claude Desktop |
/chrome |
Manage Claude in Chrome settings |
/mobile |
Show a QR code to download the Claude mobile app |
6.4 Extension Management
| Command | Description |
|---|---|
/agents |
Manage agent configurations |
/hooks |
Manage tool event hooks |
/skills |
List currently available skills |
/mcp |
Manage MCP servers (same as terminal subcommand) |
/plugin |
Manage plugins (same as terminal subcommand) |
/reload-plugins |
Apply pending plugin changes to the current session |
/install-github-app |
Connect a GitHub repository to Claude GitHub Actions |
/install-slack-app |
Install the Claude Slack App |
6.5 Workflow and Automation
| Command | Description |
|---|---|
/tasks |
View and manage background tasks |
/loop |
Repeatedly execute a prompt or slash command at a fixed interval |
/batch |
Handle large‑scale changes by first planning, then executing |
/review |
Review a Pull Request |
/pr-comments |
Read GitHub Pull Request comments |
/security-review |
Perform a security check on pending changes |
/simplify |
Analyse code for simplification, reuse, or quality improvements |
/debug |
Enable session‑specific debug logging |
/feedback |
Submit feedback about Claude Code |
/stickers |
Order Claude Code stickers (yes, really) |
/insights |
Generate an analysis report of your Claude Code sessions |
/release-notes |
View the release notes |
6.6 Dynamic Skill Commands
These commands are not present on every machine. They appear only when you have installed specific skills, plugins, or extensions. For example, you might see:
-
/x-post-reply-skill– A skill for generating X (Twitter) content. -
/claude-api– Guidance on using the Claude API or Anthropic SDK.
Remember:
-
Built‑in slash commands are stable and provided by Claude Code itself. -
Dynamic skill commands are extra capabilities loaded from your environment.
7. Most Useful High‑Frequency Commands
If you want to avoid memorising the whole list, focus on these core commands first.
Terminal High‑Frequency Commands
| Command | Purpose |
|---|---|
claude |
Start an interactive session |
claude -p "task" |
Run a one‑off task and exit |
claude -c |
Resume the most recent session |
claude --help |
Get overall help |
claude mcp list |
List current MCP connections |
claude plugins list --json |
View plugin list in JSON format |
Slash High‑Frequency Commands
| Command | Purpose |
|---|---|
/help |
Show help and available commands |
/clear |
Clear conversation history |
/compact |
Compress context while preserving summary |
/status |
Check current status |
/model |
Switch models |
/permissions |
Manage tool permission rules |
/config |
Open configuration panel |
/mcp |
Manage MCP servers |
/plugin |
Manage plugins |
/review |
Review a Pull Request |
8. Five Pairs That Beginners Often Confuse
Pair 1: claude vs claude -p
-
claude: Interactive session – you talk back and forth. -
claude -p: One‑shot execution – prints the result and exits immediately.
Pair 2: /clear vs /compact
-
/clear: Completely erases the conversation context – Claude forgets everything. -
/compact: Shrinks the context but keeps a summary – Claude still remembers the essence.
Pair 3: /resume vs /rewind
-
/resume: Retrieves and restores a past conversation. -
/rewind: Steps the current conversation backward to an earlier point.
Pair 4: MCP vs Plugins
-
MCP: Connects to external tools and services (like databases, APIs). -
Plugins: Extend Claude Code’s own functionality (add new slash commands, etc.).
Pair 5: Terminal Subcommands vs Slash Commands
-
Terminal subcommands: Run from your shell, e.g., claude auth login. -
Slash commands: Run inside an interactive session, e.g., /model.
9. A Suggested Learning Path
If you are learning Claude Code from scratch, follow this sequence. It builds understanding step by step and avoids confusion.
-
Start with the basics
-
Master claude,claude -p, andclaude -c. -
Learn /helpto get help inside a session. -
Understand the difference between /clearand/compact.
-
-
Daily usage
-
Get comfortable with /modelto switch models as needed. -
Use /statusto check what is going on. -
Experiment with /permissionsto control tool approvals.
-
-
Expand your capabilities
-
Explore authcommands to manage accounts. -
Add your first MCP with claude mcp add. -
Install a plugin using claude plugins install.
-
-
Embrace engineering workflows
-
Try /reviewon a real Pull Request. -
Use /batchfor large‑scale file modifications. -
Run /security-reviewbefore committing sensitive changes.
-
This path ensures you never feel overwhelmed and always have a clear next step.
10. Conclusion: Your Command Map
Claude Code’s command system is not chaotic – it is simply divided into three clean layers:
-
Main command ( claude) – the entry point. -
Subcommands ( claude auth,claude mcp, …) – manage features. -
Slash commands ( /help,/clear, …) – control sessions.
You do not need to memorise every command. Build the map in your head first, then learn the commands that match your daily tasks. The rest will come naturally as you need them.
If you want to start using Claude Code right now, these ten commands will get you going:
# Terminal
claude # Start interactive session
claude -p "your task" # One‑shot execution
claude -c # Resume last session
# Inside a session (after typing claude)
/help # Get help
/clear # Clear history
/compact # Compact context
/model # Switch model
/mcp # Manage MCP
/plugin # Manage plugins
/review # Review a PR
Frequently Asked Questions
Q: Which operating systems does Claude Code support?
A: Claude Code runs on macOS, Linux, and Windows (via WSL). Check the official documentation for the most up‑to‑date list.
Q: How can I see which version of Claude Code I am using?
A: Type claude --version in your terminal, or use /status inside an interactive session.
Q: Where are my Claude Code sessions stored?
A: Sessions are saved locally. The exact location depends on your operating system. Use --no-session-persistence if you do not want to save a session.
Q: What is the difference between MCP and plugins?
A: MCP connects Claude Code to external services (like a database). Plugins add new features to Claude Code itself (like custom slash commands). They serve different purposes.
Q: Should I use /clear or /compact?
A: Use /clear to start a completely fresh topic. Use /compact when you want to free up context space but still want Claude to remember the key points of the conversation.
Q: How do I let Claude Code access files outside my current project?
A: Use the --add-dir parameter when starting Claude, or the /add-dir command inside a session.
Q: What does /permissions do?
A: It lets you set rules for when the AI needs your approval before using tools. You can configure permissions per tool or globally.
Q: Why does my list of slash commands differ from what I see in tutorials?
A: Different plugins, skills, and account permissions can add or remove slash commands. This is normal.
Q: Can Claude Code help me review code?
A: Yes. Use /review for Pull Request reviews and /security-review for security‑focused checks.
Q: How do I handle large, repetitive tasks?
A: The /batch command is designed for exactly that – it plans first, then executes changes systematically.
This guide is based on Claude Code version 2.1.74. Command availability may vary with updates. When in doubt, use /help inside a session to see exactly what is available in your environment.
