$npx -y skills add vinta/hal-9000 --skill update-allowed-toolsUse when creating or editing a skill that uses Bash commands, external tools, or skill invocations and the allowed-tools frontmatter may be incomplete
| 1 | # Overview |
| 2 | |
| 3 | 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 `allowed-tools` frontmatter to find missing entries. |
| 4 | |
| 5 | ## Usage |
| 6 | |
| 7 | ``` |
| 8 | /update-allowed-tools <skill name> |
| 9 | /update-allowed-tools @path/to/SKILL.md |
| 10 | ``` |
| 11 | |
| 12 | ## Instructions |
| 13 | |
| 14 | 1. **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., `**/skills/**/<name>/SKILL.md`), then in `~/.claude/skills/**/<name>/SKILL.md`. |
| 15 | |
| 16 | 2. **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). |
| 17 | |
| 18 | 3. **Extract declared allowed-tools**: Parse all entries under `allowed-tools:` in the frontmatter. |
| 19 | |
| 20 | 4. **Scan all skill content** (SKILL.md body + sibling files) for tool usage. Look for: |
| 21 | - Explicit tool names: e.g., `Read`, `Write`, `Edit`, `Bash`, `WebFetch`, `WebSearch`, `Task`, `AskUserQuestion`, `Skill`, etc. |
| 22 | - Bash command patterns: e.g., `git diff`, `git commit`, `make`, `npm`, `docker`, `python`, `curl`, etc. |
| 23 | - For Bash commands found, the required allowed-tool format is `Bash(<command>:*)` (e.g., `git stash push` needs `Bash(git stash:*)`) |
| 24 | - For file tools with path patterns (Read, Write, Edit), note the paths referenced (e.g., `/tmp/` needs `Read(//tmp/**)`) |
| 25 | - Skill invocations: e.g., `commit`, `Use the commit skill`, `Skill(commit)`. The required allowed-tool format is `Skill(<name>)` (e.g., `commit` needs `Skill(commit)`) |
| 26 | |
| 27 | 5. **Compare**: For each tool detected in the body, check if it's covered by an entry in `allowed-tools`. Rules: |
| 28 | - `Glob`, `Grep`, and `Read` are permission-free within the project directory. Only add read rules for files **outside** the project (e.g., `Read(//tmp/**)`). |
| 29 | - `Write` and `Edit` prompt for approval by default, inside the project too. `allowed-tools` grants permission rather than restricting tools, so add entries scoped to the paths the skill is meant to modify (e.g., `Edit(CLAUDE.md)`, `Write(~/.config/**)`). |
| 30 | - `Bash` commands always need explicit `Bash(<command>:*)` entries. |
| 31 | - A Bash pattern covers subcommands (e.g., `Bash(git stash:*)` covers `git stash push`). |
| 32 | - Exact match counts as covered (e.g., `WebSearch` matches `WebSearch`). |
| 33 | |
| 34 | 6. **Update the skill file**: For any missing tools found, add them to the `allowed-tools` list in the skill's YAML frontmatter using the Edit tool. Then report what was added. |
| 35 | |
| 36 | 7. **Validate**: Re-read the updated file to confirm YAML frontmatter remains syntactically valid (proper indentation, no duplicate entries, correct list format). |