Claude Code 启动参数完全指南

Model: minimax-m2 | ¥0.15/call
工程方法论Claude Sonnet 4.6工程实践启动参数完全指南

启动参数完全指南:shanraisshan/claude-code-best-practice: claude-cli,适用于工程实践、代码质量与开发流程优化。

Calls: 1

Skill Documentation

Claude Code 启动参数完全指南

摘要

启动参数完全指南:shanraisshan/claude-code-best-practice: claude-cli,适用于工程实践、代码质量与开发流程优化。

> 来源: shanraisshan/claude-code-best-practice (64k stars) — Claude Code 完整实践指南

> 原文件: best-practice/claude-cli-startup-flags.md

> 模型推荐: 看 skill 类型挑

这个 skill 是干嘛的

shanraisshan 在 64k stars 的仓库里整理的"Claude Code 完整实践指南" — 涵盖启动参数、commands、MCP、memory、settings、skills、subagents 等所有方面。

michael 强调"skill 要有相应的指导功能,指导用户使用",所以加了下面两节让 Agent 和用户对接。

---

🤖 Agent 使用说明

1. 用户问"Claude Code 怎么用 X"时,触发对应 skill

2. skill 严格按原文指南跑

3. 涉及配置改动前 ask user 确认(避免破坏现有配置)

4. 完工后让 Agent 跑自检

👤 用户需要做什么?

1. 问 Agent "Claude Code 怎么 X"(X = 子主题)

2. 如果 Agent 改配置,确认后再继续

3. 全程 Agent 自动化,你只需回答授权类问题

---

原 skill 内容(shanraisshan/claude-code-best-practice/best-practice/claude-cli-startup-flags.md,截断到 12k chars)

CLI Startup Flags Best Practice

![Last Updated](https://img.shields.io/badge/Last_Updated-Mar%2002%2C%202026-white?style=flat&labelColor=555)

Reference for Claude Code startup flags, top-level subcommands, and startup environment variables when launching Claude Code from the terminal.

<table width="100%">

<tr>

<td><a href="../">← Back to Claude Code Best Practice</a></td>

<td align="right"><img src="../!/claude-jumping.svg" alt="Claude" width="60" /></td>

</tr>

</table>

---

Table of Contents

1. [Session Management](#session-management)

2. [Model & Configuration](#model--configuration)

3. [Permissions & Security](#permissions--security)

4. [Output & Format](#output--format)

5. [System Prompt](#system-prompt)

6. [Agent & Subagent](#agent--subagent)

7. [MCP & Plugins](#mcp--plugins)

8. [Directory & Workspace](#directory--workspace)

9. [Budget & Limits](#budget--limits)

10. [Integration](#integration)

11. [Initialization & Maintenance](#initialization--maintenance)

12. [Debug & Diagnostics](#debug--diagnostics)

13. [Settings Override](#settings-override)

14. [Version & Help](#version--help)

15. [Subcommands](#subcommands)

16. [Environment Variables](#environment-variables)

---

Session Management

| Flag | Short | Description |

|------|-------|-------------|

| `--continue` | `-c` | Continue the most recent conversation in the current directory |

| `--resume` | `-r` | Resume a specific session by ID or name, or show interactive picker |

| `--from-pr <NUMBER\|URL>` | | Resume sessions linked to a specific GitHub PR |

| `--fork-session` | | Create a new session ID when resuming (use with `--resume` or `--continue`) |

| `--session-id <UUID>` | | Use a specific session ID (must be valid UUID) |

| `--no-session-persistence` | | Disable session persistence (print mode only) |

| `--remote` | | Create a new web session on claude.ai |

| `--teleport` | | Resume a web session in your local terminal |

---

Model & Configuration

| Flag | Short | Description |

|------|-------|-------------|

| `--model <NAME>` | | Set model with alias (`sonnet`, `opus`, `haiku`) or full model ID |

| `--fallback-model <NAME>` | | Auto-fallback model when default is overloaded (print mode only) |

| `--betas <LIST>` | | Beta headers to include in API requests (API key users only) |

---

Permissions & Security

| Flag | Short | Description |

|------|-------|-------------|

| `--dangerously-skip-permissions` | | Skip ALL permission prompts. Use with extreme caution |

| `--allow-dangerously-skip-permissions` | | Enable permission bypassing as an option without activating it |

| `--permission-mode <MODE>` | | Begin in specified permission mode: `default`, `plan`, `acceptEdits`, `bypassPermissions` |

| `--allowedTools <TOOLS>` | | Tools that execute without prompting (permission rule syntax) |

| `--disallowedTools <TOOLS>` | | Tools removed from model context entirely |

| `--tools <TOOLS>` | | Restrict which built-in tools Claude can use (use `""` to disable all) |

| `--permission-prompt-tool <TOOL>` | | Specify MCP tool to handle permission prompts in non-interactive mode |

---

Output & Format

| Flag | Short | Description |

|------|-------|-------------|

| `--print` | `-p` | Print response without interactive mode (headless/SDK mode) |

| `--output-format <FORMAT>` | | Output format: `text`, `json`, `stream-json` |

| `--input-format <FORMAT>` | | Input format: `text`, `stream-json` |

| `--json-schema <SCHEMA>` | | Get validated JSON matching schema (print mode only) |

| `--include-partial-messages` | | Include partial streaming events (requires `--print` and `--output-format=stream-json`) |

| `--verbose` | | Enable verbose logging with full turn-by-turn output |

---

System Prompt

| Flag | Short | Description |

|------|-------|-------------|

| `--system-prompt <TEXT>` | | Replace entire system prompt with custom text |

| `--system-prompt-file <PATH>` | | Load system prompt from file, replacing default (print mode only) |

| `--append-system-prompt <TEXT>` | | Append custom text to default system prompt |

| `--append-system-prompt-file <PATH>` | | Append file contents to default prompt (print mode only) |

---

Agent & Subagent

| Flag | Short | Description |

|------|-------|-------------|

| `--agent <NAME>` | | Specify an agent for the current session |

| `--agents <JSON>` | | Define custom subagents dynamically via JSON |

| `--teammate-mode <MODE>` | | Set agent team display: `auto`, `in-process`, `tmux` |

---

MCP & Plugins

| Flag | Short | Description |

|------|-------|-------------|

| `--mcp-config <PATH\|JSON>` | | Load MCP servers from JSON file or string |

| `--strict-mcp-config` | | Only use MCP servers from `--mcp-config`, ignore all others |

| `--plugin-dir <PATH>` | | Load plugins from directory for this session only (repeatable) |

---

Directory & Workspace

| Flag | Short | Description |

|------|-------|-------------|

| `--add-dir <PATH>` | | Add additional working directories for Claude to access |

| `--worktree` | `-w` | Start Claude in an isolated git worktree (branched from HEAD) |

---

Budget & Limits

| Flag | Short | Description |

|------|-------|-------------|

| `--max-budget-usd <AMOUNT>` | | Maximum dollar amount for API calls before stopping (print mode only) |

| `--max-turns <NUMBER>` | | Limit number of agentic turns (print mode only) |

---

Integration

| Flag | Short | Description |

|------|-------|-------------|

| `--chrome` | | Enable Chrome browser integration for web automation |

| `--no-chrome` | | Disable Chrome browser integration for this session |

| `--ide` | | Automatically connect to IDE on startup if exactly one valid IDE available |

---

Initialization & Maintenance

| Flag | Short | Description |

|------|-------|-------------|

| `--init` | | Run initialization hooks and start interactive mode |

| `--init-only` | | Run initialization hooks and exit (no interactive session) |

| `--maintenance` | | Run maintenance hooks and exit |

---

Debug & Diagnostics

| Flag | Short | Description |

|------|-------|-------------|

| `--debug <CATEGORIES>` | | Enable debug mode with optional category filtering (e.g., `"api,hooks"`) |

---

Settings Override

| Flag | Short | Description |

|------|-------|-------------|

| `--settings <PATH\|JSON>` | | Path to settings JSON file or JSON string to load |

| `--setting-sources <LIST>` | | Comma-separated list of sources to load: `user`, `project`, `local` |

| `--disable-slash-commands` | | Disable all skills and slash commands for this session |

---

Version & Help

| Flag | Short | Description |

|------|-------|-------------|

| `--version` | `-v` | Output the version number |

| `--help` | `-h` | Show help information |

---

Subcommands

These are top-level commands run as `claude <subcommand>`:

| Subcommand | Description |

|------------|-------------|

| `claude` | Start interactive REPL |

| `claude "query"` | Start REPL with initial prompt |

| `claude agents` | List configured agents |

| `claude auth` | Manage Claude Code authentication |

| `claude doctor` | Run diagnostics from the command line |

| `claude install` | Install or switch Claude Code native builds |

| `claude mcp` | Configure MCP servers (`add`, `remove`, `list`, `get`, `enable`) |

| `claude plugin` | Manage Claude Code plugins |

| `claude remote-control` | Manage remote control sessions |

| `claude setup-token` | Create a long-lived token for subscription usage |

| `claude update` / `claude upgrade` | Update to the latest version |

---

Environment Variables

These startup-only environment variables are set in your shell before launching Claude Code (they cannot be configured via `settings.json`):

| Variable | Description |

|----------|-------------|

| `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` | Enable experimental agent teams. Also env-configurable — see [Settings Reference](./claude-settings.md#environment-variables) |

| `CLAUDE_CODE_TMPDIR` | Override temp directory for internal files. Also configurable via `env` key — see [Settings Reference](./claude-settings.md#environment-variables-via-env) |

| `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1` | Enable additional directory CLAUDE.md loading. Also configurable via `env` key — see [Settings Reference](./claude-settings.md#environment-variables-via-env) |

| `DISABLE_AUTOUPDATER=1` | Disable auto-updates. Also configurable via `env` key — see [Settings Reference](./claude-settings.md#environment-variables-via-env) |

| `CLAUDE_CODE_EFFORT_LEVEL` | Control thinking depth — see [Settings Reference](./claude-settings.md#environment-variables-via-env) |

| `USE_BUILTIN_RIPGREP=0` | Use system ripgrep instead of built-in (Alpine Linux) |

| `CLAUDE_CODE_SIMPLE` | Enable simple mode (Bash + Edit tools only). Also configurable via `env` key — see [Settings Reference](./claude-settings.md#environment-variables-via-env) |

| `CLAUDE_BASH_NO_LOGIN=1` | Skip login shell for BashTool |

| `CCR_FORCE_BUNDLE=1` | Force bundling/uploading local repository when using `claude --remote`. Also configurable via `env` key — see [Settings Reference](./claude-settings.md#environment-variables-via-env) |

For environment variables configurable via the `"env"` key in `settings.json` (including `MAX_THINKING_TOKENS`, `CLAUDE_CODE_SHELL`, `CLAUDE_CODE_ENABLE_TASKS`, `CLAUDE_CODE_DISABLE_BACKGROUND_TASKS`, `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`, and more), see the [Claude Settings Reference](./claude-settings.md#environment-variables-via-env).

---

Sources

常见问题(FAQ)

使用「启动参数完全指南」这个 skill 能解决什么问题?

本 skill 专注于启动参数完全指南,shanraisshan/claude-code-best-practice: claude-cli-startup-flags。它将相关流程标准化,帮助用户更快拿到可靠结果,减少重复手工操作。

什么情况下适合使用「启动参数完全指南」?

当你需要在启动参数完全指南相关工作中获得稳定、可复用的产出时最适合——无论是单次任务还是纳入日常工作流,都能直接调用。

使用「启动参数完全指南」前需要准备什么?

需要一个具体的项目或任务上下文,最好带有代码仓库或需求文档。

FAQ

👤 用户需要做什么?

1. 问 Agent "Claude Code 怎么 X"(X = 子主题)

2. 如果 Agent 改配置,确认后再继续

3. 全程 Agent 自动化,你只需回答授权类问题

---

使用「启动参数完全指南」这个 skill 能解决什么问题?

本 skill 专注于启动参数完全指南,shanraisshan/claude-code-best-practice: claude-cli-startup-flags。它将相关流程标准化,帮助用户更快拿到可靠结果,减少重复手工操作。

什么情况下适合使用「启动参数完全指南」?

当你需要在启动参数完全指南相关工作中获得稳定、可复用的产出时最适合——无论是单次任务还是纳入日常工作流,都能直接调用。

使用「启动参数完全指南」前需要准备什么?

需要一个具体的项目或任务上下文,最好带有代码仓库或需求文档。