Skip to content

Instantly share code, notes, and snippets.

@umputun
Last active January 16, 2026 12:40
Show Gist options
  • Select an option

  • Save umputun/570c77f8d5f3ab621498e1449d2b98b6 to your computer and use it in GitHub Desktop.

Select an option

Save umputun/570c77f8d5f3ab621498e1449d2b98b6 to your computer and use it in GitHub Desktop.
Mandatory Skill Activation Hook for Claude Code

Mandatory Skill Activation Hook for Claude Code

Forces Claude to evaluate and activate relevant skills before implementation. By default, Claude Code often ignores available skills entirely and proceeds with generic responses instead of leveraging specialized skill knowledge.

Problem Solved

Claude Code frequently skips skill evaluation and jumps straight to implementation, missing out on specialized context and workflows that skills provide. This hook injects a system reminder on every prompt submission that enforces a three-step sequence: evaluate → activate → implement.

Files Required

1. Hook Script (~/.claude/hooks/skill-forced-eval-hook.sh)

#!/bin/bash
# UserPromptSubmit hook that enforces skill activation
#
# This hook requires Claude to activate relevant skills before implementation.

cat <<'EOF'
INSTRUCTION: MANDATORY SKILL ACTIVATION

Check <available_skills> for relevance before proceeding.

IF any skills are relevant:
  1. State which skills and why (only mention relevant ones)
  2. Activate ALL relevant skills with Skill() tool - multiple skills can be activated together
  3. Then proceed with implementation

IF no skills are relevant:
  - Proceed directly (no statement needed)

Example when multiple skills are relevant:
  relevant skills: mongo (querying database), local-docs (using go-pkgz)
  [activates Skill(mongo)]
  [activates Skill(local-docs)]
  [then proceeds with implementation]

CRITICAL: Activate ALL relevant skills via Skill() tool before implementation.
Multiple skills can and should be activated when applicable.
Mentioning a skill without activating it is worthless.
EOF

2. Settings Configuration (~/.claude/settings.json)

Add the hooks section to your settings:

{
  "hooks": {
    "UserPromptSubmit": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "~/.claude/hooks/skill-forced-eval-hook.sh"
          }
        ]
      }
    ]
  }
}

Installation

# create hooks directory
mkdir -p ~/.claude/hooks

# create the hook script
cat > ~/.claude/hooks/skill-forced-eval-hook.sh << 'SCRIPT'
#!/bin/bash
cat <<'EOF'
INSTRUCTION: MANDATORY SKILL ACTIVATION

Check <available_skills> for relevance before proceeding.

IF any skills are relevant:
  1. State which skills and why (only mention relevant ones)
  2. Activate ALL relevant skills with Skill() tool - multiple skills can be activated together
  3. Then proceed with implementation

IF no skills are relevant:
  - Proceed directly (no statement needed)

Example when multiple skills are relevant:
  relevant skills: mongo (querying database), local-docs (using go-pkgz)
  [activates Skill(mongo)]
  [activates Skill(local-docs)]
  [then proceeds with implementation]

CRITICAL: Activate ALL relevant skills via Skill() tool before implementation.
Multiple skills can and should be activated when applicable.
Mentioning a skill without activating it is worthless.
EOF
SCRIPT

# make executable
chmod +x ~/.claude/hooks/skill-forced-eval-hook.sh

# add to settings.json (requires jq)
jq '.hooks.UserPromptSubmit = [{"hooks": [{"type": "command", "command": "~/.claude/hooks/skill-forced-eval-hook.sh"}]}]' \
  ~/.claude/settings.json > /tmp/settings.json && mv /tmp/settings.json ~/.claude/settings.json

How It Works

  1. UserPromptSubmit hook fires before Claude processes each user message
  2. Hook script outputs instruction text to stdout
  3. Claude Code injects output as <system-reminder> in context
  4. Claude sees the instruction and must follow the evaluate → activate → implement sequence

Verification

After installation, submit any prompt. Claude should either:

  • State "no skills relevant" and proceed (for simple queries)
  • List relevant skills, call Skill() tool for each, then implement

If Claude ignores skills when they're clearly relevant, check the path in settings.json matches the actual script location.

Notes

  • Hook output appears in Claude's context, not in your terminal
  • Multiple hooks can be chained in the hooks array
  • Tilde expansion (~) works in settings.json paths
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment