From magic-powers
Use when automating Claude Code workflows with hooks — PreToolUse (validate/block actions), PostToolUse (react to completions), Stop (enforce standards before finishing), and SessionStart (load context). Configure in .claude/settings.json.
npx claudepluginhub kienbui1995/magic-powers --plugin magic-powersThis skill uses the workspace's default tool permissions.
Hooks let you automate Claude Code: run tests automatically after edits, block dangerous operations, enforce quality gates before Claude declares done. Without hooks, Claude relies purely on its training and your instructions. With hooks, you build enforced guardrails and automation into the workflow itself.
Generates design tokens/docs from CSS/Tailwind/styled-components codebases, audits visual consistency across 10 dimensions, detects AI slop in UI.
Records polished WebM UI demo videos of web apps using Playwright with cursor overlay, natural pacing, and three-phase scripting. Activates for demo, walkthrough, screen recording, or tutorial requests.
Delivers idiomatic Kotlin patterns for null safety, immutability, sealed classes, coroutines, Flows, extensions, DSL builders, and Gradle DSL. Use when writing, reviewing, refactoring, or designing Kotlin code.
Hooks let you automate Claude Code: run tests automatically after edits, block dangerous operations, enforce quality gates before Claude declares done. Without hooks, Claude relies purely on its training and your instructions. With hooks, you build enforced guardrails and automation into the workflow itself.
rm -rf, force push)| Hook | When it fires | Use for |
|---|---|---|
SessionStart | Every new Claude Code session | Load context, greet, check state |
PreToolUse | Before ANY tool executes | Validate, block, or modify tool calls |
PostToolUse | After tool executes | React to changes, run follow-ups |
Stop | When Claude finishes responding | Enforce done-criteria before Claude stops |
{
"hooks": {
"PreToolUse": [{
"matcher": "Bash",
"hooks": [{
"type": "command",
"command": "bash .claude/hooks/validate-bash.sh '$CLAUDE_TOOL_INPUT'"
}]
}],
"PostToolUse": [{
"matcher": "Edit|Write",
"hooks": [{
"type": "command",
"command": "bash .claude/hooks/post-edit.sh",
"async": true
}]
}],
"Stop": [{
"hooks": [{
"type": "command",
"command": "bash .claude/hooks/enforce-done.sh"
}]
}]
}
}
Block dangerous bash commands (PreToolUse):
#!/bin/bash
# .claude/hooks/validate-bash.sh
INPUT="$1"
# Block destructive operations
if echo "$INPUT" | grep -qE "rm -rf|DROP TABLE|git push --force"; then
echo "BLOCKED: Destructive operation requires explicit confirmation"
exit 1 # Exit code 1 = block the tool, show error to Claude
fi
exit 0 # Exit code 0 = allow
Auto-run tests after file edits (PostToolUse):
#!/bin/bash
# .claude/hooks/post-edit.sh - runs async (doesn't block Claude)
CHANGED_FILE="$CLAUDE_TOOL_RESULT"
if [[ "$CHANGED_FILE" == *.py ]]; then
cd "$(git rev-parse --show-toplevel)"
python -m pytest tests/ -x -q --tb=short 2>&1 | tail -20
fi
Enforce test passing before finishing (Stop):
#!/bin/bash
# .claude/hooks/enforce-done.sh
if git diff --name-only | grep -q "\.py$"; then
echo "Running tests before declaring done..."
if ! python -m pytest tests/ -x -q; then
echo "Tests failing — cannot mark task complete"
exit 1 # Blocks Claude from stopping, forces it to fix tests
fi
fi
exit 0
Available in hook scripts:
CLAUDE_TOOL_NAME # Name of tool being called (Bash, Edit, Write, etc.)
CLAUDE_TOOL_INPUT # Input to the tool (command being run, file path, etc.)
CLAUDE_TOOL_RESULT # Result of tool execution (PostToolUse only)
CLAUDE_SESSION_ID # Current session ID
CLAUDE_PLUGIN_ROOT # Path to magic-powers plugin root
async: true means non-blocking.claude/settings.json exists in project?.claude/settings.json: hooks configuration.claude/hooks/ directory: shell scripts for each hook behaviorasync: true for anything taking >1s)claude-md-authoring (document hook behaviors in CLAUDE.md so team understands them)claude-project-settings (hooks configured in same settings.json)@debugger can help debug why hooks are firing unexpectedly