🐛 Problem
Both hooks in .claude/settings.example.json (copied verbatim into the active settings.local.json) read $CLAUDE_FILE_PATHS:
case "$CLAUDE_FILE_PATHS" in *.cs) dotnet format --include "$CLAUDE_FILE_PATHS" ... ;; esac
echo "$CLAUDE_FILE_PATHS" | grep -qE '\.env(\..*)?$' && { ...; exit 2; } || exit 0
Claude Code exports no such variable. Hook env vars are CLAUDE_PROJECT_DIR, CLAUDE_EFFORT, CLAUDE_ENV_FILE; the edited path arrives as stdin JSON at .tool_input.file_path. So the .env guard has never blocked anything and the formatter has never run. || true hid the failure.
Secondary: test -f package.json checks the repo root but the UI lives in admin-ui/; the repo uses npm (admin-ui/package-lock.json), not bunx.
✅ Fix
"PreToolUse": [{ "matcher": "Edit|Write", "hooks": [{ "type": "command",
"command": "f=$(jq -r '.tool_input.file_path // empty'); case \"$f\" in *.env|*.env.*) echo \"refuse: $f is an env file\" >&2; exit 2;; esac; exit 0" }] }],
"PostToolUse": [{ "matcher": "Edit|Write", "hooks": [{ "type": "command",
"command": "f=$(jq -r '.tool_input.file_path // empty'); case \"$f\" in */admin-ui/*.ts|*/admin-ui/*.tsx) (cd \"$CLAUDE_PROJECT_DIR/admin-ui\" && npx --no-install prettier --write \"$f\" >&2);; esac; exit 0" }] }]
Drop the per-file dotnet format hook (it restores and formats the whole project on every Write; CI already checks format). Apply to both the example file and the personal settings.local.json.
📎 Source
docs/AI_TOOLKIT_AUDIT_CLAUDE.md F2.
🐛 Problem
Both hooks in
.claude/settings.example.json(copied verbatim into the activesettings.local.json) read$CLAUDE_FILE_PATHS:Claude Code exports no such variable. Hook env vars are
CLAUDE_PROJECT_DIR,CLAUDE_EFFORT,CLAUDE_ENV_FILE; the edited path arrives as stdin JSON at.tool_input.file_path. So the.envguard has never blocked anything and the formatter has never run.|| truehid the failure.Secondary:
test -f package.jsonchecks the repo root but the UI lives inadmin-ui/; the repo uses npm (admin-ui/package-lock.json), notbunx.✅ Fix
Drop the per-file
dotnet formathook (it restores and formats the whole project on every Write; CI already checks format). Apply to both the example file and the personalsettings.local.json.📎 Source
docs/AI_TOOLKIT_AUDIT_CLAUDE.mdF2.