Skill loader incorrectly parses inline backticks as bash commands

Resolved 💬 3 comments Opened Feb 1, 2026 by CybotTM Closed Feb 1, 2026

Description

The !command` syntax for dynamic content injection incorrectly triggers when !` appears at the end of an inline code span.

The Ambiguity

When message ends with `!`, use single quotes or `$'...'`
                        ^-^
                        inline code span containing !

The parser sees ! followed by ` ` and interprets it as !command`, but the backtick is actually the closing backtick of an inline code span, not the opening backtick of a command.

Steps to Reproduce

  1. Create a SKILL.md with:

``markdown
**Important:** When message ends with
!, use single quotes or $'...' to avoid bash history expansion.
``

  1. Load the skill
  1. Error:

``
Bash command failed for pattern "!
, use single quotes or ": [stderr]
/bin/bash: line 1: ,: command not found
``

Root Cause

The parser cannot distinguish between:

  • ` ! - inline code containing ! (backtick after !` is closing)
  • !command` - command injection (backtick after !` is opening)

Suggested Fix

The !command` syntax should only trigger when !` is:

  1. Preceded by whitespace, start-of-line, or non-backtick character
  2. NOT inside an already-open inline code span

This requires tracking backtick open/close state during parsing.

Workaround

Avoid ! at the end of inline code spans, or remove backticks entirely.

Environment

  • Claude Code version: 2.1.29
  • OS: Linux (WSL2)

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗