update-claude-code
更新 Claude Code
步骤
- 使用 npm 全局安装最新版本:
npm install -g @anthropic-ai/claude-code@latest
- 验证更新是否成功:
claude --version
-
向用户报告更新后的版本号。
-
清理旧版本:检查本机是否存在多个 Claude Code 版本残留,如有则只保留最新版本:
# 检查本地版本目录
ls ~/.local/share/claude/versions/
# 获取当前 symlink 指向的版本
readlink ~/.local/bin/claude
如果存在多个版本目录,不要只改 symlink——自动回滚机制会把 symlink 改回去。正确做法是通过 npm 安装来彻底绕开这套机制:
npm install -g @anthropic-ai/claude-code@latest
npm 安装的版本路径(通常为 ~/.nvm/versions/node/vX.X.X/bin/claude 或系统 npm bin)在 PATH 中优先级高于 ~/.local/bin/claude,可完全绕开自动回滚机制。
安装完成后,清理旧版本目录:
# 删除全部版本残留目录
rm -rf ~/.local/share/claude/versions/
再次验证版本正确:
claude --version && which claude
确认 which claude 输出的是 npm 路径(如 ~/.nvm/...),而不是 ~/.local/bin/claude。
注意事项
curl -fsSL https://claude.ai/install.sh | bash这种方式在部分地区(如中国大陆)无法访问,会返回 HTML 错误页面而非安装脚本,不要使用。- npm 方式是最可靠的更新方法,直接使用即可,无需代理。
- 如果 npm 也失败,检查 npm 是否已安装:
npm --version,并提示用户先安装 Node.js。 - Claude Code 使用自动更新机制,会将各版本下载到
~/.local/share/claude/versions/目录,~/.local/bin/claude是一个 symlink。当新版本崩溃时会自动回滚 symlink 到旧版本,导致--version显示的版本低于预期。仅修改 symlink 无法解决问题,回滚机制会重新下载旧版并改回去。必须通过 npm 安装来绕开这套机制。 - 清理
~/.local/share/claude/versions/目录后,npm 安装的版本不受影响,仍可正常使用。
More from nangongwentian-fe/agent-skills
persistent-memory
通用跨会话记忆协议(Universal Memory Protocol)。让所有 AI 编程工具共享同一套记忆系统。适用 Claude Code / Cursor / Aider / Cline / Codex / Trae / OpenCode。能力:智能分类 / FSRS 衰减 / 月度压缩 / 多层检索。触发:用户说"记住";问"之前";检测到敏感信息;会话结束。
23exa-unified-research
Use this skill for ANY web research task — looking up companies, finding people, searching for code examples or API docs, reading tech blogs, finding academic papers, checking SEC filings or financial reports, or gauging social media sentiment. Covers any question that requires searching the internet for current information. Exa provides neural/semantic search that returns higher-quality, better-structured results than simple keyword search. Load this skill whenever the user asks you to search, research, find, look up, or investigate anything online — even if you think you can handle it with built-in search tools, this skill will produce significantly better results.
10git-rebase-workflow
Git Rebase 分支同步流程,用于将当前功能分支 rebase 到最新的目标分支(如 master/main),保持提交历史整洁。适用于功能分支落后于目标分支时,需要同步最新代码的场景。
8code-review-uncommitted
对 git 中未提交的代码变更进行多维度 code review,包括项目规范合规性、Bug 扫描、代码注释合规性、组件封装/架构设计合理性审查,并通过置信度评分过滤误报。当用户要求 review 未提交的代码、review 当前改动、或使用 /code-review-uncommitted 时触发。
8reflect-and-remember
|
4codex-cli
Delegate tasks to the local OpenAI Codex CLI (`codex exec`, `codex review`, `codex cloud exec`). Use this skill whenever the user asks to run Codex, delegate a task to Codex, use OpenAI's agent, do a Codex review, or mentions 'codex' in any form — including phrases like '用 codex 跑一下', '让 codex 帮忙', 'run this with codex', 'codex exec', 'codex review', 'send to codex cloud'. Also trigger when the user wants a second opinion from another AI agent on code changes, or wants to run a task in a sandboxed OpenAI environment.
1