mcpField
C
custom-skills-notify

custom-skills-notify

github.com/valorvieAgent 工作流060 次安装3 周前更新
代码仓库

关于 custom-skills-notify

为 Claude Code 配置、测试并通过 Telegram 或 Discord 发送事件通知的 skill。自动事件提醒需要另行安装配套 plugin。

主要功能

  1. 01配置 Telegram 和 Discord 频道
  2. 02测试通知发送
  3. 03手动发送通知
  4. 04查看已遮蔽的频道设置
  5. 05切换事件通知

适用场景

  1. 01为 Claude Code 设置通知频道
  2. 02发送一次性状态消息
  3. 03选择触发提醒的事件

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/valorvie/ai-dev-skills --skill custom-skills-notify

安装后在 Claude Code 中输入/custom-skills-notify确认已加载。

附带文件scripts/check-config.jsscripts/notify.js

详细介绍

来自项目 README

custom-notify — Claude Code 通知系統

透過 Telegram 或 Discord 接收 Claude Code 的重要事件通知。

指令

/notify init — 初始化設定

引導使用者建立通知設定檔。詢問使用者要啟用哪些頻道(可多選)。

Telegram 設定步驟:

  1. 請使用者提供 Telegram Bot Token(從 @BotFather 取得)
  2. 請使用者提供 Chat ID(可用 @userinfobot 取得)

Discord 設定步驟:

  1. 請使用者提供 Discord Webhook URL(從 Discord 頻道設定 → 整合 → Webhook 取得)

設定檔範例 ~/.config/claude-notify/config.json:

{
  "channels": {
    "telegram": {
      "enabled": true,
      "bot_token": "<使用者提供的 token>",
      "chat_id": "<使用者提供的 chat_id>"
    },
    "discord": {
      "enabled": true,
      "webhook_url": "<使用者提供的 webhook URL>"
    }
  },
  "events": {
    "task_complete": true,
    "task_failed": true,
    "needs_input": true,
    "tool_rejected": true
  }
}

建立完成後,自動執行 /notify test 驗證連線。

注意:

  • 確保目錄存在:mkdir -p ~/.config/claude-notify
  • 如果使用者只要其中一個頻道,另一個設 "enabled": false 或不寫即可
  • 如果已有設定檔,詢問是否要新增頻道或覆蓋
/notify test — 測試連線

執行以下命令發送測試訊息:

node "<skill_path>/scripts/notify.js" --test
  • 成功:告知使用者「測試訊息已發送,請檢查通知頻道」
  • 失敗:顯示錯誤訊息並協助排查
/notify <訊息> — 手動發送通知

當使用者輸入 /notify 後面接任何文字時,發送該文字作為通知:

node "<skill_path>/scripts/notify.js" --manual --message "<使用者的訊息>"

範例:

  • /notify 部署完成,請來檢查
  • /notify 測試全部通過
/notify config — 查看目前設定

讀取並顯示 ~/.config/claude-notify/config.json 的內容(隱藏 bot_token 和 webhook_url 的中間部分)。

/notify toggle <event> — 開關事件通知

修改 ~/.config/claude-notify/config.json 中的 events 設定。

可用的 event 名稱:

  • task_complete — 任務完成通知
  • task_failed — 工具執行失敗通知
  • needs_input — 需要使用者決策通知
  • tool_rejected — 工具被拒絕通知

範例: /notify toggle task_complete — 切換任務完成通知的開關狀態

自動通知

npx skills 只安裝本 skill,不會安裝 Claude Code plugin。自動通知由 custom-skills-notify plugin 處理,監聽以下 Claude Code hook 事件:

事件觸發時機
Notification需要權限、閒置提示、需要回答問題
StopClaude 完成回應
PostToolUseFailure工具執行失敗

需要自動通知時,另外執行:

claude plugin marketplace add https://github.com/ValorVie/custom-skills.git
claude plugin install custom-skills-notify@custom-skills

這個 plugin 安裝是獨立操作,不屬於 npx skills add 的結果。

腳本路徑

通知腳本位於:<skill_path>/scripts/notify.js

使用 <skill_path> 代表此 skill 的根目錄路徑。在執行命令時,用實際的絕對路徑替換。

评论

支持 Markdown