Skill-scoped PreToolUse hooks persist after skill completes

Resolved 💬 5 comments Opened Mar 4, 2026 by haimat Closed May 1, 2026

Description

Hooks defined in a skill's YAML frontmatter continue to enforce after the skill invocation ends. According to the docs, skill hooks should be "scoped to the component's lifetime and cleaned up when it finishes."

Reproduction

  1. Define a skill with PreToolUse hooks that restrict tool access (e.g., block reads to certain directories, whitelist specific bash commands):
---
name: my-skill
hooks:
  PreToolUse:
    - matcher: "Read|Grep|Glob"
      hooks:
        - type: command
          command: "$CLAUDE_PROJECT_DIR/.claude/hooks/block-some-reads.sh"
    - matcher: "Bash"
      hooks:
        - type: command
          command: "$CLAUDE_PROJECT_DIR/.claude/hooks/restrict-bash.sh"
---
  1. Invoke the skill (e.g., /my-skill)
  2. After the skill completes, send a normal follow-up message
  3. Tool calls in the follow-up message are still subject to the skill's hooks

Expected behavior

Skill hooks are cleaned up when the skill finishes. Subsequent tool calls in normal conversation are not affected.

Actual behavior

Skill hooks persist for the rest of the session. The only workarounds are:

  • Start a new session
  • Run /hooks and disable all hooks (blunt — disables non-skill hooks too)

Related

  • #21583 (Remove skills from context when not in use) — related but that issue is about skill prompts in context; this is about hooks actively blocking tool calls after the skill ends.

View original on GitHub ↗

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