Claude-code-hooks setup
Set up claude-code-hooks for your project. Guides you through choosing which hooks to enable and configuring environment variables.
install
source · Clone the upstream repo
git clone https://github.com/yurukusa/claude-code-hooks
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/yurukusa/claude-code-hooks "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/setup" ~/.claude/skills/yurukusa-claude-code-hooks-setup && rm -rf "$T"
manifest:
skills/setup/SKILL.mdsource content
Claude Code Hooks Setup
You are helping the user set up production safety hooks for Claude Code.
Available Hooks
| Hook | Purpose | Event | Matcher |
|---|---|---|---|
| context-monitor.sh | Context window warnings (40% → 25% → 20% → 15%) | PostToolUse | all |
| activity-logger.sh | JSONL audit trail of file changes | PostToolUse | Edit|Write |
| syntax-check.sh | Auto syntax validation after edits | PostToolUse | Edit|Write |
| decision-warn.sh | Alerts on edits to sensitive paths | PreToolUse | Edit|Write |
| cdp-safety-check.sh | Blocks raw WebSocket CDP construction | PreToolUse | Bash |
| proof-log-session.sh | 5W1H session summaries | Stop, PreCompact | all |
| session-start-marker.sh | Records session start time | PostToolUse | all |
| no-ask-human.sh | Blocks questions during autonomous operation | PostToolUse | all |
| branch-guard.sh | Blocks pushes to main/master | PreToolUse | Bash |
| error-gate.sh | Blocks external actions when errors exist | PreToolUse | Bash |
Setup Profiles
Minimal (recommended for beginners)
- context-monitor.sh + syntax-check.sh
- Catches the two most common failure modes
Standard (recommended for most users)
- All of minimal + activity-logger.sh + branch-guard.sh + decision-warn.sh + proof-log-session.sh + session-start-marker.sh
- Good balance of safety and visibility
Autonomous (for unattended operation)
- All hooks enabled including no-ask-human.sh and error-gate.sh
- Maximum safety for headless/autonomous Claude Code sessions
Steps
- Ask which profile the user wants (or let them pick individual hooks)
- The plugin's hooks.json already configures the autonomous profile by default
- Help configure environment variables if needed:
— path to mission.md (default:CC_CONTEXT_MISSION_FILE
)$HOME/mission.md
— path to activity log (default:CC_ACTIVITY_LOG
)$HOME/claude-activity-log.jsonl
— colon-separated paths for decision-warn (default:CC_MONITORED_DIRS
)$HOME/bin:$HOME/.claude/hooks
— colon-separated branch names (default:CC_PROTECT_BRANCHES
)main:master
— path to error tracker (default:CC_ERROR_LOG
)$HOME/.claude/error-tracker.log
— path to proof logs (default:CC_PROOF_LOG_DIR
)$HOME/proof-log
- Verify the setup works by running a quick test