最后更新: 2026-11-21
你将完成什么
你的 Claude Code 会多一个已安装的技能和一个配置好的 MCP 服务器,并且知道它们的文件放在哪个文件夹、以后怎样检查和移除。
这篇教程只讲安装这一步。我们不讲怎样安装 Claude Code 本身,请按 Anthropic 官方文档完成,再回来。
下面所有命令,都是 2026-11-20 用已发布的 CLI 0.3.0 版在一个全新的空文件夹里运行的。你需要 Node.js 和终端,不需要 SourceWeft 账号。
一分钟分清技能和 MCP 服务器
- **技能(skill)**是一个带
SKILL.md的文件夹,告诉 Claude 某类任务该怎么做。它也可能带脚本,脚本会在你的机器上运行。 - MCP 服务器是让 Claude 调用外部工具的服务,比如搜索 Notion。一条配置把它连到 Claude Code。
怎样取舍见MCP 服务器与智能体技能的区别。这篇只讲安装。
第 1 步:搜索技能
npx @sourceweft/cli skills search "frontend design" --limit 5
每行是安装名称和简短描述;技能带脚本时会有 scripts 标记。我们得到的部分结果:
@anthropics/frontend-design-skills Guidance for distinctive, intentional visual design when building new…
@vercel-labs/frontend-design-open-agents Create distinctive, production-grade frontend interfaces with high de…
安装名称(比如 @anthropics/frontend-design-skills)就是其他命令的参数。
第 2 步:安装前先看详情
npx @sourceweft/cli skills info @anthropics/frontend-design-skills
Version: 34040c9c5685
License: Complete terms in LICENSE.txt
Source: https://github.com/anthropics/skills/tree/34040c9c568585f6929bedeaad110ad08f079624/skills/frontend-design
Trust: Featured — a featured publisher, not reviewed by a SourceWeft admin (files are still hash-checked)
Files: 2
重点看三项:Source(仓库和确切 commit)、License(许可证),以及有没有 Scripts: yes 这一行(有就表示技能包含可执行文件)。扫描标记怎么读,见安装智能体技能之前怎么检查。
第 3 步:安装到 Claude Code
npx @sourceweft/cli skills install @anthropics/frontend-design-skills --scope project --yes
Installed @anthropics/frontend-design-skills → …/.claude/skills/frontend-design (claude-code)
两个常用选项:
--scope project:装到当前项目的.claude/skills/。不加的话默认是user,装到~/.claude/skills/,所有项目都能用。--yes:跳过确认。没有它时,CLI 会先打印详情再问你;在非交互式终端里会直接停下并输出Error: Confirmation required. Re-run with --yes to proceed without asking.,什么都不写入。请在读过第 2 步的输出之后再加--yes。
我们看到的文件:
.claude/skills/frontend-design/SKILL.md
.claude/skills/frontend-design/LICENSE.txt
.claude/skills/frontend-design/.sourceweft.json
前两个是技能本身,.sourceweft.json 是 CLI 的记录文件(来源、版本、每个文件的哈希)。CLI 默认为 Claude Code 安装;换其他工具用 --agent,npx @sourceweft/cli skills agents 会列出它们和各自的文件夹。
如果 Claude Code 已经开着,请开一个新会话再使用这个技能。
第 4 步:检查
npx @sourceweft/cli skills list
npx @sourceweft/cli skills doctor
@anthropics/frontend-design-skills 34040c9c5685 claude-code/project …/.claude/skills/frontend-design
OK — 1 installed skill(s), no problems found.
list 显示范围(project 或 user)。doctor 把磁盘上的文件和记录对比;以后想知道技能有没有被改过,再运行它。
第 5 步:配置 MCP 服务器
MCP 配置是一段 JSON。SourceWeft 目录里的每个服务器都有一个标识符,比如 com.notion/mcp。先只打印配置,不写任何文件:
npx @sourceweft/cli mcp install com.notion/mcp --client claude-code
{
"mcpServers": {
"notion": {
"type": "http",
"url": "https://mcp.notion.com/mcp"
}
}
}
This server signs in with OAuth: the config holds no key, and your client opens the server's sign-in the first time it connects (in Claude Code, run /mcp).
最后一行的意思:这个服务器用 OAuth 登录,配置里没有密钥,第一次连接时在 Claude Code 里输入 /mcp 登录。
确认没问题,再加 --write,CLI 会把它合并进当前文件夹的 .mcp.json(用 --client cursor 则写到 .cursor/mcp.json):
npx @sourceweft/cli mcp install com.notion/mcp --client claude-code --write
Created "notion" in …/.mcp.json
我们还验证了:
- 再加第二个服务器,会显示 "Added",已有的
notion配置保持原样。 - 对同一个服务器再运行一次,显示
"notion" is already in …/.mcp.json; nothing changed. - 需要 API 密钥的服务器,CLI 的帮助文字说明:用
--key-env 名称指定环境变量的名称,配置里只引用这个名称,不会写入密钥本身。对不需要密钥或用 OAuth 登录的服务器加这个选项,CLI 会报错,而不是悄悄忽略。
项目根目录的 .mcp.json 是 Claude Code 的项目级 MCP 配置。如果你要把它提交进版本库,先确认里面只有 URL 和环境变量名称,没有任何密钥。
第 6 步:更新和移除
npx @sourceweft/cli skills update --dry-run
npx @sourceweft/cli skills remove gh-anthropics-skills-frontend-design --scope project --yes
--dry-run 只显示更新会做什么,不会真的做。remove 要用 update 输出的名称(这里是 gh-anthropics-skills-frontend-design),不是安装名称;用文件夹名 frontend-design 会得到 not installed by sourceweft here。移除后 list 显示 No skills installed by sourceweft. MCP 服务器则直接编辑 .mcp.json,删掉对应的条目。
常见问题
Claude Code 的技能放在哪里?
单个项目用 .claude/skills/<名称>/,所有项目共用 ~/.claude/skills/<名称>/。每个技能文件夹里要有 SKILL.md。
Claude Code 的 MCP 配置文件在哪?
项目级是项目根目录的 .mcp.json。mcp install … --write 会替你合并进去。
需要 SourceWeft 账号吗? 不需要。这里的命令都是在未登录时运行的。
技能装了没反应怎么办?
用 skills list 和 skills doctor 确认文件在 .claude/skills/ 下,然后开一个新的 Claude Code 会话。
怎么判断一个技能能不能装?
安装前先看 skills info:来源、许可证和扫描标记。这篇文章逐项说明。CLI 的文件校验另有一篇:用 SourceWeft CLI 安装智能体技能。
这个流程不做什么
- 它不替你审查技能或 MCP 服务器。文件和记录一致,不代表内容适合你。
- 它不安装 Claude Code 本身,也不替你完成 MCP 服务器的 OAuth 登录;那一步在 Claude Code 里进行。
更多找技能的途径:去哪里找智能体技能、怎样安装。