Skill/command documentation examples using `!`cmd`` syntax are live-executed on load
Summary
Loading a skill (or slash command) whose Markdown body contains the literal bash-execution
syntax ` !command ` — used purely as a documentation example of that syntax, not as an
actual instruction — causes the harness to execute it as a real command.
Repro
- Invoke the built-in
plugin-dev:command-developmentskill (ships with the official
claude-plugins-official marketplace, plugin-dev plugin).
- Its
SKILL.mdand severalreferences/*.mdfiles illustrate the frontmatter bash-execution
feature with lines like:
``npm test $1
Run tests: !``
intended purely as documentation of the syntax for someone authoring a different command.
- On load, the harness parses `
!npm test $1` and executes it for real in the current
working directory.
Observed impact
In a non-Node working directory (a git worktree with no package.json), this produced a real,
user-visible shell error:
npm error code ENOENT
npm error path .../package.json
The user had done nothing to trigger npm test — it fired purely from loading the skill's own
documentation.
Why this is surprising
Slash-command authors reasonably expect that showing ` !cmd as a *quoted example* insiderm -rf /` in a code sample without it running.
prose (e.g. inside a fenced code block, or after "Run tests:") is inert — the same way a
markdown file can safely contain the literal text
Instead, execution appears to trigger on any occurrence of the pattern in loaded content,
regardless of whether it's inside a fenced code block, a quoted example, or genuine live command
substitution in a real command file.
Suggested fix
Only treat ` !... ` as live command substitution when it appears in a slash-command
definition file being invoked as a command (not in arbitrary loaded skill reference/doc
content), and/or never execute it when it appears inside a fenced code block.
Evidence
- Files containing the pattern as documentation (not live commands), e.g.:
plugins/cache/claude-plugins-official/plugin-dev/*/skills/command-development/SKILL.md:492.../references/advanced-workflows.md:115,154,531.../references/documentation-patterns.md:168.../examples/simple-commands.md:100
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗