Claude Code

Anthropic 推出的 Agentic Coding System,覆盖终端 CLI、VS Code 插件、Desktop App、Web 云端、手机控制、浏览器/桌面操作,通过 Skills/Hooks/Subagents/Workflows/Routines 扩展成团队级工程工作流。

#status / growing #type / resource #tech / ai #resource / claude-code #interface / cli #media / tool

[!info] related notes

Claude Code

它是什么

截至 2026-07-04,Claude Code 已经不是”一个命令行里的 Claude 聊天窗口”,而是一个完整的 Agentic Coding System:它能读代码库、编辑文件、运行命令、跑测试、管理 Git、开 PR、做代码审查、连接 MCP 工具、使用浏览器/桌面、并通过 Skills / Hooks / Subagents / Workflows / Routines 扩展成团队级工程工作流。

Anthropic 官方定位:一个可以读取代码库、编辑文件、运行命令,并集成到终端、IDE、桌面 App 和浏览器里的 agentic coding tool。

核心能力

能力说明
读代码库理解项目结构、调用链、依赖关系
改代码多文件编辑、重构、修 bug
跑命令执行测试、构建、lint、git 命令
验证结果看测试、日志、浏览器、截图
工程集成Git、PR、CI、MCP、Hooks、Skills、Subagents

主要入口

Terminal CLI(最核心入口)

claude                          # 交互式会话
claude "explain this project"   # 带 prompt 启动
claude -p "review this diff"    # 非交互执行
claude -c                       # 继续最近会话
claude -r "session-name"        # 恢复指定会话
claude --permission-mode plan   # 指定权限模式
claude --chrome                 # 启用 Chrome 集成
claude --cloud "fix CI"         # 云端任务
claude --remote-control         # 手机/网页控制

VS Code / Cursor 插件

coding-agent-ide-integration

  • inline diff、@ 文件引用、选择代码上下文
  • 计划审查(Plan 作为 markdown 文档可评论)
  • 会话历史、多会话、权限模式、插件、MCP、Hooks、Memory
  • Shift+Tab 切换权限模式

Desktop App

  • 并行 sessions、Git 隔离、拖拽式布局
  • 集成终端和文件编辑器
  • 可视化 diff review、app previews、PR monitoring
  • Computer Use(macOS/Windows)
  • SSH / Cloud / Local 环境选择

Claude Code on the Web

coding-agent-cloud-execution

  • 运行在 Anthropic-managed cloud infrastructure
  • 浏览器关闭后 session 仍然持续
  • 可在 Claude mobile app 里监控
  • 云端环境内置 Python、Node、Go、Rust、Docker、PostgreSQL、Redis 等

Remote Control

claude --remote-control
claude remote-control --name "My Project"
  • 手机/网页控制本地机器上的 Claude Code
  • 代码执行仍在本机,交互界面可在浏览器或手机上

共享能力

这些能力是 coding agent 的通用模式,详见对应笔记:

能力笔记
Skills(可复用工作流)coding-agent-skills
Subagents(子代理)coding-agent-subagents
权限模式coding-agent-permission-modes
云端执行coding-agent-cloud-execution
IDE 集成coding-agent-ide-integration
GitHub 集成coding-agent-github-integration
浏览器/桌面操作coding-agent-browser-computer-use
Code Reviewcoding-agent-code-review
自动化coding-agent-automation
Git Worktreecoding-agent-git-worktree

Claude Code 特有的 Skills 细节

  • Slash command 调用/skill-name 直接触发
  • /run-skill-generator:录制项目启动和验证流程,自动生成 Skill
  • .claude/commands/:轻量级替代——纯 prompt 文件变成 /命令名
  • 与 Workflow 联动:Skill 指令可以要求使用 Workflow 引擎做多 Agent 编排

Claude Code 特有的 Subagents 细节

  • Agent 工具:手动调用,主 agent 决定顺序和参数
  • Workflow 引擎:确定性脚本编排(→ claude-code-workflow
  • 自定义 agent 类型.claude/agents/*.md 定义专门化 agent
  • 隔离模式isolation: 'worktree' 让 subagent 在独立 git worktree 中工作
  • 缓存恢复:编辑脚本后可从断点恢复

Claude Code 特有的 GitHub 集成细节

  • @claude review:PR comment 触发审查,输出 inline comments
  • @claude implement this feature:根据 Issue 描述实现功能
  • anthropics/claude-code-action@v1:GitHub Action
  • /autofix-pr:云端监听 PR,修 CI 或 review comment

Claude Code 特有的自动化细节

  • /schedule:创建云端 Routine,电脑关机也能继续
  • /loop:当前 session 内重复运行
  • /goal:设置持续推进目标
  • 支持按时间、API 调用、GitHub 事件触发

Claude Code 特有的浏览器/桌面细节

  • Chrome 集成claude --chrome/chrome 连接 Chrome/Edge
  • 使用浏览器里的登录状态
  • 遇到登录页或 CAPTCHA 会暂停让你手动处理
  • Computer Use:CLI 版 macOS research preview,Desktop 版支持 macOS 和 Windows

记忆机制

Claude Code 的记忆拆成两层:

详见 → claude-code-memory

规则文件与配置文件

规则 / 记忆文件

  • 用户级:~/.claude/CLAUDE.md~/.claude/rules/**/*.md
  • 项目级:CLAUDE.md.claude/CLAUDE.md.claude/rules/**/*.md
  • 本地个人覆盖:CLAUDE.local.md
  • 组织托管:系统目录下的 CLAUDE.md

加载规则沿当前工作目录向上发现,拼接到上下文。同目录中 CLAUDE.local.md 追加在 CLAUDE.md 后面。

Claude Code 不直接读 AGENTS.md。如果仓库有 AGENTS.md,更稳的做法是在 CLAUDE.md 中通过 @AGENTS.md 导入。

Prompt / slash command 文件

  • 用户级:~/.claude/commands/*.md
  • 项目级:.claude/commands/*.md

配置文件

  • 用户设置:~/.claude/settings.json
  • 项目共享设置:.claude/settings.json
  • 项目本地覆盖:.claude/settings.local.json
  • 用户级 MCP:~/.claude.json
  • 项目级 MCP:.mcp.json

优先级:Managed → CLI arguments → Local → Project → User

Slash Commands

项目初始化

命令作用
/init初始化或改进 CLAUDE.md
/memory编辑 memory / CLAUDE.md
/permissions管理工具权限
/mcp管理 MCP server
/skills查看 skills
/doctor诊断安装和配置问题

模型和思考强度

命令作用
/model切换模型
/effort设置推理强度(low/medium/high/xhigh/max)
/fast开关 fast mode

上下文管理

命令作用
/context查看上下文使用情况
/compact总结压缩上下文
/clear开新会话
/btw不进入主上下文的旁路问题

计划、实施、验证

命令作用
/plan进入计划模式,只分析不改代码
/diff查看当前改动
/run启动并驱动项目 app
/verify验证改动是否真的工作
/goal设定完成条件

Review / PR / 安全

命令作用
/code-review审查当前 diff
/code-review --fix审查并尝试修复
/code-review ultra云端多 agent 深度 review
/review审查 GitHub PR
/security-review安全审查
/simplify清理复杂代码

并行和长任务

命令作用
/fork派生后台 subagent
/branch分叉当前会话
/background当前 session 转后台
/tasks查看后台任务
/batch大规模改动拆成 5–30 个 worktree subagents
/workflows查看动态 workflow 进度

远程、云端

命令作用
/desktop转到 Desktop App
/teleport把 web session 拉回本地
/remote-control让本地 session 可被网页/手机控制
/schedule创建云端 Routine
/loop当前 session 内重复运行

多 Agent 编排

Claude Code 内置 Workflow 多 Agent 编排引擎:

会话、上下文、恢复

claude -c               # 继续最近会话
claude -r "name"        # 恢复指定会话

会话内:

命令作用
/resume打开会话选择器
/branch从当前点复制会话分支
/rewind回滚代码或会话到之前 checkpoint
/compact压缩上下文

Hooks(确定性自动化)

Hooks 在 Claude Code 生命周期某些节点自动运行命令:

Hook 场景作用
PostToolUse after Edit/Write改完文件后自动格式化
PreToolUse before Bash阻止危险命令
PreToolUse before Edit禁止改 .env、lockfile
NotificationClaude 等你输入时发通知

--settings Profile:多中转站快速切换

Claude Code CLI 没有像 Codex 那样的 --profile 机制(claude -p 是 print mode / 非交互查询)。但可以用 --settings 参数加载不同的 settings JSON 文件,实现类似的多中转站切换。

原理

claude --settings <path> 会用指定文件覆盖当前会话的 settings,包括 env 中的环境变量(ANTHROPIC_BASE_URLANTHROPIC_API_KEYANTHROPIC_MODEL 等)。每个文件就是一个”配置档案”。

目录结构

~/.claude/
├── settings.json                  # 主设置文件(默认中转站配置)
└── profiles/
    ├── 100xlabs.json              # claude --settings ~/.claude/profiles/100xlabs.json
    ├── anyrouter.json             # claude --settings ~/.claude/profiles/anyrouter.json
    └── mimo.json                  # claude --settings ~/.claude/profiles/mimo.json

Profile 文件示例

// ~/.claude/profiles/anyrouter.json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://anyrouter.top",
    "ANTHROPIC_API_KEY": "sk-xxx",
    "ANTHROPIC_MODEL": "claude-opus-4-7",
    "ANTHROPIC_BETAS": "context-1m-2025-08-07",
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
  },
  "model": "opus[1m]",
  "theme": "dark"
}

// ~/.claude/profiles/mimo.json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://token-plan-cn.xiaomimimo.com/anthropic",
    "ANTHROPIC_API_KEY": "tp-xxx",
    "ANTHROPIC_MODEL": "mimo-v2.5-pro",
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
  },
  "model": "opus[1m]",
  "theme": "dark"
}

配合 shell alias 使用

# .zshrc / .bashrc
alias ccc="claude --bare"                                         # 默认(主 settings.json)
alias claude-100xlabs="claude --bare --settings ~/.claude/profiles/100xlabs.json"
alias claude-anyrouter="claude --bare --settings ~/.claude/profiles/anyrouter.json"
alias claude-mimo="claude --bare --settings ~/.claude/profiles/mimo.json"

用起来就是:

ccc                # 默认 100xlabs
claude-anyrouter   # 切到 anyrouter
claude-mimo        # 切到 mimo

与 Codex --profile 的对比

特性Codex --profileClaude Code --settings
官方内置是(--settings 是官方参数)
配置文件格式TOML(叠加)JSON(覆盖)
快捷键codex -p name需自建 alias
覆盖粒度只覆盖差异字段整份 settings 替换

注意点

  • 每个 profile 文件要包含完整配置(env + model + theme),因为 --settings 是替换而非叠加
  • CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 在 VPS 上必须设置——Claude Code 默认会连接 Anthropic 服务器(插件市场、LSP 等),VPS 网络受限会导致卡死
  • --bare 跳过插件市场和 LSP 连接,VPS 上推荐始终使用
  • anyrouter 的 Claude 模型需要 ANTHROPIC_BETAS: "context-1m-2025-08-07" 请求头
  • 相比 shell function export 环境变量,--settings 方式不留全局状态,配置隔离更干净

使用边界

  • 适合长链路工程任务、架构分析、代码修复、PR review、本地验证
  • 不适合一次性简单问答
  • 权限模式是核心安全机制,必须根据任务选择合适的模式

最短记忆方式

Claude Code = Anthropic 的 Agentic Coding System,覆盖 CLI/IDE/Desktop/Web/手机/浏览器,核心是 Skills + Hooks + Subagents + Workflows + Routines 的工程化扩展体系。

创建于 2026/2/19 更新于 2026/7/15