# Add notification and formatting hooks to Claude Code

> Choose the right hook event, preserve existing settings and check that the action actually runs.

Source: https://fullbytedeveloper.com/blog/claude-code-notification-format-hooks
Originally posted: 2026-10-22
Published here: 2026-11-06

Claude Code hooks run commands at specified events. The official guide uses Notification for desktop alerts and PostToolUse for formatting after an edit. [1]

## Add an alert without replacing settings

In `~/.claude/settings.json`, merge a Notification event into the existing hooks object. The guide supplies separate macOS, Linux and Windows examples. On macOS it uses `osascript`; Linux uses `notify-send`. [1]

Use the `permission_prompt` matcher when you want approval alerts rather than every notification. Open `/hooks` inside Claude Code and check that the event appears. Then trigger a permission request and confirm you receive the alert. [1]

## Scope the formatter

The guide uses a PostToolUse event with the `Edit|Write` matcher. Its example reads the edited path from the hook input and runs Prettier. It requires jq. [1]

Before enabling automatic formatting, check which files your formatter supports and how its command handles paths containing spaces. Try a disposable file and inspect the diff.

Hooks execute commands with your environment's permissions. Read commands copied from another repository before putting them in settings. [1]

## Sources

1. [Claude Code hooks guide](https://code.claude.com/docs/en/hooks-guide)

## Original posts

- [Instagram post](https://www.instagram.com/fullbytedeveloper/p/Dex4ZBPjsXK/)
