hook-authoring

Installation
SKILL.md

Hook Authoring

Hooks live in claude/hooks/ and are triggered by Claude Code lifecycle events.

Shell Hooks

  • Shebang: #!/usr/bin/env bash
  • Always: set -euo pipefail
  • Quote all variables: "$VAR", never bare $VAR
  • Conditionals: [[ ... ]], not [ ... ]
  • Validate after writing: shellcheck claude/hooks/<name>.sh

Python Hooks

  • Shebang: #!/usr/bin/env python3
  • Target Python 3.14; use uv run to execute
  • Type-hint all public functions
  • No subprocess.shell=True; use subprocess.run([...], check=True) with a list
  • Validate after writing: uv run ruff check claude/hooks/<name>.py
Installs
1
GitHub Stars
7
First Seen
Sep 15, 2026