시작하기무료로 시작하기

Make the rule unskippable

Earlier you deleted "never push to main" from CLAUDE.md, because a rule that dangerous shouldn't depend on Claude reading carefully. Now give it somewhere it actually holds.

A PreToolUse hook runs before every matching tool call and can stop it. Wire one onto the Bash tool in the queries project so a push to main is refused rather than requested. Claude Code loads hooks when a session starts, so the hook you write here takes effect on the next run.

이 연습은 강의의 일부입니다

Claude Code in Action

강의 보기

연습 안내

  • Start Claude Code with claude.
  • Ask Claude to write a PreToolUse hook script at hooks/block-main-push.js that refuses any Bash command pushing to main, and explains why.
  • Ask Claude to wire that script into .claude/settings.json as a PreToolUse hook with the matcher set to Bash.
  • Type /exit to exit Claude Code.

실습형 인터랙티브 연습문제

이론을 실습으로 바꾸는 인터랙티브 연습 중 하나를 만나보세요

연습 시작