From pr-workflow
當使用者要求「啟用 subagent」、「配置 subagent 權限」、「enable subagents」、「設定 agent 環境」、「fix subagent permissions」時使用此 skill。幫助使用者配置 Claude Code 環境,確保 pr-review-resolver 等 skill 使用的 subagent 不會遇到權限問題。
How this skill is triggered — by the user, by Claude, or both
Slash command
/pr-workflow:enable-subagentsThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
幫助使用者配置 Claude Code 環境,讓 subagent 可以正常執行需要的操作。
幫助使用者配置 Claude Code 環境,讓 subagent 可以正常執行需要的操作。
重要原則:
當需要:
pr-review-resolver 等 skill 會啟動 subagent 來執行任務。Subagent 需要以下權限:
| 權限 | 用途 |
|---|---|
Read | 讀取原始碼驗證問題 |
Edit | 修復問題時修改檔案 |
Write | 寫入檔案(修復問題時建立或修改檔案) |
Glob | 搜尋檔案路徑 |
Grep | 搜尋檔案內容 |
Task | 啟動背景子任務 |
Bash(mkdir *) | 建立必要目錄 |
Bash(git *) | 執行 git 指令(如 git diff) |
Bash(${CLAUDE_PLUGIN_ROOT}/scripts/*) | 執行 plugin scripts |
當這些操作在 subagent 中執行時,需要父會話已經有對應權限,否則會被阻擋。
使用 AskUserQuestion 詢問使用者偏好的配置層級:
請選擇要配置權限的層級:
**User-level** (`~/.claude/settings.json`)
- 套用到所有專案
- 適合經常使用 pr-review-toolkit 的使用者
**Project-level** (`.claude/settings.json`)
- 只影響當前專案
- 適合想要限制權限範圍的使用者
- 可加入版本控制讓團隊共享
<options>
<option>User-level(套用到所有專案)</option>
<option>Project-level(只影響當前專案)</option>
</options>
根據使用者選擇的層級,讀取對應的 settings.json:
~/.claude/settings.json.claude/settings.json如果檔案不存在,準備建立新檔案。
解析現有的 permissions.allow 陣列(如果存在)。
需要配置的權限清單:
[
"Read",
"Edit",
"Write",
"Glob",
"Grep",
"Task",
"Bash(mkdir *)",
"Bash(git *)",
"Bash(${CLAUDE_PLUGIN_ROOT}/scripts/*)"
]
比對現有配置,列出缺少的權限。
向使用者說明:
如果已全部配置:告知使用者權限已完整,不需要任何變更,然後結束。
如果有缺少的權限:
範例說明格式:
目前缺少以下權限:
1. `Read` - 讓 subagent 可以讀取原始碼檔案驗證問題
2. `Write` - 讓 subagent 可以寫入臨時檔案
更新後的配置將是:
{
"permissions": {
"allow": [
"Read",
"Edit",
"Write",
"Glob",
"Grep",
"Task",
"Bash(mkdir *)",
"Bash(git *)",
"Bash(${CLAUDE_PLUGIN_ROOT}/scripts/*)"
]
}
}
<options>
<option>確認更新配置</option>
<option>取消</option>
</options>
使用者確認後:
建立目錄(如需要):
~/.claude/ 存在.claude/ 存在合併配置:
permissions.allow 中缺少的項目寫入配置:
{
"permissions": {
"allow": [
"Read",
"Edit",
"Write",
"Glob",
"Grep",
"Task",
"Bash(mkdir *)",
"Bash(git *)",
"Bash(${CLAUDE_PLUGIN_ROOT}/scripts/*)"
]
}
}
假設現有配置:
{
"theme": "dark",
"permissions": {
"allow": [
"Read",
"Bash(git *)"
]
}
}
更新後:
{
"theme": "dark",
"permissions": {
"allow": [
"Read",
"Bash(git *)",
"Edit",
"Write",
"Glob",
"Grep",
"Task",
"Bash(mkdir *)",
"Bash(${CLAUDE_PLUGIN_ROOT}/scripts/*)"
]
}
}
完成配置前確認:
配置完成後,建議使用者:
/pr-review-resolver 測試 subagent 是否正常運作成功指標:
npx claudepluginhub marxbiotech/pr-review-toolkit --plugin pr-workflowGuides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.