Initial commit to new repository
This commit is contained in:
517
docs/claude-code-docs-main/en/reference/commands/cli-flags.md
Normal file
517
docs/claude-code-docs-main/en/reference/commands/cli-flags.md
Normal file
@@ -0,0 +1,517 @@
|
||||
> ## Documentation Index
|
||||
> Fetch the complete documentation index at: https://vineetagarwal-code-claude-code.mintlify.app/llms.txt
|
||||
> Use this file to discover all available pages before exploring further.
|
||||
|
||||
# CLI flags
|
||||
|
||||
> All options you can pass when launching Claude Code from the terminal. Run claude --help to see the full list.
|
||||
|
||||
Pass CLI flags when you launch Claude Code:
|
||||
|
||||
```bash theme={null}
|
||||
claude [flags] [prompt]
|
||||
```
|
||||
|
||||
Run `claude --help` to see all available flags in your installed version.
|
||||
|
||||
<Tip>
|
||||
Flags that configure session behavior (like `--model` and `--permission-mode`) can also be changed mid-session with the corresponding slash commands: `/model` and `/permissions`.
|
||||
</Tip>
|
||||
|
||||
***
|
||||
|
||||
## Core flags
|
||||
|
||||
<AccordionGroup>
|
||||
<Accordion title="-p, --print">
|
||||
Run Claude non-interactively. Claude processes the prompt (from the argument or stdin), prints the response, and exits. No REPL is started.
|
||||
|
||||
```bash theme={null}
|
||||
claude -p "explain the main function in src/index.ts"
|
||||
echo "what does this do?" | claude -p
|
||||
```
|
||||
|
||||
<Warning>
|
||||
The workspace trust dialog is skipped in `--print` mode. Only use this flag in directories you trust.
|
||||
</Warning>
|
||||
|
||||
Works with: `--output-format`, `--model`, `--system-prompt`, `--permission-mode`, `--max-turns`, `--allowed-tools`.
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="--output-format <format>">
|
||||
Set the output format. Only works with `--print`.
|
||||
|
||||
| Value | Description |
|
||||
| ------------- | --------------------------------------------------- |
|
||||
| `text` | Plain text output (default) |
|
||||
| `json` | Single JSON object with the complete result |
|
||||
| `stream-json` | Newline-delimited JSON stream with real-time events |
|
||||
|
||||
```bash theme={null}
|
||||
claude -p "list the exported functions" --output-format json
|
||||
claude -p "refactor this file" --output-format stream-json
|
||||
```
|
||||
|
||||
Use `stream-json` when you want to process Claude's output incrementally as it arrives (useful for long-running tasks or piping into other tools).
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="--input-format <format>">
|
||||
Set the input format for stdin. Only works with `--print`.
|
||||
|
||||
| Value | Description |
|
||||
| ------------- | ----------------------------------- |
|
||||
| `text` | Plain text input (default) |
|
||||
| `stream-json` | Newline-delimited JSON stream input |
|
||||
|
||||
`stream-json` input requires `--output-format stream-json`.
|
||||
|
||||
```bash theme={null}
|
||||
cat messages.jsonl | claude -p --input-format stream-json --output-format stream-json
|
||||
```
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="--verbose">
|
||||
Enable verbose output. Overrides the `verbose` setting in your config file.
|
||||
|
||||
```bash theme={null}
|
||||
claude --verbose
|
||||
claude -p "debug this" --verbose
|
||||
```
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="-v, --version">
|
||||
Print the version number and exit.
|
||||
|
||||
```bash theme={null}
|
||||
claude --version
|
||||
claude -v
|
||||
```
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="-h, --help">
|
||||
Display help for the command and exit.
|
||||
|
||||
```bash theme={null}
|
||||
claude --help
|
||||
claude mcp --help
|
||||
```
|
||||
</Accordion>
|
||||
</AccordionGroup>
|
||||
|
||||
***
|
||||
|
||||
## Session continuation flags
|
||||
|
||||
<AccordionGroup>
|
||||
<Accordion title="-c, --continue">
|
||||
Resume the most recent conversation in the current directory without prompting for a session to resume.
|
||||
|
||||
```bash theme={null}
|
||||
claude --continue
|
||||
claude -c "now add tests for that"
|
||||
```
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="-r, --resume [session-id]">
|
||||
Resume a conversation by session ID. Without a value, opens an interactive picker where you can search through past sessions. Accepts an optional search term to filter the list.
|
||||
|
||||
```bash theme={null}
|
||||
# Open interactive picker
|
||||
claude --resume
|
||||
|
||||
# Resume by session ID
|
||||
claude --resume 550e8400-e29b-41d4-a716-446655440000
|
||||
|
||||
# Open picker filtered by search term
|
||||
claude --resume "auth refactor"
|
||||
```
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="--fork-session">
|
||||
When used with `--continue` or `--resume`, creates a new session branched from the resumed conversation rather than continuing it in place.
|
||||
|
||||
```bash theme={null}
|
||||
claude --resume <session-id> --fork-session
|
||||
```
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="-n, --name <name>">
|
||||
Set a display name for the session. The name appears in `/resume` and in the terminal title.
|
||||
|
||||
```bash theme={null}
|
||||
claude --name "auth-refactor"
|
||||
```
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="--session-id <uuid>">
|
||||
Use a specific UUID as the session ID instead of a generated one. Must be a valid UUID. Cannot be used with `--continue` or `--resume` unless `--fork-session` is also specified.
|
||||
|
||||
```bash theme={null}
|
||||
claude --session-id 550e8400-e29b-41d4-a716-446655440000
|
||||
```
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="--no-session-persistence">
|
||||
Disable session persistence. The session will not be saved to disk and cannot be resumed. Only works with `--print`.
|
||||
|
||||
```bash theme={null}
|
||||
claude -p "one-off task" --no-session-persistence
|
||||
```
|
||||
</Accordion>
|
||||
</AccordionGroup>
|
||||
|
||||
***
|
||||
|
||||
## Model and capability flags
|
||||
|
||||
<AccordionGroup>
|
||||
<Accordion title="--model <model>">
|
||||
Set the model for the session. Accepts an alias (e.g. `sonnet`, `opus`, `haiku`) or a full model ID (e.g. `claude-sonnet-4-6`).
|
||||
|
||||
```bash theme={null}
|
||||
claude --model sonnet
|
||||
claude --model opus
|
||||
claude --model claude-sonnet-4-6
|
||||
```
|
||||
|
||||
You can also change the model mid-session with `/model`.
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="--effort <level>">
|
||||
Set the effort level for the session. Controls how much computation Claude applies to each response.
|
||||
|
||||
| Value | Description |
|
||||
| -------- | ------------------------- |
|
||||
| `low` | Faster, lighter responses |
|
||||
| `medium` | Balanced (default) |
|
||||
| `high` | More thorough reasoning |
|
||||
| `max` | Maximum effort |
|
||||
|
||||
```bash theme={null}
|
||||
claude --effort high "review this architecture"
|
||||
```
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="--fallback-model <model>">
|
||||
Enable automatic fallback to a different model when the primary model is overloaded. Only works with `--print`.
|
||||
|
||||
```bash theme={null}
|
||||
claude -p "analyze this" --model opus --fallback-model sonnet
|
||||
```
|
||||
</Accordion>
|
||||
</AccordionGroup>
|
||||
|
||||
***
|
||||
|
||||
## Permission and safety flags
|
||||
|
||||
<AccordionGroup>
|
||||
<Accordion title="--permission-mode <mode>">
|
||||
Set the permission mode for the session.
|
||||
|
||||
| Mode | Behavior |
|
||||
| ------------------- | ------------------------------------------------------------------------------------ |
|
||||
| `default` | Claude prompts before running commands and making edits |
|
||||
| `acceptEdits` | File edits are applied automatically; shell commands still require approval |
|
||||
| `plan` | Claude proposes a plan and waits for your approval before acting |
|
||||
| `bypassPermissions` | All actions run without prompts — intended for sandboxed automated environments only |
|
||||
|
||||
```bash theme={null}
|
||||
claude --permission-mode acceptEdits
|
||||
claude --permission-mode plan "refactor the payment module"
|
||||
claude --permission-mode bypassPermissions # only in isolated sandboxes
|
||||
```
|
||||
|
||||
<Warning>
|
||||
`bypassPermissions` disables all confirmation prompts. Only use it inside Docker containers, CI sandboxes, or other isolated environments with no internet access.
|
||||
</Warning>
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="--dangerously-skip-permissions">
|
||||
Bypass all permission checks. Claude takes all actions (file edits, shell commands) without asking. Equivalent to `--permission-mode bypassPermissions`.
|
||||
|
||||
```bash theme={null}
|
||||
claude --dangerously-skip-permissions -p "run the full test suite and fix failures"
|
||||
```
|
||||
|
||||
<Warning>
|
||||
Only use this in sandboxed environments with no internet access. Claude Code enforces this: the flag is rejected when running with root/sudo privileges, or outside a Docker or bubblewrap container.
|
||||
</Warning>
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="--allow-dangerously-skip-permissions">
|
||||
Make bypassing all permission checks available as an option during the session, without enabling it by default. Useful for automated pipelines that may need to escalate mid-session.
|
||||
|
||||
```bash theme={null}
|
||||
claude --allow-dangerously-skip-permissions -p "..."
|
||||
```
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="--allowed-tools <tools...>">
|
||||
**Aliases:** `--allowedTools`
|
||||
|
||||
Comma- or space-separated list of tools Claude is allowed to use. Tools not in this list are blocked.
|
||||
|
||||
```bash theme={null}
|
||||
claude --allowed-tools "Bash(git:*) Edit Read"
|
||||
claude --allowed-tools Bash,Edit,Read
|
||||
```
|
||||
|
||||
Tool patterns support glob-style matching: `Bash(git:*)` permits any git command; `Edit(src/**)` permits edits under `src/`.
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="--disallowed-tools <tools...>">
|
||||
**Aliases:** `--disallowedTools`
|
||||
|
||||
Comma- or space-separated list of tools Claude is not allowed to use.
|
||||
|
||||
```bash theme={null}
|
||||
claude --disallowed-tools "Bash(rm:*)"
|
||||
```
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="--tools <tools...>">
|
||||
Specify the exact set of built-in tools available for the session. Use `""` to disable all tools, `default` to enable all tools, or name specific tools.
|
||||
|
||||
```bash theme={null}
|
||||
# Disable all tools
|
||||
claude --tools ""
|
||||
|
||||
# Enable only Bash and Read
|
||||
claude --tools "Bash Read"
|
||||
|
||||
# Enable the default set
|
||||
claude --tools default
|
||||
```
|
||||
</Accordion>
|
||||
</AccordionGroup>
|
||||
|
||||
***
|
||||
|
||||
## Context and prompt flags
|
||||
|
||||
<AccordionGroup>
|
||||
<Accordion title="--add-dir <directories...>">
|
||||
Add one or more directories to the tool access context. Claude will be able to read and edit files in these directories in addition to the current working directory.
|
||||
|
||||
```bash theme={null}
|
||||
claude --add-dir /shared/libs --add-dir /shared/config
|
||||
```
|
||||
|
||||
Useful for monorepos or projects where related code lives outside the current directory.
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="--system-prompt <prompt>">
|
||||
Override the default system prompt with a custom prompt. Cannot be used with `--system-prompt-file`.
|
||||
|
||||
```bash theme={null}
|
||||
claude --system-prompt "You are a security auditor. Focus only on vulnerabilities."
|
||||
```
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="--append-system-prompt <text>">
|
||||
Append text to the default system prompt. Unlike `--system-prompt`, this preserves Claude's built-in instructions and adds to them.
|
||||
|
||||
```bash theme={null}
|
||||
claude --append-system-prompt "Always suggest test cases for every function you write."
|
||||
```
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="--mcp-config <configs...>">
|
||||
Load MCP servers from one or more JSON config files or inline JSON strings. Multiple values are space-separated.
|
||||
|
||||
```bash theme={null}
|
||||
# Load from a file
|
||||
claude --mcp-config ./mcp-servers.json
|
||||
|
||||
# Load from multiple files
|
||||
claude --mcp-config ./local-tools.json ./db-tools.json
|
||||
|
||||
# Pass inline JSON
|
||||
claude --mcp-config '{"mcpServers":{"filesystem":{"command":"npx","args":["@modelcontextprotocol/server-filesystem","/tmp"]}}}'
|
||||
```
|
||||
|
||||
See the [MCP servers guide](/guides/mcp-servers) for the config file format.
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="--strict-mcp-config">
|
||||
Only use MCP servers from `--mcp-config`, ignoring all other MCP configurations (user config, project config, etc.).
|
||||
|
||||
```bash theme={null}
|
||||
claude --mcp-config ./ci-tools.json --strict-mcp-config
|
||||
```
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="--settings <file-or-json>">
|
||||
Load additional settings from a JSON file path or an inline JSON string.
|
||||
|
||||
```bash theme={null}
|
||||
# From a file
|
||||
claude --settings ./team-settings.json
|
||||
|
||||
# Inline JSON
|
||||
claude --settings '{"model":"claude-sonnet-4-6","verbose":true}'
|
||||
```
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="--setting-sources <sources>">
|
||||
Comma-separated list of settings sources to load. Controls which settings files are read at startup.
|
||||
|
||||
| Value | Description |
|
||||
| --------- | ----------------------------------------------------------- |
|
||||
| `user` | Load `~/.claude/settings.json` |
|
||||
| `project` | Load `.claude/settings.json` in the current directory |
|
||||
| `local` | Load `.claude/settings.local.json` in the current directory |
|
||||
|
||||
```bash theme={null}
|
||||
# Load only user-level settings (ignore project settings)
|
||||
claude --setting-sources user
|
||||
|
||||
# Load user and project settings
|
||||
claude --setting-sources user,project
|
||||
```
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="--agents <json>">
|
||||
Define custom agents inline as a JSON object. Each key is the agent name; the value is an object with `description` and `prompt`.
|
||||
|
||||
```bash theme={null}
|
||||
claude --agents '{"reviewer":{"description":"Reviews code for security issues","prompt":"You are a security-focused code reviewer."}}'
|
||||
```
|
||||
</Accordion>
|
||||
</AccordionGroup>
|
||||
|
||||
***
|
||||
|
||||
## Output control flags
|
||||
|
||||
<AccordionGroup>
|
||||
<Accordion title="--include-hook-events">
|
||||
Include all hook lifecycle events in the output stream. Only works with `--output-format stream-json`.
|
||||
|
||||
```bash theme={null}
|
||||
claude -p "run task" --output-format stream-json --include-hook-events
|
||||
```
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="--max-turns <n>">
|
||||
Limit the number of agentic turns in non-interactive mode. Claude stops after this many turns even if the task is incomplete. Only works with `--print`.
|
||||
|
||||
```bash theme={null}
|
||||
claude -p "refactor this module" --max-turns 10
|
||||
```
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="--max-budget-usd <amount>">
|
||||
Set a maximum dollar amount to spend on API calls. Claude stops when the budget is reached. Only works with `--print`.
|
||||
|
||||
```bash theme={null}
|
||||
claude -p "large analysis task" --max-budget-usd 2.50
|
||||
```
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="--json-schema <schema>">
|
||||
Provide a JSON Schema for structured output validation. Claude's response will be validated against this schema.
|
||||
|
||||
```bash theme={null}
|
||||
claude -p "extract the function names" \
|
||||
--output-format json \
|
||||
--json-schema '{"type":"object","properties":{"functions":{"type":"array","items":{"type":"string"}}},"required":["functions"]}'
|
||||
```
|
||||
</Accordion>
|
||||
</AccordionGroup>
|
||||
|
||||
***
|
||||
|
||||
## Worktree flags
|
||||
|
||||
<AccordionGroup>
|
||||
<Accordion title="-w, --worktree [name]">
|
||||
Create a new git worktree for this session. Optionally specify a name for the worktree branch. Accepts a PR number or GitHub PR URL to create a worktree from that PR.
|
||||
|
||||
```bash theme={null}
|
||||
claude --worktree
|
||||
claude --worktree feature-auth
|
||||
claude --worktree "#142"
|
||||
```
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="--tmux">
|
||||
Create a tmux session alongside the worktree. Requires `--worktree`. Uses iTerm2 native panes when available; pass `--tmux=classic` to force standard tmux behavior.
|
||||
|
||||
```bash theme={null}
|
||||
claude --worktree feature-auth --tmux
|
||||
```
|
||||
</Accordion>
|
||||
</AccordionGroup>
|
||||
|
||||
***
|
||||
|
||||
## Debug flags
|
||||
|
||||
<AccordionGroup>
|
||||
<Accordion title="-d, --debug [filter]">
|
||||
Enable debug mode. Optionally pass a filter to restrict which debug categories are shown.
|
||||
|
||||
```bash theme={null}
|
||||
# Show all debug output
|
||||
claude --debug
|
||||
|
||||
# Show only api and hooks categories
|
||||
claude --debug "api,hooks"
|
||||
|
||||
# Exclude specific categories
|
||||
claude --debug "!file,!1p"
|
||||
```
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="--debug-file <path>">
|
||||
Write debug logs to a specific file path instead of displaying them inline. Implicitly enables debug mode.
|
||||
|
||||
```bash theme={null}
|
||||
claude --debug-file /tmp/claude-debug.log
|
||||
```
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="--bare">
|
||||
Minimal mode. Skips hooks, LSP, plugin sync, attribution, auto-memory, background prefetches, keychain reads, and `CLAUDE.md` auto-discovery. Sets `CLAUDE_CODE_SIMPLE=1`.
|
||||
|
||||
Authentication is limited to `ANTHROPIC_API_KEY` or `apiKeyHelper` via `--settings` (OAuth and keychain are not used).
|
||||
|
||||
Use `--bare` in scripted pipelines where startup latency matters and the features it disables are not needed. You can still provide context explicitly:
|
||||
|
||||
```bash theme={null}
|
||||
claude --bare \
|
||||
--system-prompt "$(cat context.md)" \
|
||||
--add-dir /project/libs \
|
||||
--mcp-config ./tools.json \
|
||||
-p "perform the analysis"
|
||||
```
|
||||
</Accordion>
|
||||
</AccordionGroup>
|
||||
|
||||
***
|
||||
|
||||
## Flag combinations
|
||||
|
||||
Common flag patterns for scripting and automation:
|
||||
|
||||
```bash theme={null}
|
||||
# Non-interactive with JSON output
|
||||
claude -p "list all exported types" --output-format json
|
||||
|
||||
# Bypass permissions in CI (sandboxed environment only)
|
||||
claude -p "run full test suite and fix failures" --dangerously-skip-permissions
|
||||
|
||||
# Resume last session and continue non-interactively
|
||||
claude --continue -p "now write the tests for that"
|
||||
|
||||
# Use a custom MCP config with strict isolation
|
||||
claude --mcp-config ./ci-mcp.json --strict-mcp-config -p "analyze the schema"
|
||||
|
||||
# Append to system prompt without replacing it
|
||||
claude --append-system-prompt "Always output TypeScript, not JavaScript."
|
||||
```
|
||||
|
||||
|
||||
Built with [Mintlify](https://mintlify.com).
|
||||
106
docs/claude-code-docs-main/en/reference/commands/overview.md
Normal file
106
docs/claude-code-docs-main/en/reference/commands/overview.md
Normal file
@@ -0,0 +1,106 @@
|
||||
> ## Documentation Index
|
||||
> Fetch the complete documentation index at: https://vineetagarwal-code-claude-code.mintlify.app/llms.txt
|
||||
> Use this file to discover all available pages before exploring further.
|
||||
|
||||
# Commands overview
|
||||
|
||||
> Claude Code accepts two categories of commands: CLI flags you pass at launch, and slash commands you type during a session.
|
||||
|
||||
Claude Code has two categories of commands:
|
||||
|
||||
* **CLI flags** — options you pass when starting Claude from your terminal (e.g. `claude --model sonnet`). They configure the session before it starts.
|
||||
* **Slash commands** — text commands you type inside an active session (e.g. `/help`). They control Claude's behavior while the session is running.
|
||||
|
||||
## Getting help
|
||||
|
||||
```bash theme={null}
|
||||
# Show all CLI flags
|
||||
claude --help
|
||||
|
||||
# Inside a session, list slash commands
|
||||
/help
|
||||
```
|
||||
|
||||
`/help` lists every slash command available in the current session, including commands added by plugins and skills.
|
||||
|
||||
## Two types of commands
|
||||
|
||||
| Type | When to use | Example |
|
||||
| -------------- | ----------------------------------------------------------------------------- | ------------------------------------------------------ |
|
||||
| CLI flags | Configure a session at launch — set the model, output format, permission mode | `claude --permission-mode acceptEdits "fix the tests"` |
|
||||
| Slash commands | Interact with a running session — manage memory, switch models, commit code | `/commit` |
|
||||
|
||||
CLI flags are consumed once and cannot be changed mid-session (with the exception of `/model` and `/permissions`, which change the running configuration in place).
|
||||
|
||||
## CLI flags
|
||||
|
||||
Pass flags directly after `claude`:
|
||||
|
||||
```bash theme={null}
|
||||
claude [flags] [prompt]
|
||||
```
|
||||
|
||||
```bash theme={null}
|
||||
# Non-interactive: print response and exit
|
||||
claude -p "summarize this file" < README.md
|
||||
|
||||
# Set model for the session
|
||||
claude --model opus
|
||||
|
||||
# Accept all file edits automatically
|
||||
claude --permission-mode acceptEdits
|
||||
```
|
||||
|
||||
See [CLI flags](/reference/commands/cli-flags) for the full list.
|
||||
|
||||
## Slash commands
|
||||
|
||||
Type a slash command at the input prompt inside any session:
|
||||
|
||||
```
|
||||
/command [arguments]
|
||||
```
|
||||
|
||||
```
|
||||
/init
|
||||
/compact summarize only the last three tasks
|
||||
/model claude-opus-4-5
|
||||
```
|
||||
|
||||
See [Slash commands](/reference/commands/slash-commands) for the full list.
|
||||
|
||||
## Keyboard shortcuts
|
||||
|
||||
These shortcuts work inside any interactive Claude Code session:
|
||||
|
||||
| Key | Action |
|
||||
| ------------- | ---------------------------------------------------------------- |
|
||||
| `Ctrl+C` | Interrupt the current response (Claude stops mid-turn) |
|
||||
| `Ctrl+D` | Exit Claude Code |
|
||||
| `Ctrl+L` | Clear the terminal display (does not clear conversation history) |
|
||||
| `Up` / `Down` | Navigate input history |
|
||||
| `Tab` | Autocomplete slash command names |
|
||||
| `Escape` | Cancel an in-progress permission prompt |
|
||||
|
||||
<Note>
|
||||
`Ctrl+C` interrupts the current response but keeps the conversation alive. Use `Ctrl+D` or `/exit` to end the session entirely.
|
||||
</Note>
|
||||
|
||||
## Subcommands
|
||||
|
||||
In addition to the main `claude` command, a few subcommands are available in your terminal:
|
||||
|
||||
| Subcommand | Description |
|
||||
| ------------------ | ---------------------------------------------- |
|
||||
| `claude mcp` | Configure and manage MCP servers |
|
||||
| `claude mcp serve` | Start Claude Code as an MCP server |
|
||||
| `claude doctor` | Diagnose installation and configuration issues |
|
||||
| `claude update` | Update Claude Code to the latest version |
|
||||
|
||||
```bash theme={null}
|
||||
claude mcp --help
|
||||
claude doctor
|
||||
```
|
||||
|
||||
|
||||
Built with [Mintlify](https://mintlify.com).
|
||||
@@ -0,0 +1,381 @@
|
||||
> ## Documentation Index
|
||||
> Fetch the complete documentation index at: https://vineetagarwal-code-claude-code.mintlify.app/llms.txt
|
||||
> Use this file to discover all available pages before exploring further.
|
||||
|
||||
# Slash commands
|
||||
|
||||
> Commands you type inside a running Claude Code session. Type / at the input prompt to activate them.
|
||||
|
||||
Slash commands are typed at the Claude Code input prompt during an active session. Every command starts with `/`.
|
||||
|
||||
```
|
||||
/command [arguments]
|
||||
```
|
||||
|
||||
<Tip>
|
||||
Type `/help` at any time to see all commands available in the current session, including any added by plugins and skills.
|
||||
</Tip>
|
||||
|
||||
## Quick reference
|
||||
|
||||
| Command | Description |
|
||||
| ------------------------------ | -------------------------------------------------------------------- |
|
||||
| [`/init`](#init) | Generate `CLAUDE.md` files and optional skills/hooks for the project |
|
||||
| [`/memory`](#memory) | Edit Claude memory files (global, project, local) |
|
||||
| [`/config`](#config) | Open the settings panel |
|
||||
| [`/hooks`](#hooks) | View hook configurations for tool events |
|
||||
| [`/mcp`](#mcp) | Manage MCP servers — enable, disable, reconnect |
|
||||
| [`/permissions`](#permissions) | Manage allow and deny rules for tools |
|
||||
| [`/plan`](#plan) | Enable plan mode or open/describe the current session plan |
|
||||
| [`/model`](#model) | Set the AI model for the current session |
|
||||
| [`/commit`](#commit) | Create a git commit with an AI-generated message |
|
||||
| [`/review`](#review) | Review a pull request |
|
||||
| [`/skills`](#skills) | List available skills |
|
||||
| [`/compact`](#compact) | Summarize conversation history to reduce context usage |
|
||||
| [`/clear`](#clear) | Clear conversation history and free up context |
|
||||
| [`/help`](#help) | Show help and available commands |
|
||||
| [`/login`](#login) | Sign in or switch Anthropic accounts |
|
||||
| [`/logout`](#logout) | Sign out from your Anthropic account |
|
||||
|
||||
***
|
||||
|
||||
## Project and memory commands
|
||||
|
||||
<AccordionGroup>
|
||||
<Accordion title="/init">
|
||||
**Syntax:** `/init`
|
||||
|
||||
Analyzes your codebase and sets up `CLAUDE.md` file(s), and optionally skills and hooks. Claude surveys key project files — manifests, CI config, build scripts, README — then interviews you to fill in any gaps before writing the output files.
|
||||
|
||||
What it sets up, depending on your choices:
|
||||
|
||||
* **Project `CLAUDE.md`** — team-shared instructions checked into source control. Covers build/test/lint commands, coding conventions, architecture notes, and non-obvious gotchas.
|
||||
* **Personal `CLAUDE.local.md`** — your private preferences for this project (gitignored). Covers your role, sandbox URLs, communication preferences.
|
||||
* **Skills** (`.claude/skills/<name>/SKILL.md`) — on-demand workflows you or Claude invoke with `/<skill-name>`.
|
||||
* **Hooks** (`.claude/settings.json`) — deterministic shell commands that run automatically on tool events (e.g. format on every edit).
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
/init
|
||||
```
|
||||
|
||||
<Tip>
|
||||
Run `/init` again at any time. If `CLAUDE.md` already exists, Claude will propose specific changes rather than overwriting the file.
|
||||
</Tip>
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="/memory">
|
||||
**Syntax:** `/memory`
|
||||
|
||||
Opens an interactive editor for Claude's memory files. Memory files are loaded into every session and persist across conversations.
|
||||
|
||||
The three memory scopes are:
|
||||
|
||||
| Scope | File | Who it applies to |
|
||||
| ------- | --------------------------------- | --------------------------------------- |
|
||||
| Global | `~/.claude/CLAUDE.md` | You, across all projects |
|
||||
| Project | `CLAUDE.md` at project root | Everyone on the team |
|
||||
| Local | `CLAUDE.local.md` at project root | You, for this project only (gitignored) |
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
/memory
|
||||
```
|
||||
</Accordion>
|
||||
</AccordionGroup>
|
||||
|
||||
***
|
||||
|
||||
## Configuration commands
|
||||
|
||||
<AccordionGroup>
|
||||
<Accordion title="/config">
|
||||
**Syntax:** `/config`
|
||||
|
||||
**Alias:** `/settings`
|
||||
|
||||
Opens the configuration panel where you can view and edit Claude Code settings, including model preferences, theme, verbose mode, and more.
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
/config
|
||||
```
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="/hooks">
|
||||
**Syntax:** `/hooks`
|
||||
|
||||
Displays the hook configurations currently active for this session. Hooks are shell commands that run automatically when tool events occur (e.g. after every file edit, before a Bash command).
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
/hooks
|
||||
```
|
||||
|
||||
<Note>
|
||||
To create or edit hooks, use `/init` or edit `.claude/settings.json` directly. See the [hooks guide](/guides/hooks) for the full schema.
|
||||
</Note>
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="/mcp">
|
||||
**Syntax:** `/mcp [enable|disable [server-name]]`
|
||||
|
||||
Manages MCP (Model Context Protocol) servers for the current session. Without arguments, opens the MCP management panel. With arguments, enables or disables specific servers.
|
||||
|
||||
| Argument | Effect |
|
||||
| ------------------------- | --------------------------------- |
|
||||
| *(none)* | Open the MCP management panel |
|
||||
| `enable` | Enable all disabled MCP servers |
|
||||
| `enable <server-name>` | Enable a specific server by name |
|
||||
| `disable` | Disable all active MCP servers |
|
||||
| `disable <server-name>` | Disable a specific server by name |
|
||||
| `reconnect <server-name>` | Reconnect to a specific server |
|
||||
|
||||
**Examples:**
|
||||
|
||||
```
|
||||
/mcp
|
||||
/mcp enable
|
||||
/mcp enable my-database-server
|
||||
/mcp disable analytics-server
|
||||
/mcp reconnect filesystem
|
||||
```
|
||||
|
||||
<Note>
|
||||
To add or remove MCP servers permanently, use the `claude mcp` CLI subcommand or edit your MCP config file. Changes made with `/mcp enable`/`disable` apply for the current session only.
|
||||
</Note>
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="/permissions">
|
||||
**Syntax:** `/permissions`
|
||||
|
||||
**Alias:** `/allowed-tools`
|
||||
|
||||
Opens the permissions panel where you can view and manage allow and deny rules for tools. Rules control which tools Claude can use without prompting (allow rules) and which are blocked entirely (deny rules).
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
/permissions
|
||||
```
|
||||
|
||||
Rules use glob-style patterns:
|
||||
|
||||
```
|
||||
Bash(git:*) # allow all git commands
|
||||
Bash(npm:*) # allow all npm commands
|
||||
Edit(src/**/*.ts) # allow edits to TypeScript files in src/
|
||||
```
|
||||
|
||||
See [permissions](/concepts/permissions) for the full rule syntax.
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="/model">
|
||||
**Syntax:** `/model [model]`
|
||||
|
||||
Sets the AI model used for the rest of the session. Without an argument, opens an interactive model picker. With a model name or alias, switches immediately.
|
||||
|
||||
| Argument | Effect |
|
||||
| ------------------- | ------------------------------------- |
|
||||
| *(none)* | Open the interactive model picker |
|
||||
| `sonnet` | Switch to the latest Claude Sonnet |
|
||||
| `opus` | Switch to the latest Claude Opus |
|
||||
| `haiku` | Switch to the latest Claude Haiku |
|
||||
| `claude-sonnet-4-6` | Switch to a specific model by full ID |
|
||||
|
||||
**Examples:**
|
||||
|
||||
```
|
||||
/model
|
||||
/model sonnet
|
||||
/model claude-opus-4-5
|
||||
```
|
||||
</Accordion>
|
||||
</AccordionGroup>
|
||||
|
||||
***
|
||||
|
||||
## Session management commands
|
||||
|
||||
<AccordionGroup>
|
||||
<Accordion title="/plan">
|
||||
**Syntax:** `/plan [open|<description>]`
|
||||
|
||||
Enables plan mode or manages the current session plan. In plan mode, Claude produces a written plan before taking any action and waits for your approval.
|
||||
|
||||
| Argument | Effect |
|
||||
| --------------- | -------------------------------------------- |
|
||||
| *(none)* | Toggle plan mode on/off |
|
||||
| `open` | Open and display the current plan |
|
||||
| `<description>` | Create a new plan with the given description |
|
||||
|
||||
**Examples:**
|
||||
|
||||
```
|
||||
/plan
|
||||
/plan open
|
||||
/plan refactor the auth module to use JWT
|
||||
```
|
||||
|
||||
<Tip>
|
||||
Plan mode is equivalent to `--permission-mode plan` at launch. Use it when you want to review what Claude intends to do before any files are touched.
|
||||
</Tip>
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="/compact">
|
||||
**Syntax:** `/compact [instructions]`
|
||||
|
||||
Summarizes the conversation history and replaces it with a condensed version in context. Use this when the context window is filling up and you want to continue working without starting a new session.
|
||||
|
||||
An optional argument lets you give Claude specific instructions for how to summarize.
|
||||
|
||||
**Examples:**
|
||||
|
||||
```
|
||||
/compact
|
||||
/compact focus only on the database schema changes
|
||||
/compact summarize the last three completed tasks
|
||||
```
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="/clear">
|
||||
**Syntax:** `/clear`
|
||||
|
||||
**Aliases:** `/reset`, `/new`
|
||||
|
||||
Clears the entire conversation history and frees up context, starting a fresh session in the same working directory. Unlike `/compact`, this removes all history rather than summarizing it.
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
/clear
|
||||
```
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="/skills">
|
||||
**Syntax:** `/skills`
|
||||
|
||||
Lists all skills available in the current session. Skills are on-demand capabilities defined in `.claude/skills/` that you or Claude can invoke with `/<skill-name>`.
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
/skills
|
||||
```
|
||||
</Accordion>
|
||||
</AccordionGroup>
|
||||
|
||||
***
|
||||
|
||||
## Git commands
|
||||
|
||||
<AccordionGroup>
|
||||
<Accordion title="/commit">
|
||||
**Syntax:** `/commit`
|
||||
|
||||
Creates a git commit using AI-generated commit message. Claude reads the current git status and diff, analyzes staged and unstaged changes, and drafts a concise commit message that focuses on the "why" rather than the "what". It then stages the relevant files and creates the commit.
|
||||
|
||||
Claude follows the existing commit message style in the repository and applies these safety rules:
|
||||
|
||||
* Never amends existing commits (always creates a new commit)
|
||||
* Never skips hooks (`--no-verify`)
|
||||
* Never commits files that likely contain secrets (`.env`, credentials files)
|
||||
* Does not create empty commits when there are no changes
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
/commit
|
||||
```
|
||||
|
||||
<Note>
|
||||
`/commit` only has access to `git add`, `git status`, and `git commit`. It cannot push, rebase, or run other git operations.
|
||||
</Note>
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="/review">
|
||||
**Syntax:** `/review [PR-number]`
|
||||
|
||||
Runs an AI code review on a pull request using the GitHub CLI (`gh`). Without a PR number, Claude runs `gh pr list` to show open PRs. With a PR number, it fetches the PR details and diff, then provides a structured review covering:
|
||||
|
||||
* Overview of what the PR does
|
||||
* Code quality and style analysis
|
||||
* Specific improvement suggestions
|
||||
* Potential issues or risks
|
||||
* Performance, test coverage, and security considerations
|
||||
|
||||
**Examples:**
|
||||
|
||||
```
|
||||
/review
|
||||
/review 142
|
||||
```
|
||||
|
||||
<Note>
|
||||
`/review` requires the [GitHub CLI](https://cli.github.com/) (`gh`) to be installed and authenticated.
|
||||
</Note>
|
||||
</Accordion>
|
||||
</AccordionGroup>
|
||||
|
||||
***
|
||||
|
||||
## Account and help commands
|
||||
|
||||
<AccordionGroup>
|
||||
<Accordion title="/help">
|
||||
**Syntax:** `/help`
|
||||
|
||||
Shows help and lists all slash commands available in the current session, including built-in commands, skill commands, and any commands added by installed plugins.
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
/help
|
||||
```
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="/login">
|
||||
**Syntax:** `/login`
|
||||
|
||||
Signs in to your Anthropic account or switches between accounts. Opens a browser-based OAuth flow if not already authenticated, or presents the account switcher if you are.
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
/login
|
||||
```
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="/logout">
|
||||
**Syntax:** `/logout`
|
||||
|
||||
Signs out from your Anthropic account. After logging out, Claude Code will prompt you to authenticate again on the next session.
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
/logout
|
||||
```
|
||||
</Accordion>
|
||||
</AccordionGroup>
|
||||
|
||||
***
|
||||
|
||||
## Custom skill commands
|
||||
|
||||
When you or a plugin author creates a skill in `.claude/skills/<skill-name>/SKILL.md`, it becomes available as `/<skill-name>` in any session where that skill is loaded.
|
||||
|
||||
```
|
||||
/verify
|
||||
/deploy staging
|
||||
/fix-issue 123
|
||||
```
|
||||
|
||||
Run `/skills` to see all loaded skills and their descriptions. See the [skills guide](/guides/skills) for how to create your own.
|
||||
|
||||
|
||||
Built with [Mintlify](https://mintlify.com).
|
||||
Reference in New Issue
Block a user