最後更新: 2026-11-21
你會完成什麼
做完這篇,你的 Claude Code 會多一個已安裝的技能(skill)和一個已設定好的 MCP 伺服器,而且你知道它們的檔案各放在哪個資料夾、之後怎麼檢查與移除。
這篇是 Claude Code 教學裡「安裝」這一段。我們不教怎麼安裝 Claude Code 本身,請照 Anthropic 官方文件完成,再回來這裡。
下面所有指令,都是 2026-11-20 用已發布的 SourceWeft 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(來源儲存庫與確切版本)、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 的目錄裡有許多 MCP 伺服器,每一個都有一個識別名稱(例如 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(給 Cursor 用就加 --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 設定。如果你要把它放進版本控制,請確認裡面只有網址和環境變數名稱,沒有任何金鑰。
第 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 裡進行。
更多尋找技能的管道,見哪裡找智慧體技能、怎麼安裝。