[BUG] Skill silently fails (0 tokens, immediate exit) when SKILL.md body contains backtick-wrapped `!`

Resolved 💬 3 comments Opened Feb 24, 2026 by K9i-0 Closed Feb 27, 2026

Description

When a SKILL.md file contains a backtick-wrapped exclamation mark (` ! ) in its **body text** (not in fenced code blocks), invoking the skill via the Agent SDK (@anthropic-ai/claude-agent-sdk`) causes the session to silently exit with 0 input/output tokens and no error message. The skill appears to succeed but does nothing.

This does not occur with the interactive CLI (claude), only when using the SDK's query() API.

Reproduction

1. Create a minimal skill

.claude/skills/test-bang/SKILL.md:

---
name: test-bang
description: Test skill
allowed-tools: Bash(git:*), Read, AskUserQuestion
---

# Test

Breaking changes (`!` suffix or BREAKING CHANGE) should bump major.

Run `git status` and show the result.

2. Invoke via SDK

import { query } from "@anthropic-ai/claude-agent-sdk";

const q = query({
  prompt: (async function* () {
    yield {
      type: "user",
      session_id: "",
      message: { role: "user", content: [{ type: "text", text: "/test-bang" }] },
      parent_tool_use_id: null,
    };
  })(),
  options: { cwd: "/path/to/project", permissionMode: "default" },
});

for await (const msg of q) {
  console.log(msg.type, (msg as any).subtype ?? "");
}

3. Observe

Expected: The skill loads, model executes git status, returns result with tokens used.

Actual:

system init
user -
result success    // 0 tokens, ~0.0009 cost, ~600ms

The session exits immediately after system/init with inputTokens=0, outputTokens=0. No assistant messages, no tool calls.

4. Remove the backtick-wrapped !

Change ` ! to just !` in the SKILL.md body:

- Breaking changes (`!` suffix or BREAKING CHANGE) should bump major.
+ Breaking changes (! suffix or BREAKING CHANGE) should bump major.

Result: Skill works correctly — model runs, tools execute, tokens are consumed.

Evidence of Shell Interpretation

In earlier debugging, the following error appeared in logs when the skill content was processed:

zsh: command not found: 付きや

This suggests the SDK is passing the SKILL.md content through a shell where ` ! triggers bash/zsh history expansion (!), and the subsequent text (付きや — Japanese text that followed !` in our case) is interpreted as a command name.

Environment

  • Claude Code: 1.0.20 (latest at time of report)
  • Agent SDK: @anthropic-ai/claude-agent-sdk (latest)
  • OS: macOS 15.4 (Apple Silicon)
  • Shell: zsh

Workaround

Avoid using ` ! (backtick-wrapped exclamation mark) in SKILL.md body text. Use !` without backticks, or rephrase to avoid the character entirely.

Notes

  • Other backtick-wrapped content (e.g., ` feat , fix , minor `) works fine
  • The issue is specific to ! inside backticks
  • Skills invoked via the CLI (claude command) work correctly regardless — this is SDK-only
  • The bug is completely silent: result.subtype is "success", no errors are emitted

View original on GitHub ↗

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