Expose current skill name as env var to hooks
Feature request
When a hook fires during skill execution, expose the currently-running skill name (e.g. jokko:create-pr) as an environment variable like CLAUDE_CURRENT_SKILL.
Motivation
Hooks that guard against direct tool use (e.g. warning when gh pr create is called outside a dedicated PR-creation skill) currently have no way to know whether the call is coming from a skill or from ad-hoc agent behavior. The workaround is to have skills prefix their commands with a marker env var (IS_CREATE_PR_SKILL=1 gh pr create ...) and grep for it in the hook — this is fragile and requires every skill to opt-in manually.
With CLAUDE_CURRENT_SKILL (or similar) available to hooks, a single PreToolUse hook could implement context-aware policies like:
- Warn on
gh pr createunless running inside a*:create-prskill - Allow destructive git operations only from specific maintenance skills
- Log which skill triggered expensive API calls for cost attribution
- Enforce that certain tools are only called from approved skills
Proposed behavior
CLAUDE_CURRENT_SKILLis set to the fully-qualified skill name (e.g.jokko:create-pr,ai-dev:preflight) when a hook fires during skill execution- Empty or unset when no skill is active (ad-hoc tool use)
- Available to all hook types (PreToolUse, PostToolUse, etc.)
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗