[BUG]
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When a skill uses dynamic context (! backtick syntax) with bash commands containing [ -d ... ] test operators and &&/|| chaining, the permission check fails with an error instead of prompting the user to approve the command.
Example skill content:
<context>
Prompts directory: !`[ -d ./.prompts ] && echo "exists" || echo "missing"`
</context>
Error received:
Error: Bash command permission check failed for pattern "!`[ -d ./.prompts ] && echo "exists" || echo "missing"`":
This Bash command contains multiple operations. The following part requires approval: [ -d ./.prompts ]
The skill fails to load entirely rather than prompting the user to approve the bash command.
What Should Happen?
Claude Code should prompt the user to approve the bash command, similar to how it handles other bash commands that require permission. The user should see the command and be given the option to approve or deny it, rather than the skill failing to load entirely.
Error Messages/Logs
Error: Bash command permission check failed for pattern "!`[ -d ./.prompts ] && echo "exists" || echo "missing"`":
This Bash command contains multiple operations. The following part requires approval: [ -d ./.prompts ]
Steps to Reproduce
- Create a skill file (e.g.,
~/.claude/skills/test-skill/SKILL.md) with dynamic context containing bash test operators:
<context>
Directory check: !`[ -d ./somedir ] && echo "exists" || echo "missing"`
</context>
- Run the skill using
/test-skillor invoke it - Instead of prompting for permission, the skill fails with:
- ```
- Error: Bash command permission check failed for pattern...
- ```
Claude Model
None
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.5 (Claude Code)
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
PowerShell
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗