update-allowed-tools
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseOverview
概述
Analyzes a skill's full content -- SKILL.md and any sibling files in the same directory -- to find tools it references or requires, then compares against the skill's frontmatter to find missing entries.
allowed-tools分析技能的完整内容——SKILL.md文件及其所在目录中的所有同级文件——以查找其引用或需要的工具,然后与技能的前置元数据进行对比,找出缺失的条目。
allowed-toolsUsage
使用方法
/update-allowed-tools <skill name>
/update-allowed-tools @path/to/SKILL.md/update-allowed-tools <技能名称>
/update-allowed-tools @path/to/SKILL.mdInstructions
操作步骤
-
Parse argument: The argument is either a file path to a SKILL.md file, or a skill name/description. If no file path is provided, search for the skill using Glob — first in the current working directory (e.g.,), then in
**/skills/**/<name>/SKILL.md.~/.claude/skills/**/<name>/SKILL.md -
Read the skill file and separate the YAML frontmatter from the body content. Also read any other files in the same directory (sibling files referenced by or bundled with the skill).
-
Extract declared allowed-tools: Parse all entries underin the frontmatter.
allowed-tools: -
Scan all skill content (SKILL.md body + sibling files) for tool usage. Look for:
- Explicit tool names: e.g., ,
Read,Write,Edit,Bash,WebFetch,WebSearch,Task,AskUserQuestion, etc.Skill - Bash command patterns: e.g., ,
git diff,git commit,make,npm,docker,python, etc.curl - For Bash commands found, the required allowed-tool format is (e.g.,
Bash(<command>:*)needsgit stash push)Bash(git stash:*) - For file tools with path patterns (Read, Write, Edit), note the paths referenced (e.g., needs
/tmp/)Read(//tmp/**) - Skill invocations: e.g., ,
/commit,Use the /commit skill. The required allowed-tool format isSkill(commit)(e.g.,Skill(<name>)needs/commit)Skill(commit)
- Explicit tool names: e.g.,
-
Compare: For each tool detected in the body, check if it's covered by an entry in. Rules:
allowed-tools- ,
Glob,Grep,Read,Writeare available by default for files within the project directory. Only add these when the skill needs to access files outside the project (e.g.,Edit,Read(//tmp/**)).Write(~/.config/**) - commands always need explicit
Bashentries.Bash(<command>:*) - A Bash pattern covers subcommands (e.g., covers
Bash(git stash:*)).git stash push - Exact match counts as covered (e.g., matches
WebSearch).WebSearch
-
Update the skill file: For any missing tools found, add them to thelist in the skill's YAML frontmatter using the Edit tool. Then report what was added.
allowed-tools -
Validate: Re-read the updated file to confirm YAML frontmatter remains syntactically valid (proper indentation, no duplicate entries, correct list format).
-
解析参数:参数可以是SKILL.md文件的路径,也可以是技能名称/描述。如果未提供文件路径,则使用Glob搜索技能——首先在当前工作目录中搜索(例如:),然后在
**/skills/**/<名称>/SKILL.md中搜索。~/.claude/skills/**/<名称>/SKILL.md -
读取技能文件,将YAML前置元数据与正文内容分离。同时读取该目录中的其他所有文件(技能引用或捆绑的同级文件)。
-
提取已声明的allowed-tools:解析前置元数据中下的所有条目。
allowed-tools: -
扫描所有技能内容(SKILL.md正文 + 同级文件)以查找工具使用情况。需查找:
- 明确的工具名称:例如、
Read、Write、Edit、Bash、WebFetch、WebSearch、Task、AskUserQuestion等。Skill - Bash命令模式:例如、
git diff、git commit、make、npm、docker、python等。curl - 对于找到的Bash命令,所需的allowed-tools格式为(例如:
Bash(<command>:*)需要git stash push)Bash(git stash:*) - 对于带有路径模式的文件工具(Read、Write、Edit),记录引用的路径(例如:需要
/tmp/)Read(//tmp/**) - 技能调用:例如、
/commit、Use the /commit skill。所需的allowed-tools格式为Skill(commit)(例如:Skill(<name>)需要/commit)Skill(commit)
- 明确的工具名称:例如
-
对比:对于在正文中检测到的每个工具,检查它是否被allowed-tools中的条目覆盖。规则如下:
- 、
Glob、Grep、Read、Write默认可用于项目目录内的文件。仅当技能需要访问项目外部的文件时才添加这些工具(例如:Edit、Read(//tmp/**))。Write(~/.config/**) - Bash命令始终需要显式的条目。
Bash(<command>:*) - 一个Bash模式涵盖其子命令(例如:涵盖
Bash(git stash:*))。git stash push - 完全匹配即视为已覆盖(例如:匹配
WebSearch)。WebSearch
-
更新技能文件:对于找到的所有缺失工具,使用Edit工具将其添加到技能YAML前置元数据的列表中。然后报告添加的内容。
allowed-tools -
验证:重新读取更新后的文件,确认YAML前置元数据在语法上仍然有效(正确的缩进、无重复条目、正确的列表格式)。