major refactor
This commit is contained in:
+119
-190
@@ -1,6 +1,9 @@
|
||||
# Claude Code Commands Reference
|
||||
# Commands Best Practice
|
||||
|
||||
A comprehensive reference of all available slash commands in Claude Code's interactive mode.
|
||||
<br>
|
||||
[](../.claude/commands/)
|
||||
|
||||
Complete reference for Claude Code commands — command definitions, frontmatter fields, and all built-in slash commands.
|
||||
|
||||
<table width="100%">
|
||||
<tr>
|
||||
@@ -9,236 +12,162 @@ A comprehensive reference of all available slash commands in Claude Code's inter
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
## Table of Contents
|
||||
---
|
||||
|
||||
1. [Session Management](#session-management)
|
||||
2. [Context & Cost](#context--cost)
|
||||
3. [Model & Planning](#model--planning)
|
||||
4. [Project & Memory](#project--memory)
|
||||
5. [Configuration](#configuration)
|
||||
6. [Extensions & Integrations](#extensions--integrations)
|
||||
7. [Diagnostics & Debugging](#diagnostics--debugging)
|
||||
8. [Import / Export](#import--export)
|
||||
9. [Authentication](#authentication)
|
||||
10. [Input Modes & Prefixes](#input-modes--prefixes)
|
||||
11. [Dynamic Commands](#dynamic-commands)
|
||||
12. [CLI Flags](#cli-flags)
|
||||
13. [Keyboard Shortcuts](#keyboard-shortcuts)
|
||||
## Frontmatter Fields
|
||||
|
||||
Custom commands are defined in `.claude/commands/<name>.md` with optional YAML frontmatter.
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
|-------|------|----------|-------------|
|
||||
| `description` | string | Recommended | What the command does. Shown in autocomplete and used by Claude for auto-discovery |
|
||||
| `argument-hint` | string | No | Hint shown during autocomplete (e.g., `[issue-number]`, `[filename]`) |
|
||||
| `allowed-tools` | string | No | Tools allowed without permission prompts when this command is active |
|
||||
| `model` | string | No | Model to use when this command runs (e.g., `haiku`, `sonnet`, `opus`) |
|
||||
|
||||
---
|
||||
|
||||
## Session Management
|
||||
## String Substitutions
|
||||
|
||||
| Command | Description |
|
||||
|---------|-------------|
|
||||
| `/clear` | Clear conversation history and start fresh |
|
||||
| `/compact [instructions]` | Compress conversation to free context window. Optional instructions focus the compaction on specific topics |
|
||||
| `/rename <name>` | Rename the current session for easier identification |
|
||||
| `/resume [session]` | Resume a previous conversation by ID or name, or open the session picker |
|
||||
| `/rewind` | Rewind the conversation and/or code to an earlier point, or summarize from a selected message |
|
||||
| `/fork` | Fork the current conversation into a new session |
|
||||
| `/teleport` | Resume a remote session from claude.ai (subscribers only) |
|
||||
| `/exit` | Exit the REPL |
|
||||
Available inside command markdown for dynamic values:
|
||||
|
||||
| Variable | Description |
|
||||
|----------|-------------|
|
||||
| `$ARGUMENTS` | All arguments passed when invoking the command |
|
||||
| `$ARGUMENTS[N]` | Access a specific argument by 0-based index |
|
||||
| `$N` | Shorthand for `$ARGUMENTS[N]` (e.g., `$0`, `$1`) |
|
||||
| `${CLAUDE_SESSION_ID}` | Current session identifier |
|
||||
| `` !`command` `` | Dynamic context injection — shell command output replaces the placeholder before Claude sees it |
|
||||
|
||||
---
|
||||
|
||||
## Context & Cost
|
||||
## Invocation
|
||||
|
||||
| Command | Description |
|
||||
|---------|-------------|
|
||||
| `/context` | Visualize current context usage as a colored grid with token counts and percentages |
|
||||
| `/cost` | Show token usage statistics and spending for the current session |
|
||||
| `/usage` | Show plan usage limits and rate limit status (subscription plans only) |
|
||||
| `/stats` | Visualize daily usage, session history, streaks, and model preferences. Supports date range filtering |
|
||||
Custom commands are invoked by typing `/command-name` in Claude Code's interactive mode:
|
||||
|
||||
---
|
||||
|
||||
## Model & Planning
|
||||
|
||||
| Command | Description |
|
||||
|---------|-------------|
|
||||
| `/model` | Switch models (haiku, sonnet, opus) and adjust Opus 4.6 effort level with arrow keys |
|
||||
| `/plan` | Enter read-only planning mode where Claude suggests approaches without making changes |
|
||||
| `/fast` | Toggle fast mode — same Opus 4.6 model with faster output |
|
||||
|
||||
---
|
||||
|
||||
## Project & Memory
|
||||
|
||||
| Command | Description |
|
||||
|---------|-------------|
|
||||
| `/init` | Initialize a new project with CLAUDE.md guide |
|
||||
| `/memory` | View and edit CLAUDE.md memory files (user, project, and local scope) |
|
||||
|
||||
---
|
||||
|
||||
## Configuration
|
||||
|
||||
| Command | Description |
|
||||
|---------|-------------|
|
||||
| `/config` | Open the interactive Settings interface with search functionality |
|
||||
| `/permissions` | View or update tool permissions |
|
||||
| `/theme` | Change the color theme |
|
||||
| `/vim` | Enable vim-style editing mode |
|
||||
| `/terminal-setup` | Enable shift+enter for newlines in IDE terminals, Apple Terminal, Warp, and Alacritty |
|
||||
| `/keybindings` | Customize keyboard shortcuts per context, create chord sequences |
|
||||
| `/statusline` | Set up Claude Code's status line UI |
|
||||
| `/sandbox` | Configure sandboxing with dependency status |
|
||||
|
||||
---
|
||||
|
||||
## Extensions & Integrations
|
||||
|
||||
| Command | Description |
|
||||
|---------|-------------|
|
||||
| `/agents` | Manage custom subagents — view, create, edit, delete |
|
||||
| `/skills` | View available skills and their descriptions |
|
||||
| `/hooks` | Interactive interface to manage hooks |
|
||||
| `/mcp` | Manage MCP server connections — add, enable, list, get info, OAuth authentication |
|
||||
| `/plugin` | Manage plugins — install, uninstall, enable, disable, browse marketplaces |
|
||||
| `/ide` | Connect to IDE integration |
|
||||
|
||||
---
|
||||
|
||||
## Diagnostics & Debugging
|
||||
|
||||
| Command | Description |
|
||||
|---------|-------------|
|
||||
| `/doctor` | Check the health of your Claude Code installation. Detects unreachable permissions, config issues, and updates |
|
||||
| `/debug [description]` | Troubleshoot the current session by reading the session debug log |
|
||||
| `/tasks` | List and manage background tasks |
|
||||
| `/todos` | List current TODO items |
|
||||
| `/help` | Show all available slash commands and usage help |
|
||||
| `/feedback` | Generate a GitHub issue URL for reporting bugs or feedback |
|
||||
|
||||
---
|
||||
|
||||
## Import / Export
|
||||
|
||||
| Command | Description |
|
||||
|---------|-------------|
|
||||
| `/copy` | Copy the last assistant response to clipboard |
|
||||
| `/export [filename]` | Export the current conversation to a file or clipboard |
|
||||
|
||||
---
|
||||
|
||||
## Authentication
|
||||
|
||||
| Command | Description |
|
||||
|---------|-------------|
|
||||
| `/login` | Authenticate with Claude Code via OAuth |
|
||||
| `/logout` | Log out from Claude Code |
|
||||
|
||||
---
|
||||
|
||||
## Input Modes & Prefixes
|
||||
|
||||
These are special prefixes you can type at the prompt, not slash commands per se:
|
||||
|
||||
| Prefix | Description |
|
||||
| Method | Description |
|
||||
|--------|-------------|
|
||||
| `/` | Trigger command or skill autocomplete |
|
||||
| `!` | Bash mode — run shell commands directly and add output to conversation |
|
||||
| `@` | File path mention — trigger file path autocomplete for context |
|
||||
| `/command-name` | Invoke directly from the command menu |
|
||||
| `/command-name [args]` | Pass arguments that map to `$ARGUMENTS` |
|
||||
| Autocomplete | Type `/` to see all available commands with descriptions |
|
||||
| Subdirectories | Commands in subdirectories use `/subdir:command-name` |
|
||||
|
||||
---
|
||||
|
||||
## Dynamic Commands
|
||||
## Example: Minimal Command
|
||||
|
||||
These commands are not built-in but are discovered at runtime from your configuration:
|
||||
```yaml
|
||||
---
|
||||
description: Fetch and transform weather data for Karachi
|
||||
model: haiku
|
||||
---
|
||||
|
||||
### MCP Prompts
|
||||
|
||||
MCP servers can expose prompts that appear as commands:
|
||||
|
||||
```
|
||||
/mcp__<server-name>__<prompt-name>
|
||||
Fetch the current temperature for Karachi, Pakistan and apply transformations.
|
||||
```
|
||||
|
||||
### Plugin Commands
|
||||
## Example: Full-Featured Command (All Fields)
|
||||
|
||||
Installed plugins can provide their own commands, namespaced by plugin name:
|
||||
```yaml
|
||||
---
|
||||
description: Fix a GitHub issue by number, following team coding standards
|
||||
argument-hint: [issue-number]
|
||||
allowed-tools: Read, Edit, Write, Bash(gh *), Bash(npm test *)
|
||||
model: sonnet
|
||||
---
|
||||
|
||||
```
|
||||
/plugin-name:command-name
|
||||
```
|
||||
Fix GitHub issue $0 following our coding standards.
|
||||
|
||||
### Custom Skills
|
||||
## Context
|
||||
- PR diff: !`gh pr diff`
|
||||
- Issue details: !`gh issue view $0`
|
||||
|
||||
Skills defined in `.claude/skills/` appear as invocable commands:
|
||||
## Steps
|
||||
1. Read the issue description
|
||||
2. Understand the requirements
|
||||
3. Implement the fix
|
||||
4. Write tests
|
||||
5. Create a commit
|
||||
|
||||
```
|
||||
/skill-name
|
||||
Session: ${CLAUDE_SESSION_ID}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## CLI Flags
|
||||
## Scope and Priority
|
||||
|
||||
These flags are used when launching Claude Code from the terminal, not as interactive commands:
|
||||
When multiple commands share the same name, the higher-priority location wins:
|
||||
|
||||
| Flag | Description |
|
||||
|------|-------------|
|
||||
| `--doctor` | Run diagnostics from the command line |
|
||||
| `--debug` | Launch in debug mode with hook execution details |
|
||||
| `--resume` | Resume most recent session |
|
||||
| `--plan` | Start in plan mode |
|
||||
| `--init` | Initialize repository with CLAUDE.md setup |
|
||||
| `--init-only` | Run repository initialization only, then exit |
|
||||
| `--maintenance` | Run repository maintenance operations |
|
||||
| `--from-pr <url>` | Resume a session linked to a specific GitHub PR |
|
||||
| Location | Scope | Priority |
|
||||
|----------|-------|----------|
|
||||
| Project (`.claude/commands/`) | This project only | 1 (highest) |
|
||||
| Personal (`~/.claude/commands/`) | All your projects | 2 |
|
||||
| Plugin (`<plugin>/commands/`) | Where plugin is enabled | 3 (lowest) |
|
||||
|
||||
---
|
||||
|
||||
## Keyboard Shortcuts
|
||||
## Claude Commands
|
||||
|
||||
### Navigation & Control
|
||||
### All Commands
|
||||
|
||||
| Shortcut | Description |
|
||||
|----------|-------------|
|
||||
| `Ctrl+C` | Cancel current input or generation |
|
||||
| `Ctrl+D` | Exit Claude Code session |
|
||||
| `Ctrl+L` | Clear terminal screen |
|
||||
| `Ctrl+R` | Reverse search command history |
|
||||
| `Ctrl+O` | Toggle verbose output |
|
||||
| `Esc` + `Esc` | Rewind or summarize |
|
||||
Built-in slash commands available in Claude Code's interactive mode:
|
||||
|
||||
### Model & Mode Switching
|
||||
| Command | Tag | Description |
|
||||
|---------|-----|-------------|
|
||||
| `/clear` |  | Clear conversation history and start fresh |
|
||||
| `/compact [instructions]` |  | Compress conversation to free context window. Optional instructions focus the compaction |
|
||||
| `/exit` |  | Exit the REPL |
|
||||
| `/fork` |  | Fork the current conversation into a new session |
|
||||
| `/rename <name>` |  | Rename the current session for easier identification |
|
||||
| `/resume [session]` |  | Resume a previous conversation by ID or name, or open the session picker |
|
||||
| `/rewind` |  | Rewind conversation and/or code to an earlier point |
|
||||
| `/teleport` |  | Resume a remote session from claude.ai (subscribers only) |
|
||||
| `/context` |  | Visualize current context usage as a colored grid with token counts |
|
||||
| `/cost` |  | Show token usage statistics and spending for the current session |
|
||||
| `/stats` |  | Visualize daily usage, session history, streaks, and model preferences |
|
||||
| `/usage` |  | Show plan usage limits and rate limit status (subscription plans only) |
|
||||
| `/fast` |  | Toggle fast mode — same Opus 4.6 model with faster output |
|
||||
| `/model` |  | Switch models (haiku, sonnet, opus) and adjust effort level |
|
||||
| `/plan` |  | Enter read-only planning mode — suggests approaches without making changes |
|
||||
| `/init` |  | Initialize a new project with CLAUDE.md guide |
|
||||
| `/memory` |  | View and edit CLAUDE.md memory files (user, project, and local scope) |
|
||||
| `/config` |  | Open the interactive Settings interface with search functionality |
|
||||
| `/keybindings` |  | Customize keyboard shortcuts per context, create chord sequences |
|
||||
| `/permissions` |  | View or update tool permissions |
|
||||
| `/sandbox` |  | Configure sandboxing with dependency status |
|
||||
| `/statusline` |  | Set up Claude Code's status line UI |
|
||||
| `/terminal-setup` |  | Enable shift+enter for newlines in IDE terminals |
|
||||
| `/theme` |  | Change the color theme |
|
||||
| `/vim` |  | Enable vim-style editing mode |
|
||||
| `/agents` |  | Manage custom subagents — view, create, edit, delete |
|
||||
| `/hooks` |  | Interactive interface to manage hooks |
|
||||
| `/ide` |  | Connect to IDE integration |
|
||||
| `/mcp` |  | Manage MCP server connections — add, enable, list, get info, OAuth |
|
||||
| `/plugin` |  | Manage plugins — install, uninstall, enable, disable, browse marketplaces |
|
||||
| `/skills` |  | View available skills and their descriptions |
|
||||
| `/debug [description]` |  | Troubleshoot the current session by reading the debug log |
|
||||
| `/doctor` |  | Check the health of your Claude Code installation |
|
||||
| `/feedback` |  | Generate a GitHub issue URL for reporting bugs or feedback |
|
||||
| `/help` |  | Show all available slash commands and usage help |
|
||||
| `/tasks` |  | List and manage background tasks |
|
||||
| `/todos` |  | List current TODO items |
|
||||
| `/copy` |  | Copy the last assistant response to clipboard |
|
||||
| `/export [filename]` |  | Export the current conversation to a file or clipboard |
|
||||
| `/login` |  | Authenticate with Claude Code via OAuth |
|
||||
| `/logout` |  | Log out from Claude Code |
|
||||
|
||||
| Shortcut | Description |
|
||||
|----------|-------------|
|
||||
| `Option+P` / `Alt+P` | Switch model |
|
||||
| `Option+T` / `Alt+T` | Toggle extended thinking |
|
||||
| `Shift+Tab` / `Alt+M` | Toggle permission modes |
|
||||
| `Ctrl+B` | Background running tasks |
|
||||
| `Ctrl+T` | Toggle task list |
|
||||
### Commands in This Repository
|
||||
|
||||
### Text Editing
|
||||
Custom commands defined in `.claude/commands/` for this project:
|
||||
|
||||
| Shortcut | Description |
|
||||
|----------|-------------|
|
||||
| `Ctrl+G` | Open prompt in default text editor |
|
||||
| `Ctrl+V` / `Cmd+V` | Paste image from clipboard |
|
||||
| `Ctrl+K` | Delete to end of line |
|
||||
| `Ctrl+U` | Delete entire line |
|
||||
| `Ctrl+Y` | Paste deleted text |
|
||||
| `Alt+Y` | Cycle paste history |
|
||||
|
||||
### Multiline Input
|
||||
|
||||
| Shortcut | Description |
|
||||
|----------|-------------|
|
||||
| `\` + `Enter` | Quick escape for multiline |
|
||||
| `Option+Enter` | macOS default multiline |
|
||||
| `Shift+Enter` | Multiline (iTerm2, WezTerm, Ghostty, Kitty) |
|
||||
| `Ctrl+J` | Line feed character for multiline |
|
||||
| Command | Description | Model |
|
||||
|---------|-------------|-------|
|
||||
| [`weather-orchestrator`](../.claude/commands/weather-orchestrator.md) | Fetch and transform weather data for Karachi | haiku |
|
||||
| [`workflows/best-practice/workflow-claude-subagents`](../.claude/commands/workflows/best-practice/workflow-claude-subagents.md) | Track Claude Code subagents report changes and find what needs updating | — |
|
||||
|
||||
---
|
||||
|
||||
## Sources
|
||||
|
||||
- [Claude Code Interactive Mode](https://code.claude.com/docs/en/interactive-mode)
|
||||
- [Claude Code CLI Reference](https://code.claude.com/docs/en/cli-reference)
|
||||
- [Claude Code Slash Commands](https://code.claude.com/docs/en/slash-commands)
|
||||
- [Claude Code Interactive Mode](https://code.claude.com/docs/en/interactive-mode)
|
||||
- [Claude Code CHANGELOG](https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md)
|
||||
- [Claude Code Common Workflows](https://code.claude.com/docs/en/common-workflows)
|
||||
|
||||
Reference in New Issue
Block a user