P
PreToolUse (Skill)
HookFires on
PreToolUsematchingSkillImmediately before a tool runs — this is where an action can be denied.
Where this sits in a session
- Session start→
- Prompt submitted→
- Prompt expansion→
- Before tool use→
- After tool use→
- Notification→
- Before compaction→
- Subagent finished→
- Turn finished→
- Session end
Can block — This hook is able to deny the action or send Claude back to work.
What it runs
Executed automatically when the event fires — no prompt, no confirmation.
command· timeout 5s
${CLAUDE_PLUGIN_ROOT}/hooks/superpowers-foundry-bridge.shInstall it yourself
Paste into .claude/settings.json to run this hook without installing the whole plugin. Adjust the paths to point at your own copy of the scripts.
settings.json
{
"hooks": {
"PreToolUse": [
{
"hooks": [
{
"type": "command",
"command": "${CLAUDE_PLUGIN_ROOT}/hooks/superpowers-foundry-bridge.sh",
"timeout": 5
}
],
"matcher": "Skill"
}
]
}
}Source
Read this before installing — it runs on your machine with your permissions.
#!/usr/bin/env bash
#
# superpowers-foundry-bridge.sh
#
# PreToolUse hook on the Skill tool. Blocks superpowers:brainstorming and
# redirects to development-workflow which owns the Foundry dev flow.
# Advisory context is injected for other superpowers planning skills.
#
# Receives JSON on stdin with tool_input.skill (the skill being invoked).
# Outputs JSON with decision or additionalContext.
set -euo pipefail
INPUT=$(cat)
SKILL_NAME=$(echo "$INPUT" | jq -r '.tool_input.skill // empty')
# Redirect brainstorming to the Foundry development workflow skill.
# Uses additionalContext for a clean UX (no error messages).
# ~75% reliable — when it misses, the model still has Foundry skills in its
# available skills list. deny is 100% reliable but shows ugly duplicate errors.
case "$SKILL_NAME" in
superpowers:brainstorming|brainstorming)
jq -n '{
hookSpecificOutput: {
hookEventName: "PreToolUse",
additionalContext: "STOP. Do NOT proceed with brainstorming. The Foundry plugin is installed and crowdstrike-falcon-foundry:development-workflow MUST be used instead. It handles requirements gathering, CLI scaffolding, and manifest coordination for Foundry apps. Cancel this brainstorming skill invocation and invoke crowdstrike-falcon-foundry:development-workflow immediately."
}
}'
exit 0
;;
esac
# Advisory context for other superpowers planning skills
case "$SKILL_NAME" in
superpowers:writing-plans|writing-plans|\
superpowers:executing-plans|executing-plans|\
superpowers:subagent-driven-development|subagent-driven-development)
CONTEXT=$(cat <<'FOUNDRY_CONTEXT'
FOUNDRY PLUGIN INSTALLED: If this task involves Falcon Foundry, invoke crowdstrike-falcon-foundry:development-workflow BEFORE this skill. That skill owns Foundry app creation — it uses CLI commands (foundry apps create, foundry api-integrations create, etc.) that generate manifest.yml and wire up capability IDs correctly. Hand-writing manifest.yml or workflow YAML without the CLI causes deploy failures.
FOUNDRY_CONTEXT
)
jq -n \
--arg ctx "$CONTEXT" \
'{
hookSpecificOutput: {
hookEventName: "PreToolUse",
additionalContext: $ctx
}
}'
exit 0
;;
esac
Shipped by 1 plugin
Installing any of these installs this hook.
Reviews
Log in to leave a review.
No reviews yet — be the first.
Explore related
Other things in this space — across every part of the ecosystem, not just hooks.