You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Skill loading executes inline bash patterns from documentation examples #12781
When loading a skill via the Skill tool, inline bash execution patterns (!`...`) within the skill's markdown content are being executed, even when they appear inside fenced code blocks as documentation examples.
Steps to Reproduce
Create or use a skill that contains example command documentation with inline bash patterns
Load the skill using the Skill tool
Observe that bash patterns in code examples are executed
Example
The plugin-dev:command-development skill contains this documentation example in SKILL.md at line 496:
When this skill is loaded, the !`gh pr view $1` pattern executes despite being:
Inside a fenced code block (meant as documentation)
Containing an unsubstituted $1 placeholder
Actual Behavior
Error: Bash command failed for pattern "!`gh pr view $1`": [stderr]
no pull requests found for branch "main"
The skill partially loads but errors because the example bash pattern executed.
Expected Behavior
Inline bash patterns (!`...`) inside fenced code blocks should NOT be executed when loading skills. They are documentation examples, not executable instructions.
Still occurring as of v2.x (Dec 2025). The command-development skill hits multiple patterns during activation:
Error: Bash command failed for pattern "!npm test $1"
Error: Bash command failed for pattern "!bash ${CLAUDE_PLUGIN_ROOT}/scripts/script.sh"
This creates a catch-22 for skill authors: skills teaching command syntax cannot show the real !cmd pattern without triggering execution. Escaping the examples would cause LLMs to learn incorrect syntax from the skill's own documentation.
The parser should respect markdown code fence boundaries when scanning for executable patterns.
Workaround: Use [BANG] placeholder in skill documentation
For plugin developers experiencing this issue with skill files, here's a workaround:
Problem: Skill files containing ! followed by backticks (the pre-execution syntax for slash commands) trigger bash execution errors when the skill content is loaded into Claude's context.
Solution: Replace ! with a placeholder like [BANG] in your skill documentation:
# Instead of this (causes execution errors):
Current branch: !`git branch --show-current`# Use this:
Current branch: [BANG]`git branch --show-current`
When Claude explains the concept to users, it correctly interprets and renders the actual ! syntax they should use in their command files.
Thanks - I was going to raise this but see you've done so already. The state of the official plugins are shocking eh, so many errors. Tangentially related:
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.
Still hitting this as of 2026-03. Here's some additional context from my experience that may be useful:
How I encountered it
I customized the skill-creator plugin's SKILL.md to document the Dynamic Context Injection feature, including examples like !gh pr diff`` inside fenced code blocks. Then I copied the modified skill to ~/.claude/skills/skill-creator/ as a personal skill.
Since personal skills take priority over plugin skills, every invocation of /skill-creator loaded my version — which executed the documentation examples as real shell commands.
What made debugging difficult
The error message gives no indication of which file caused the failure:
Shell command failed for pattern "!`command`": [stderr]
(eval):1: redirection with no command
It took a long investigation (checking hooks, OMC plugin scripts, plugin cache states) before tracing it back to ~/.claude/skills/skill-creator/SKILL.md. Including the file path and line number in the error message would have made this a 1-minute fix instead of a multi-hour debug session.
Additional finding: String Substitution also affected
Beyond the !command`` issue, $ARGUMENTS, `${CLAUDE_SKILL_DIR}`, `$0`, `$1` etc. are also substituted inside code blocks. When trying to document these variables as examples, they get replaced with actual values (empty strings, session IDs, directory paths). This makes it impossible to show the intended syntax in documentation.
Suggested priorities
Skip preprocessing inside fenced code blocks — both !command`` execution and $VARIABLE substitution
Include file path + line number in error messages — this alone would save significant debugging time
Provide an escape mechanism (e.g., \!command``) for cases outside code blocks
Skill authors can document advanced features. Currently there is no safe way to show examples of Dynamic Context Injection or String Substitution syntax within a SKILL.md. Code blocks — the standard markdown convention for showing syntax examples — would become safe zones.
The official skill-creator plugin can be more complete. The plugin's SKILL.md currently omits documentation for Dynamic Context Injection entirely — likely because including examples would trigger this exact issue. Fixing this would unblock the official tooling from being self-documenting.
Accidental command execution is structurally prevented. Code blocks are universally understood as inert documentation. Making them a preprocessing-free zone eliminates an entire class of user errors rather than relying on workarounds like [BANG] placeholders.
Debugging time drops from hours to seconds. Adding file path and line number to the error message turns "which of my 50+ skills caused this?" into an immediate answer.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.
Activity
alexfazio commentedon Dec 12, 2025
Still occurring as of v2.x (Dec 2025). The command-development skill hits multiple patterns during activation:
Error: Bash command failed for pattern "!
npm test $1"Error: Bash command failed for pattern "!
bash ${CLAUDE_PLUGIN_ROOT}/scripts/script.sh"This creates a catch-22 for skill authors: skills teaching command syntax cannot show the real !
cmdpattern without triggering execution. Escaping the examples would cause LLMs to learn incorrect syntax from the skill's own documentation.The parser should respect markdown code fence boundaries when scanning for executable patterns.
sjnims commentedon Dec 12, 2025
Workaround: Use
[BANG]placeholder in skill documentationFor plugin developers experiencing this issue with skill files, here's a workaround:
Problem: Skill files containing
!followed by backticks (the pre-execution syntax for slash commands) trigger bash execution errors when the skill content is loaded into Claude's context.Solution: Replace
!with a placeholder like[BANG]in your skill documentation:When Claude explains the concept to users, it correctly interprets and renders the actual
!syntax they should use in their command files.Example PR: https://github.com/sjnims/plugin-dev/pull/142
kylesnowschwartz commentedon Dec 16, 2025
Thanks - I was going to raise this but see you've done so already. The state of the official plugins are shocking eh, so many errors. Tangentially related:
github-actions commentedon Jan 15, 2026
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.
sjnims commentedon Jan 15, 2026
Yes still happening
fix(plugin-dev): use [BANG] placeholder to prevent bash execution in …
technomensch commentedon Feb 20, 2026
still happening - #97
sjnims commentedon Feb 20, 2026
@github-actions this isn’t a stale issue, Anthropic just hasn’t gotten to it yet…
@claude take a look
psh4607 commentedon Mar 27, 2026
Still hitting this as of 2026-03. Here's some additional context from my experience that may be useful:
How I encountered it
I customized the
skill-creatorplugin's SKILL.md to document the Dynamic Context Injection feature, including examples like!gh pr diff`` inside fenced code blocks. Then I copied the modified skill to~/.claude/skills/skill-creator/as a personal skill.Since personal skills take priority over plugin skills, every invocation of
/skill-creatorloaded my version — which executed the documentation examples as real shell commands.What made debugging difficult
The error message gives no indication of which file caused the failure:
It took a long investigation (checking hooks, OMC plugin scripts, plugin cache states) before tracing it back to
~/.claude/skills/skill-creator/SKILL.md. Including the file path and line number in the error message would have made this a 1-minute fix instead of a multi-hour debug session.Additional finding: String Substitution also affected
Beyond the
!command`` issue,$ARGUMENTS, `${CLAUDE_SKILL_DIR}`, `$0`, `$1` etc. are also substituted inside code blocks. When trying to document these variables as examples, they get replaced with actual values (empty strings, session IDs, directory paths). This makes it impossible to show the intended syntax in documentation.Suggested priorities
!command`` execution and$VARIABLEsubstitution\!command``) for cases outside code blockspsh4607 commentedon Mar 27, 2026
Expected impact if fixed
Skill authors can document advanced features. Currently there is no safe way to show examples of Dynamic Context Injection or String Substitution syntax within a SKILL.md. Code blocks — the standard markdown convention for showing syntax examples — would become safe zones.
The official
skill-creatorplugin can be more complete. The plugin's SKILL.md currently omits documentation for Dynamic Context Injection entirely — likely because including examples would trigger this exact issue. Fixing this would unblock the official tooling from being self-documenting.Accidental command execution is structurally prevented. Code blocks are universally understood as inert documentation. Making them a preprocessing-free zone eliminates an entire class of user errors rather than relying on workarounds like
[BANG]placeholders.Debugging time drops from hours to seconds. Adding file path and line number to the error message turns "which of my 50+ skills caused this?" into an immediate answer.
github-actions commentedon Apr 27, 2026
Closing for now — inactive for too long. Please open a new issue if this is still relevant.
github-actions commentedon May 8, 2026
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.