BaşlayınÜcretsiz başlayın

Blocking .env reads with a hook

The queries project ships a PreToolUse hook that runs on every Read and Grep tool call (wired in .claude/settings.local.json). It already detects when Claude is about to read a .env file. What's left is deciding how the hook should respond.

A PreToolUse hook decides whether a tool call is allowed to run, and it reports back to Claude Code through its exit code and its output streams.

To block the .env read and show the user why, what must the hook do?

Bu egzersiz, kursun bir parçasıdır

Claude Code in Action

Kursa Göz Atın

Uygulamalı etkileşimli egzersiz

Teoriyi etkileşime dönüştürün, interaktif egzersizlerimizden biriyle

Egzersize başla