【Claude Code】入门

【Claude Code】入门

  • 0.【2万字】深度梳理Claude Code Skills
  • 1.Claude Code快速入门与配置
    • 1.1 安装Node JS
    • 1.2 安装Claude Code
    • 1.3 其他安装方式
  • 2. 常用命令
  • 3. Claude Code API
  • 附录

0.【2万字】深度梳理Claude Code Skills

https://mp.weixin.qq.com/s/mN5UuIPOehMVmKWl6-6oPQ

1.Claude Code快速入门与配置

1.1 安装Node JS

(FastAPI_first)➜ Qwen nvminstallv22.18.0 Downloading and installingnodev22.18.0... Downloading https://nodejs.org/dist/v22.18.0/node-v22.18.0-darwin-arm64.tar.xz...################################################################################################################################################ 100.0%Computing checksum with shasum-a256Checksums matched!Now usingnodev22.18.0(npm v10.9.3)(FastAPI_first)➜ Qwennode-vv22.18.0(FastAPI_first)➜ Qwennpm-v10.9.3

1.2 安装Claude Code

(FastAPI_first)➜ Qwensudonpminstall-g@anthropic-ai/claude-code Password: added3packagesin7s2packages are lookingforfunding run`npmfund`fordetails(FastAPI_first)➜ Qwen claude--version2.1.87(Claude Code)

选项说明
–add-dir <directories…>允许工具访问的额外目录
–agent当前会话使用的智能代理,覆盖配置中的 agent 设置
–agents以 JSON 格式自定义代理
–allow-dangerously-skip-permissions可选绕过所有权限校验,仅推荐无外网沙箱环境使用
–allowed-tools <tools…>允许使用的工具列表,逗号 / 空格分隔
–append-system-prompt在默认系统提示词后追加内容
–bare极简模式,关闭钩子、LSP、插件同步等附加功能
–betas <betas…>API 请求中加入 Beta 功能头(仅 API Key 用户)
–brief启用代理与用户通信的消息工具
–chrome启用 Claude 与 Chrome 集成
-c, --continue继续当前目录最近一次对话
–dangerously-skip-permissions直接绕过所有权限校验,仅推荐无外网沙箱
-d, --debug [filter]开启调试模式,支持分类过滤
–debug-file将调试日志写入指定文件
–disable-slash-commands禁用所有技能(/ 命令)
–disallowed-tools <tools…>禁止使用的工具列表
–effort会话思考 / 执行力度:low / medium / high / max
–fallback-model默认模型过载时自动切换备用模型(仅配合 --print)
–file <specs…>启动时预下载文件,格式:file_id:路径
–fork-session恢复会话时新建会话 ID,不复用原 ID
–from-pr [value]通过 PR 编号 / URL 恢复关联会话
-h, --help显示帮助信息
–ide启动时自动连接到可用 IDE
–include-partial-messages实时输出部分消息块(仅配合 --print + 流式 JSON)
–input-format输入格式:text / stream-json(仅配合 --print)
–json-schema结构化输出校验用的 JSON Schema
–max-budget-usdAPI 调用最大花费上限(美元,仅配合 --print)
–mcp-config <configs…>从 JSON 文件 / 字符串加载 MCP 服务配置
–mcp-debug已废弃,改用 --debug,开启 MCP 调试
–model指定使用的模型,支持别名如 sonnet / opus
-n, --name为会话设置显示名称
–no-chrome关闭 Claude 与 Chrome 集成
–no-session-persistence关闭会话持久化,不保存到磁盘(仅配合 --print)
–output-format输出格式:text / json / stream-json(仅配合 --print)
–permission-mode会话权限模式:acceptEdits / bypassPermissions / default 等
–plugin-dir为本会话加载指定目录插件
-p, --print打印结果后直接退出,适合管道调用
–replay-user-messages回显用户输入消息(仅配合流式 JSON)
-r, --resume [value]通过会话 ID 恢复对话
–session-id指定会话 UUID
–setting-sources配置来源列表:user / project / local
–settings从 JSON 文件 / 字符串加载额外配置
–strict-mcp-config仅使用 --mcp-config 定义的 MCP 服务
–system-prompt设置会话系统提示词
–tmux为工作树创建 tmux 会话
–tools <tools…>指定可用工具列表
–verbose强制开启详细日志
-v, --version显示版本号
-w, --worktree [name]为会话创建新 git worktree


1.3 其他安装方式

https://www.komapi.top/about


curl-fsSLhttps://claude.ai/install.sh|shexporthttps_proxy=http://your-proxy:portcurl-fsSLhttps://claude.ai/install.sh|shnpminstall-g@anthropic-ai/claude-code--registry=https://registry.npmmirror.com brewinstallclaude-codenpminstall-g@anthropic-ai/claude-codenpminstall-g@anthropic-ai/claude-code--registry=https://registry.npmmirror.com

2. 常用命令

  1. 配置代理网络和Claude API Key
    在当前项目的目录下创建.claude/settings.json
{"env":{"HTTP_PROXY":"http://127.0.0.1:7890","HTTPS_PROXY":"http://127.0.0.1:7890"}}
  1. 配置API Key环境变量
# 设置API密钥(如果需要) 这是另一种登录方式,也可以通过官网的方式登录见下图exportANTHROPIC_API_KEY=your_api_key# 设置自定义模型exportANTHROPIC_MODEL=claude-3-5-sonnet-20241022# 设置基础URL(用于代理)exportANTHROPIC_BASE_URL=https://your-proxy.com/v1

3. Claude Code API


使用后效果

附录

  1. Claude Code 超详细完整指南(2026最新版) https://zhuanlan.zhihu.com/p/1971872808159141982
  2. Claude Code课程
  3. VibeCoding零基础实战开发 https://www.yuque.com/xxcls/vibecoding
  4. CLAUDE.md 速通指南,8 个技巧让 Claude Code 起飞!