From 4b4d1ae2707895d6d4fd2e60a64d83ca50f094a6 Mon Sep 17 00:00:00 2001 From: Vahe Kirakosyan Date: Wed, 11 Mar 2026 11:36:46 +0100 Subject: [PATCH] fix(create-agent-skills): remove literal dynamic context directives that break skill loading MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `create-agent-skills` SKILL.md contained literal `!`command`` dynamic context injection directives as documentation examples. Claude Code's preprocessor executes these directives as plain text before the skill content is sent to the model — it does not parse markdown, so fenced code blocks and inline code spans offer no protection. When loading this skill, the preprocessor attempted to run `command`, `gh pr diff`, and `gh pr diff --name-only` as shell commands, producing: Bash command failed for pattern "!`command`": (eval):1: redirection with no command This caused the skill to fail silently or error on every invocation. Fix: replace the literal directives with a prose description of the syntax, add a warning about the preprocessor behavior, and link to `references/official-spec.md` § "Dynamic Context Injection" for the concrete example (reference files are loaded on-demand by Claude via the Read tool and are not preprocessed). Upstream context: - anthropics/claude-code#27149 (closed, wontfix): preprocessor correctly executes bare text; workaround is to describe the syntax in prose - anthropics/claude-code#28024 (closed as duplicate of #13655) Co-Authored-By: Claude Opus 4.6 --- .../skills/create-agent-skills/SKILL.md | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/plugins/compound-engineering/skills/create-agent-skills/SKILL.md b/plugins/compound-engineering/skills/create-agent-skills/SKILL.md index efcbd1a8..93eb32db 100644 --- a/plugins/compound-engineering/skills/create-agent-skills/SKILL.md +++ b/plugins/compound-engineering/skills/create-agent-skills/SKILL.md @@ -97,22 +97,11 @@ Access individual args: `$ARGUMENTS[0]` or shorthand `$0`, `$1`, `$2`. ### Dynamic Context Injection -The `` !`command` `` syntax runs shell commands before content is sent to Claude: +Skills support dynamic context injection: prefix a backtick-wrapped shell command with an exclamation mark, and the preprocessor executes it at load time, replacing the directive with stdout. Write an exclamation mark immediately before the opening backtick of the command you want executed (for example, to inject the current git branch, write the exclamation mark followed by `git branch --show-current` wrapped in backticks). -```yaml ---- -name: pr-summary -description: Summarize changes in a pull request -context: fork -agent: Explore ---- - -## Context -- PR diff: !`gh pr diff` -- Changed files: !`gh pr diff --name-only` +**Important:** The preprocessor scans the entire SKILL.md as plain text — it does not parse markdown. Directives inside fenced code blocks or inline code spans are still executed. If a skill documents this syntax with literal examples, the preprocessor will attempt to run them, causing load failures. To safely document this feature, describe it in prose (as done here) or place examples in a reference file, which is loaded on-demand by Claude and not preprocessed. -Summarize this pull request... -``` +For a concrete example of dynamic context injection in a skill, see [official-spec.md](references/official-spec.md) § "Dynamic Context Injection". ### Running in a Subagent