From 88a96ec842ebd4f03c704c74b4b3543aaa2c7612 Mon Sep 17 00:00:00 2001 From: Garry Tan Date: Sun, 7 Jun 2026 22:53:41 -0700 Subject: [PATCH] fix(skills): anchor guard/freeze/careful hook paths so they survive CC 2.1.162 (#1871) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The PreToolUse frontmatter hooks for guard, freeze, and careful invoked `bash ${CLAUDE_SKILL_DIR}/.../check-*.sh`. Claude Code 2.1.162 no longer populates ${CLAUDE_SKILL_DIR} in the skill-hook execution env, so it expanded to empty and every Edit/Write/Bash ran `bash /...` and errored — breaking the safety skills entirely. Frontmatter hooks run before any skill-body bash, so no runtime-resolved variable can fix this; the command must be a path that's valid at hook time. Anchor to the installed checkout: $HOME/.claude/skills/gstack/{careful,freeze}/bin/check-*.sh, where the scripts actually live. ($HOME is expanded by the hook shell.) Reported by @omariani-howdy. Regenerated the three SKILL.md from templates. Co-Authored-By: Claude Opus 4.8 (1M context) --- careful/SKILL.md | 2 +- careful/SKILL.md.tmpl | 2 +- freeze/SKILL.md | 4 ++-- freeze/SKILL.md.tmpl | 4 ++-- guard/SKILL.md | 6 +++--- guard/SKILL.md.tmpl | 6 +++--- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/careful/SKILL.md b/careful/SKILL.md index 678d66c16..c646c8b60 100644 --- a/careful/SKILL.md +++ b/careful/SKILL.md @@ -14,7 +14,7 @@ hooks: - matcher: "Bash" hooks: - type: command - command: "bash ${CLAUDE_SKILL_DIR}/bin/check-careful.sh" + command: "bash $HOME/.claude/skills/gstack/careful/bin/check-careful.sh" statusMessage: "Checking for destructive commands..." --- diff --git a/careful/SKILL.md.tmpl b/careful/SKILL.md.tmpl index 9d83411f8..5c128a00e 100644 --- a/careful/SKILL.md.tmpl +++ b/careful/SKILL.md.tmpl @@ -19,7 +19,7 @@ hooks: - matcher: "Bash" hooks: - type: command - command: "bash ${CLAUDE_SKILL_DIR}/bin/check-careful.sh" + command: "bash $HOME/.claude/skills/gstack/careful/bin/check-careful.sh" statusMessage: "Checking for destructive commands..." sensitive: true --- diff --git a/freeze/SKILL.md b/freeze/SKILL.md index fc82b1bea..d6ba29b24 100644 --- a/freeze/SKILL.md +++ b/freeze/SKILL.md @@ -15,12 +15,12 @@ hooks: - matcher: "Edit" hooks: - type: command - command: "bash ${CLAUDE_SKILL_DIR}/bin/check-freeze.sh" + command: "bash $HOME/.claude/skills/gstack/freeze/bin/check-freeze.sh" statusMessage: "Checking freeze boundary..." - matcher: "Write" hooks: - type: command - command: "bash ${CLAUDE_SKILL_DIR}/bin/check-freeze.sh" + command: "bash $HOME/.claude/skills/gstack/freeze/bin/check-freeze.sh" statusMessage: "Checking freeze boundary..." --- diff --git a/freeze/SKILL.md.tmpl b/freeze/SKILL.md.tmpl index a1b456e53..c0b31aa7f 100644 --- a/freeze/SKILL.md.tmpl +++ b/freeze/SKILL.md.tmpl @@ -20,12 +20,12 @@ hooks: - matcher: "Edit" hooks: - type: command - command: "bash ${CLAUDE_SKILL_DIR}/bin/check-freeze.sh" + command: "bash $HOME/.claude/skills/gstack/freeze/bin/check-freeze.sh" statusMessage: "Checking freeze boundary..." - matcher: "Write" hooks: - type: command - command: "bash ${CLAUDE_SKILL_DIR}/bin/check-freeze.sh" + command: "bash $HOME/.claude/skills/gstack/freeze/bin/check-freeze.sh" statusMessage: "Checking freeze boundary..." sensitive: true --- diff --git a/guard/SKILL.md b/guard/SKILL.md index e4dff7936..d9ae63de8 100644 --- a/guard/SKILL.md +++ b/guard/SKILL.md @@ -15,17 +15,17 @@ hooks: - matcher: "Bash" hooks: - type: command - command: "bash ${CLAUDE_SKILL_DIR}/../careful/bin/check-careful.sh" + command: "bash $HOME/.claude/skills/gstack/careful/bin/check-careful.sh" statusMessage: "Checking for destructive commands..." - matcher: "Edit" hooks: - type: command - command: "bash ${CLAUDE_SKILL_DIR}/../freeze/bin/check-freeze.sh" + command: "bash $HOME/.claude/skills/gstack/freeze/bin/check-freeze.sh" statusMessage: "Checking freeze boundary..." - matcher: "Write" hooks: - type: command - command: "bash ${CLAUDE_SKILL_DIR}/../freeze/bin/check-freeze.sh" + command: "bash $HOME/.claude/skills/gstack/freeze/bin/check-freeze.sh" statusMessage: "Checking freeze boundary..." --- diff --git a/guard/SKILL.md.tmpl b/guard/SKILL.md.tmpl index 5829dbe48..3d34ee0c1 100644 --- a/guard/SKILL.md.tmpl +++ b/guard/SKILL.md.tmpl @@ -20,17 +20,17 @@ hooks: - matcher: "Bash" hooks: - type: command - command: "bash ${CLAUDE_SKILL_DIR}/../careful/bin/check-careful.sh" + command: "bash $HOME/.claude/skills/gstack/careful/bin/check-careful.sh" statusMessage: "Checking for destructive commands..." - matcher: "Edit" hooks: - type: command - command: "bash ${CLAUDE_SKILL_DIR}/../freeze/bin/check-freeze.sh" + command: "bash $HOME/.claude/skills/gstack/freeze/bin/check-freeze.sh" statusMessage: "Checking freeze boundary..." - matcher: "Write" hooks: - type: command - command: "bash ${CLAUDE_SKILL_DIR}/../freeze/bin/check-freeze.sh" + command: "bash $HOME/.claude/skills/gstack/freeze/bin/check-freeze.sh" statusMessage: "Checking freeze boundary..." sensitive: true ---