logo

Simple Notifications Hook(Claude Code)

Notifications Hook Cover

Simple Notifications Hook 会在 Claude Code 完成工具执行后发送桌面通知,适合处理长任务时的提醒与节奏管理。

主要功能(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 使用指南
Vibe Coding

Claude 使用指南

Claude 是 Anthropic 开发的先进 AI 助手,以安全、有帮助和诚实著称。本指南帮助你充分发挥 Claude 的能力。

Claude 使用指南通知 Hook

Simple Notifications Hook(Claude Code)

Notifications Hook Cover
Notifications Hook Cover

Simple Notifications Hook 会在 Claude Code 完成工具执行后发送桌面通知,适合处理长任务时的提醒与节奏管理。

#主要功能(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

把 AI 工具用到极致,先掌握 Prompt

系统学习 Prompt 结构与技巧,提升输出稳定性与可控性。

进入 Prompt 大师 →

常见问题

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 预览窗口,你可以直接看到运行效果并进行迭代修改。