claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[FEATURE] Make `allowed-tools` wildcards in Skills work with `pwsh`

Open Dennis-Renz opened this issue 1 year ago • 1 comments

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

I want to be able to write skills that

  • Are supplied together with a powershell script (e.g. my-skill/scripts/my-script.ps1) or are using a powershell commandlet
  • Dynamically pass arguments to these scripts (e.g. the name of a directory or branch to create)
  • Don't require user interaction, i.e. the script usages are approved via allowed-tools

This is currently not possible, I have tried several options and none worked. Notably, it is possible if the scripts use bash.

Proposed Solution

Ideally, this just works, as it is consistent with how allowed tools are specified for bash scripts:

allowed-tools: Bash(New-Item:*), Bash(pwsh -Command "New-Item:*)

An interesting solution was proposed by Copilot Auto-Complete: Maybe something like this would be nice UX:

allowed-tools: PowerShell(New-Item:*)

Alternative Solutions

A workaround that works is to use bash scripts instead.

Priority

Medium - Would be very helpful

Feature Category

Configuration and settings

Use Case Example

Creating a Directory

Powershell

This is a test skill that creates a directory using New-Item. There aren't any dynamic arguments involved here so it would be possible to allow this by putting the exact invocation Bash(pwsh -Command "New-Item -Path test -ItemType Directory") inside allowed-tools, but it's to illustrate the point. There's an example with dynamic arguments down below.

---
name: pwsh-new-item
description: Test skill to debug how to allow script execution in a skill. Use only when prompted to do so.
allowed-tools: Bash(New-Item:*), Bash(pwsh -Command "New-Item:*)
---

# Test Script Execution

## Instructions

Run the following

```bash
New-Item -Path test -ItemType Directory
```

Trying to run this results in a requested confirmation:

Image

Bash

We can easily do the same in bash, without having to specify the full command:

---
name: bash-mkdir
description: Test skill to debug how to allow script execution in a skill. Use only when prompted to do so.
allowed-tools: Bash(mkdir:*)
---

# Test Script Execution

## Instructions

Run the following

```bash
mkdir test
```
Image

Passing dynamic arguments

PowerShell

This is where our use case originated from, here's a demo:

---
name: pwsh-greeting
description: Test skill to debug how to allow script execution in a skill. Use only when prompted to do so.
allowed-tools: Bash(pwsh ~/.claude/skills/pwsh-greeting/scripts/greeter.ps1:*), Bash(pwsh "C:\Users\dennis.renz\.claude\skills\pwsh-greeting\scripts\greeter.ps1":*)
---

# Test Script Execution

## Instructions

Run the following

```console
~/.claude/skills/pwsh-greeting/scripts/greeter.ps1 -Name "Claude"
```

With the accompanying script at scripts/greeter.ps1:

param(
    [Parameter(Mandatory=$true)]
    [string]$Name
)

Write-Output "Hello, $Name! Welcome!"
Image

Bash

Again, this is easily doable in bash:

---
name: bash-greeting
description: Test skill to debug how to allow script execution in a skill. Use only when prompted to do so.
allowed-tools: Bash(~/.claude/skills/bash-greeting/scripts/greeter.sh:*), Bash("C:\Users\dennis.renz\.claude\skills\bash-greeting\scripts\greeter.sh":*)
---

# Test Script Execution

## Instructions

Run the following

```console
~/.claude/skills/bash-greeting/scripts/greeter.sh --name "Claude"
```

with the accompanying scripts/greeter.sh:

#!/bin/bash

Name=""

while [[ $# -gt 0 ]]; do
    case $1 in
        --name)
            Name="$2"
            shift 2
            ;;
        *)
            echo "Error: Unknown option $1"
            echo "Usage: $0 --name <Name>"
            exit 1
            ;;
    esac
done

if [ -z "$Name" ]; then
    echo "Error: --name parameter is required"
    echo "Usage: $0 --name <Name>"
    exit 1
fi

echo "Hello, $Name! Welcome!"

This works just fine:

Image

Additional Context

No response

Dennis-Renz avatar Nov 10 '25 16:11 Dennis-Renz

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

github-actions[bot] avatar Dec 11 '25 10:12 github-actions[bot]

I have not seen any indication that this has been fixed.

Dennis-Renz avatar Dec 16 '25 06:12 Dennis-Renz