A Claude Code skill sets allowed-tools: Bash(gh *) in its frontmatter — what does that grant, for how long, and what does it not do?
answer
- pre-approval, not a fence
- scoped to the invoking turn
- content stays, grant does not
- deny and ask still win
- trust does not gate it
basics
~20 sIt pre-approves matching gh commands only during the turn that invokes the skill; the grant clears at your next message. It restricts no other tool, deny and ask rules still win, and workspace trust does not gate it.
solid answer
~40 s`allowed-tools` is a **pre-approval**, not a restriction. During the turn that invokes the skill, tools matching the listed rules run without asking; every other tool stays callable under your normal permission settings. The grant clears when you send your next message, even though the skill's content stays in the conversation, and invoking the skill again re-applies it. Deny and ask rules still override it. To remove tools while a skill is active, use `disallowed-tools`; for a session-wide grant, write allow rules in settings. Workspace trust never gates the field, so a repository skill can pre-approve broad commands even in a `-p` run in an untrusted folder; review it like code. Since v2.1.282, managed `allowManagedPermissionRulesOnly` makes Claude Code ignore `allowed-tools` in repository, personal and `--add-dir` skills.
code
yaml · 11 lines---
name: fix-issue
description: Fix a GitHub issue by number
disable-model-invocation: true
allowed-tools:
- Bash(gh issue view *)
- Bash(npm test *)
disallowed-tools: AskUserQuestion
---
Read issue $0 with gh issue view, fix it, and run npm test.go deeper
Recall that allowed-tools lets a skill's listed tools run without a prompt while the skill runs.
Explain that the grant is per turn, clears at your next message, restricts nothing, and loses to deny and ask rules.
Show you treat repository skills' grants as a review item, since trust does not gate them, and know the managed lock that ignores them from v2.1.282.
Weigh letting teams ship skills that pre-approve tools against forcing all approvals through managed rules, and where that line sits for repositories you do not control.
## What the field is In Claude Code, a skill's `allowed-tools` frontmatter lists **permission rules that are pre-approved while the skill runs**. It accepts a space- or comma-separated string, or a YAML list, using the same rule forms as permission settings: `Read`, `Grep`, `Bash(gh *)`, `Bash(git commit *)`. With `allowed-tools: Bash(gh *)`, Claude can run `gh issue view 123` during that skill's turn without stopping to ask you. It is the skill's **grant**, and the important word is grant. It adds approvals; it takes nothing away. ## How long it lasts - The grant applies to **the turn that invokes the skill**. - It **clears when you send your next message**. The docs are explicit that this holds even though the skill's content stays in the conversation across turns. - **Invoking the skill again re-applies it** for that new turn. - For an approval that lasts the whole session, write allow rules in your permission settings instead. The common surprise follows from this: three turns later Claude is still following the skill's instructions, yet `gh` prompts again, because the instructions persisted and the permission did not. ## What it does not do | Mechanism | Effect | Lasts | |---|---|---| | `allowed-tools` | Pre-approves the listed tools; restricts nothing | The invoking turn | | `disallowed-tools` | Removes the listed tools from Claude's pool while the skill is active | Until your next message | | Allow rules in settings | Pre-approve for every prompt | The session and beyond | | Deny rules in settings | Block the tool whatever a skill grants | Always | - **No restriction.** With `allowed-tools: Read Grep`, Claude can still call Bash or Edit; those calls go through your normal permission settings. To stop a background-loop skill from calling `AskUserQuestion`, use `disallowed-tools`. - **No override of deny or ask.** Deny and ask rules still win over `allowed-tools`. How rules at different scopes combine belongs to the permission-rule material. - **No effect on unlisted tools.** Only what the rules match is pre-approved. ## Trust and review Workspace trust **never gates** a skill's `allowed-tools`. Claude Code applies a project skill's grant even in a `-p` run in a folder you have never trusted. A skill checked into a repository can therefore pre-approve something broad, such as `Bash(curl *)`, for whatever turn invokes it, and Claude can invoke it on its own when its description matches unless the skill sets `disable-model-invocation: true`. Read the `allowed-tools` of repository skills before running Claude Code in an unfamiliar repository, the same way you would read its build scripts. ## Locking it down for an organisation From **v2.1.282**, when managed settings set `allowManagedPermissionRulesOnly`, Claude Code **ignores `allowed-tools`** in: 1. skills and `.claude/commands/` files in a repository's `.claude/` directory; 2. your `~/.claude/skills/` and `~/.claude/commands/`, including skills synced from claude.ai; 3. skills from an `--add-dir` directory, and skills-directory plugins inside those folders. Skills from managed settings and bundled skills keep their grants, and a skill's `disallowed-tools` still applies. The tools an affected skill lists go through the managed rules and the normal prompt instead, and `/status` lists each skill whose `allowed-tools` was ignored so far in the session. ## Reviewing a repository skill's grant Before running Claude Code in a repository you did not write, read each skill's frontmatter with these questions: 1. **How broad is each rule?** A bare tool name such as `Bash` matches every Bash command, while `Bash(gh issue view *)` matches one family. 2. **Can Claude start the skill itself?** Without `disable-model-invocation: true`, a matching description is enough for Claude to invoke it, and the grant comes with it. 3. **Does the body run shell before Claude even reads it?** Injected `` !`command` `` lines are checked against your rules, and listing them in `allowed-tools` is what pre-approves them. 4. **Does the skill register `hooks`?** That frontmatter field keeps hooks running for the rest of the session, which outlasts the one-turn grant. ## Matching a bundled script exactly `${CLAUDE_SKILL_DIR}` and `${CLAUDE_PROJECT_DIR}` are substituted in both the skill body and its `allowed-tools` Bash rules. Writing `Bash(${CLAUDE_SKILL_DIR}/scripts/report.sh *)` in the grant and the same path in the body lets the skill run its own script without a prompt, and nothing broader.
- Three turns after /fix-issue ran, Claude is still following the skill but gh asks for permission again. Why?The skill's content persists in the conversation, but its `allowed-tools` grant cleared when you sent your next message. Invoke the skill again to re-apply the grant for that turn, or add an allow rule in settings if the approval should last the whole session.
- How does an organisation stop repository skills from pre-approving their own tools?Set `allowManagedPermissionRulesOnly` in managed settings. From v2.1.282 Claude Code then ignores `allowed-tools` in repository, personal and `--add-dir` skills; managed and bundled skills keep theirs. The listed tools fall back to managed rules and the normal prompt, and `/status` shows which skills were affected.
- A long-running skill should never stop to ask the user a question. Which field fits, and why not allowed-tools?`disallowed-tools: AskUserQuestion`, which removes the tool from Claude's pool while the skill is active. `allowed-tools` cannot help: it only pre-approves the tools it lists and never restricts the others.
- allowed-tools limits the skill to only the tools it lists.
- The grant lasts as long as the skill's content stays in context.
- A skill's allowed-tools overrides a deny rule for the listed tool.
- An untrusted repository's skills cannot pre-approve anything until you accept the trust dialog.
- allowed-tools only matters to the skill's author, so reviewers can skip it.
Assumes Claude Code 2.1.286; managed allowManagedPermissionRulesOnly has ignored repository, personal and --add-dir skills' allowed-tools since v2.1.282.