시작하기무료로 시작하기

Fixing a faulty hook

Now wire one up yourself. The editor holds a half-finished PreToolUse hook in .claude/settings.json that's meant to block reads of the .env file, but two things are wrong:

  1. The matcher only watches Read, so Grep could still leak the file's contents
  2. The command field is empty

Fix both in the editor, then press Check to validate your JSON and the hook's shape, so you can keep adjusting until every check passes.

Hints

  • A matcher can watch several tools at once with the pipe character, as in Read|Grep.

  • The command is the script Claude Code runs when the hook fires, so it can't be left empty. A minimal blocker is enough here — for example exit 2, which tells Claude Code to block the read.

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

Claude Code in Action

강의 보기

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

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

연습 시작