Skip to content

[bug] SKILL.md 程式碼裡的 $0/$1/$2 會被 skill 參數替換改掉 (follow-up from #353 verify) #362

Description

@kiki830621

Problem

Claude Code 載入 skill 時會做參數替換:$ARGUMENTS、$ARGUMENTS[N],以及簡寫 $N(等於 $ARGUMENTS[N],從 0 起算)。SKILL.md 程式碼區塊裡的 bash 位置參數與 awk 欄位($0、$1、$2)也會被替換。skill 帶參數呼叫時,模型讀到的是被改過的程式碼。

本 repo 的 SKILL.md 有 28 行含未跳脫的 $N,分布在 7 個 skill:idd-issue(11)、idd-verify(8)、idd-close(5)、idd-all、idd-clarify、idd-comment、idd-update 各 1。

實際看到的例子(#353 執行 /idd-verify 時):collect_external_writes 裡的 issues/$1/comments 變成 issues/MODE/comments(MODE 是呼叫參數裡的一個詞),awk 的 $0 ~ re 變成 UNATTENDED ~ re。照抄會抓錯 issue、掃描永遠不命中。

Expected

程式碼區塊裡的 $N 改寫成不會被替換的形式,例如 bash 用 ${1},awk 用 $ 0 或改用具名變數;寫法以官方文件說明的跳脫方式為準(\$1)。加一個 suite 掃描 skills/*/SKILL.md,出現未跳脫的 $N 就失敗,並附 positive control。

Context

#353 驗證時發現。替換規則見 Claude Code skills 文件的參數段落。


Follow-up from #353 verify

Source: /idd-verify #353 第 1、2 輪(PR #358)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions