Skip to content

Instantly share code, notes, and snippets.

@IlyaGulya
Created February 5, 2026 07:21
Show Gist options
  • Select an option

  • Save IlyaGulya/91bcd809517b3af2982d1bbe6e750173 to your computer and use it in GitHub Desktop.

Select an option

Save IlyaGulya/91bcd809517b3af2982d1bbe6e750173 to your computer and use it in GitHub Desktop.
#!/bin/bash
# UserPromptSubmit hook for activating skills
#
# If the project has its own hook — do not run (avoid duplicates)
if [[ -n "$CLAUDE_PROJECT_DIR" && -f "$CLAUDE_PROJECT_DIR/.claude/hooks/skill-activation.sh" ]]; then
exit 0
fi
# Helper function to check if a directory has any entries
dir_has_entries() {
[[ -d "$1" && -n "$(ls -A "$1" 2>/dev/null)" ]]
}
# Check if skills/commands exist in project directory
has_skills=false
if [[ -n "$CLAUDE_PROJECT_DIR" ]]; then
if dir_has_entries "$CLAUDE_PROJECT_DIR/.claude/commands" || \
dir_has_entries "$CLAUDE_PROJECT_DIR/.claude/skills"; then
has_skills=true
fi
fi
# Only output reminder if skills are available
if [[ "$has_skills" == "true" ]]; then
cat <<'EOF'
BEFORE answering, do the following MANDATORILY:
1. ASSESSMENT: find suitable skills from <available_skills> for the user's request
2. ACTIVATION: call Skill() for each suitable skill.
3. EXECUTION: proceed ONLY after step 2; without calling skills, assessment is useless
Example:
- sample:skill — because X and Y
EOF
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment