logo

Simple Notifications Hook(Claude Code)

Notifications Hook Cover

这类通知 hook 的价值很简单:Claude Code 跑长任务时,你不用一直盯着终端。按 Anthropic 官方当前 hooks 文档,hook 本质上就是在特定事件点自动执行自定义命令或脚本。

主要功能(Key Capabilities)

  • Instant Notifications(操作完成立即提醒)
  • Cross-Platform(macOS / Linux)
  • PostToolUse Hook(自动触发)
  • Universal Matcher(默认覆盖所有工具)
  • Lightweight(零负担)

对长时间跑测试、批量改文件、或者多步排查任务来说,这种小提醒非常实用。

安装(Installation)

npx claude-code-templates@latest --hook automation/simple-notifications

安装路径:

your-project/
├── .claude/
│   └── hooks/
│       └── simple-notifications.json

使用方式(How to Use)

Hook 会自动生效,无需显式调用:

claude

> Read the package.json file
> Edit src/index.js and add a console.log
> Run npm test

系统要求

  • macOS:使用 osascript(系统自带)
  • Linux:使用 notify-send(常见发行版自带或可安装)
# Debian/Ubuntu
sudo apt-get install libnotify-bin

自定义示例

{
  "description": "Send desktop notifications with custom messages",
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Read|Write|Edit",
        "hooks": [
          {
            "type": "command",
            "command": "notify-send 'Custom Title' 'File operation: $CLAUDE_TOOL_NAME done!'"
          }
        ]
      }
    ]
  }
}

排障(Troubleshooting)

  • macOS:检查终端通知权限
  • Linux:确认 notify-send 是否安装
which notify-send
notify-send "Test" "This is a test notification"

参考链接

Claude Guide
Vibe Coding

Claude Guide

Use Claude for writing, analysis, coding support, and longer-context AI workflows with better control.

Claude Guide通知 Hook

Simple Notifications Hook(Claude Code)

Notifications Hook Cover
Notifications Hook Cover

这类通知 hook 的价值很简单:Claude Code 跑长任务时,你不用一直盯着终端。按 Anthropic 官方当前 hooks 文档,hook 本质上就是在特定事件点自动执行自定义命令或脚本。

#主要功能(Key Capabilities)

  • Instant Notifications(操作完成立即提醒)
  • Cross-Platform(macOS / Linux)
  • PostToolUse Hook(自动触发)
  • Universal Matcher(默认覆盖所有工具)
  • Lightweight(零负担)

对长时间跑测试、批量改文件、或者多步排查任务来说,这种小提醒非常实用。

#安装(Installation)

bash
npx claude-code-templates@latest --hook automation/simple-notifications

安装路径:

bash
your-project/ ├── .claude/ │ └── hooks/ │ └── simple-notifications.json

#使用方式(How to Use)

Hook 会自动生效,无需显式调用:

bash
claude > Read the package.json file > Edit src/index.js and add a console.log > Run npm test

#系统要求

  • macOS:使用 osascript(系统自带)
  • Linux:使用 notify-send(常见发行版自带或可安装)
bash
# Debian/Ubuntu sudo apt-get install libnotify-bin

#自定义示例

json
{ "description": "Send desktop notifications with custom messages", "hooks": { "PostToolUse": [ { "matcher": "Read|Write|Edit", "hooks": [ { "type": "command", "command": "notify-send 'Custom Title' 'File operation: $CLAUDE_TOOL_NAME done!'" } ] } ] } }

#排障(Troubleshooting)

  • macOS:检查终端通知权限
  • Linux:确认 notify-send 是否安装
bash
which notify-send notify-send "Test" "This is a test notification"

#参考链接

Prompt Master

Master prompting before you push AI tools harder

Learn prompt structure and control patterns for more stable output.

Open Prompt Master →

FAQ

Claude 3.5 Sonnet 和 GPT-4o 哪个写代码更好?
目前社区公认 Claude 3.5 Sonnet 在代码逻辑、复杂重构和 Artifacts 交互体验上略胜一筹,尤其是在配合 Cursor 使用时。
Claude Projects 是什么功能?
Claude Projects 允许你上传特定的文档(如 API 文档、代码库)作为上下文知识库,让 Claude 在对话中始终基于这些资料回答,非常适合项目级开发。
如何使用 Claude Artifacts?
在对话中让 Claude 生成代码(如 React 组件、HTML/CSS),它会自动触发 Artifacts 预览窗口,你可以直接看到运行效果并进行迭代修改。