There are several ways to integrate Claude Hooks into your project:
Install hooks globally in your home directory:
git clone https://github.com/your-org/claude-hooks.git ~/claude-hooks
cd ~/claude-hooks
./scripts/install.shThe hooks will apply to all your projects automatically.
-
Clone the claude-hooks repository somewhere on your machine:
git clone https://github.com/decider/claude-hooks.git ~/claude-hooks -
In your project, create an installation script:
#!/bin/bash CLAUDE_HOOKS_REPO="$HOME/claude-hooks" # Copy hooks to project cp -r "$CLAUDE_HOOKS_REPO/hooks" ./claude/ cp "$CLAUDE_HOOKS_REPO/config/settings.example.json" ./claude/settings.json chmod +x ./claude/hooks/*.sh
-
Commit the claude directory to your project
-
Team members run the project's setup script
-
Add claude-hooks as a submodule:
git submodule add https://github.com/decider/claude-hooks.git claude-hooks
-
Copy hooks to your project:
cp -r claude-hooks/hooks claude/ cp claude-hooks/config/settings.example.json claude/settings.json
-
Create a setup script for team members:
./claude-hooks/scripts/install-project.sh
This approach copies claude-hooks directly into your project, ensuring all team members have the same version with zero external dependencies.
-
Clone claude-hooks and copy to your project:
git clone https://github.com/decider/claude-hooks.git ~/claude-hooks cd /path/to/your/project cp -r ~/claude-hooks ./claude-hooks
-
Copy the update script to your project:
mkdir -p scripts cp ~/claude-hooks/scripts/update-vendored.sh scripts/update-claude-hooks.sh chmod +x scripts/update-claude-hooks.sh -
Create a setup script at
claude/setup-hooks.sh:#!/bin/bash # Copy vendored hooks to user's ./claude directory cp -r ./claude-hooks/hooks ./claude/ cp -r ./claude-hooks/tools ./claude/ 2>/dev/null || true chmod +x ./claude/hooks/*.sh echo "✅ Claude hooks installed from vendored copy!"
-
Add to your project's README:
## Setup Run `./claude/setup-hooks.sh` to install Claude Code hooks.
-
To update the vendored hooks:
./scripts/update-claude-hooks.sh git add claude-hooks/ git commit -m "chore: update claude-hooks"
Once published as an npm package:
npm install --save-dev @your-org/claude-hooks
npx claude-hooks installcd ~/claude-hooks
git pull
./scripts/update.shFor vendored approach:
./scripts/update-claude-hooks.sh
git add claude-hooks/
git commit -m "chore: update claude-hooks"For other approaches:
# Update from external repo
cd ~/claude-hooks && git pull
cd /path/to/your/project
./claude/install-from-external.shgit submodule update --remote claude-hooks
cp -r claude-hooks/hooks/* claude/hooks/After installation, customize the hooks by editing:
- User-level:
./claude/settings.json - Project-level:
./claude/settings.json
See Configuration Guide for details.