Build This Now
Build This Now
Keyboard ShortcutsStatus Line Guide
Hooks GuideCross-Platform Hooks for Claude CodeClaude Code Setup HooksStop HooksSelf-Validating Claude Code AgentsClaude Code Session HooksContext Backup Hooks for Claude CodeSkill Activation HookClaude Code Permission Hook
Get Build This Now
speedy_devvkoen_salo
Blog/Toolkit/Hooks/Skill Activation Hook

Skill Activation Hook

A hook on UserPromptSubmit that appends matching skill recommendations to every prompt before Claude reads it.

Problem: A skill you asked Claude Code to use never gets loaded. You move the rule into CLAUDE.md. Same outcome. You end up retyping the reminder by hand for skills the framework was supposed to pick up on its own.

Quick Win: A hook can intercept every prompt and tack the right skill recommendations on the back. Forgetting goes away because Claude was never asked to remember.

Send the message "help me implement a feature" and what actually lands in Claude's input is this:

help me implement a feature

SKILL ACTIVATION CHECK

CRITICAL SKILLS (REQUIRED):
  -> session-management

RECOMMENDED SKILLS:
  -> git-commits

ACTION: Use Skill tool BEFORE responding

Claude sees the exact skills it should pull in, right next to your request. Nothing to guess. Nothing to remember.

How It Works

UserPromptSubmit is the event the hook latches onto. Anything you submit goes through this flow:

  1. You type a message - Your natural language request
  2. Hook intercepts - Before Claude sees anything
  3. Pattern matching - Hook checks skill-rules.json for keyword and intent matches
  4. Append recommendations - Matching skills get added to your message
  5. Claude receives both - Your prompt plus skill guidance

The whole thing finishes in milliseconds. No delay you'd actually feel.

The Matching System

Two strategies run in parallel.

Keyword Matching is a literal string check. Mention "commit" or "git push" and the git-commits skill fires.

Intent Patterns lean on regex for the way real people phrase things. The pattern (implement|build).*?feature picks up both "let's implement this feature" and "build a new feature for me".

Configuration: skill-rules.json

Triggers for every skill live in .claude/skills/skill-rules.json:

{
  "skills": {
    "session-management": {
      "enforcement": "suggest",
      "priority": "critical",
      "promptTriggers": {
        "keywords": ["feature", "implement", "build", "refactor"],
        "intentPatterns": ["(implement|build).*?feature"]
      }
    },
    "git-commits": {
      "enforcement": "suggest",
      "priority": "high",
      "promptTriggers": {
        "keywords": ["commit", "git push", "commit changes"],
        "intentPatterns": ["(create|make).*?commit"]
      }
    }
  }
}

Suggestions get grouped by priority:

  • Critical - Must load before any work
  • High - Strongly recommended
  • Medium - Helpful context
  • Low - Optional enhancement

Customization for Your Speech Patterns

The hook bends to your vocabulary. If "push my code" is what comes out of your fingers instead of "git push", drop it in:

"keywords": ["commit", "git push", "push my code", "commit changes"]

Whenever you build a new skill, edit its triggers in skill-rules.json. Then look at what you put in there and let those phrases guide how you write prompts.

Session Intelligence

The hook remembers what it already suggested. If session-management came up earlier in the same conversation, it stays quiet the second time around. Same coverage, less noise.

State is kept in recommendation-log.json and clears itself after 7 days.

Setup in ClaudeFast

The hook ships pre-configured. Open .claude/settings.local.json and confirm one of these two blocks is in there:

Windows:

{
  "hooks": {
    "UserPromptSubmit": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "cmd /c \".claude\\hooks\\SkillActivationHook\\skill-activation-prompt.cmd\""
          }
        ]
      }
    ]
  }
}

Linux/Mac:

{
  "hooks": {
    "UserPromptSubmit": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "bash .claude/hooks/SkillActivationHook/skill-activation-prompt.sh"
          }
        ]
      }
    ]
  }
}

Common Issues

No suggestions appearing - Your keywords probably don't match how you actually talk. Run the hook by hand and watch the output:

echo '{"session_id":"test","prompt":"implement a feature"}' | node .claude/hooks/SkillActivationHook/skill-activation-prompt.mjs

Suggestions appearing when not needed - Keywords are too broad. Tighten them, or move the trigger into an intent pattern.

Duplicate suggestions - The hook is wired up in two places at once. Pick one settings file and remove it from the other.

Next Actions

  1. Check your skill-rules.json matches your vocabulary
  2. Add keywords for new skills you create
  3. Set up the main Hooks Guide for complete hook coverage
  4. Configure the Stop Hook to enforce task completion
  5. Learn more about CLAUDE.md configuration to complement the hook
  6. Review the skills guide if you need to create new skills

The Skill Activation Hook takes human memory out of the loop. Describe the work in plain language. Picking the right skills falls to the framework. That is the whole point of having one.

More in this guide

  • Keyboard Shortcuts
    Configure custom keyboard shortcuts in Claude Code.
  • Status Line Guide
    Set up a custom Claude Code status line showing model name, git branch, cost, and context usage.
  • AI SEO and GEO Optimization
    A rundown of Generative Engine Optimization: how to get content cited inside ChatGPT, Claude, and Perplexity responses instead of just ranked on Google.
  • Claude Code vs Cursor in 2026
    A side-by-side look at Claude Code and Cursor in 2026: agent models, context windows, pricing tiers, and how each tool fits different developer workflows.
  • Claude Code VSCode Extension
    Anthropic's VS Code extension puts Claude Code inside the editor sidebar as a Spark-icon panel, with inline diffs, plan mode, subagents, and MCP support.

Stop configuring. Start building.

SaaS builder templates with AI orchestration.

Get Build This Now

Context Backup Hooks for Claude Code

A StatusLine-driven backup system that writes structured snapshots every 10K tokens so auto-compaction cannot eat your session detail.

Claude Code Permission Hook

Three-tier permission delegation for Claude Code: instant approve, instant deny, and an LLM check for the gray area.

On this page

How It Works
The Matching System
Configuration: skill-rules.json
Customization for Your Speech Patterns
Session Intelligence
Setup in ClaudeFast
Common Issues
Next Actions

Stop configuring. Start building.

SaaS builder templates with AI orchestration.

Get Build This Now