20개 체크·10개 hook 30분 셋업으로 점수 0점에서 100점까지
지금까지 잘 따라왔다.
7장, 20개 체크, 10개의 Hook스크립트, 5개 템플릿으로 완성단계까지 왔다.
마지막으로 그 모든 것들을 하나의 운영체계로서 연결하는 마지막 단계이다.
물론 처음부터 이번 장부터 읽고 설정해도 된다. 각 항목별 원리가 궁금하면 해당 장으로 가면 된다.
처음 설정하는 경우 이 순서대로 진행하면 30분 안에 전체 환경을 구축할 수 있다.
# claude-code-hooks 레포지토리를 클론
git clone https://github.com/gaebalai/claude-code-hooks.git ~/products/claude-code-hooks
# ~/.claude/hooks 디렉터리를 만들고 심볼릭 링크로 연결
mkdir -p ~/.claude/hooks
cd ~/.claude/hooks
ln -s ~/products/claude-code-hooks/hooks/*.sh .
# watchdog 스크립트를 PATH에 추가
mkdir -p ~/bin
ln -s ~/products/claude-code-hooks/scripts/cc-solo-watchdog ~/bin/
echo 'export PATH="$HOME/bin:$PATH"' >> ~/.zshrc # 또는 ~/.bashrc
source ~/.zshrc
~/.claude/settings.json을 열고 아래 내용으로 교체(또는 병합)한다.
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{"type": "command", "command": "bash ~/.claude/hooks/branch-guard.sh"},
{"type": "command", "command": "bash ~/.claude/hooks/error-gate.sh"},
{"type": "command", "command": "bash ~/.claude/hooks/no-ask-human.sh"}
]
}
],
"PostToolUse": [
{
"matcher": "Edit|Write",
"hooks": [
{"type": "command", "command": "bash ~/.claude/hooks/syntax-check.sh"},
{"type": "command", "command": "bash ~/.claude/hooks/activity-logger.sh"}
]
},
{
"matcher": "Bash",
"hooks": [
{"type": "command", "command": "bash ~/.claude/hooks/activity-logger.sh"},
{"type": "command", "command": "bash ~/.claude/hooks/context-monitor.sh"},
{"type": "command", "command": "bash ~/.claude/hooks/decision-warn.sh"}
]
}
],
"Stop": [
{
"hooks": [
{"type": "command", "command": "bash ~/.claude/hooks/proof-log-session.sh"}
]
}
],
"PreCompact": [
{
"hooks": [
{"type": "command", "command": "bash ~/.claude/hooks/proof-log-session.sh"}
]
}
]
}
}
지금 바로 작가의 멤버십 구독자가 되어
멤버십 특별 연재 콘텐츠를 모두 만나 보세요.
오직 멤버십 구독자만 볼 수 있는,
이 작가의 특별 연재 콘텐츠