一个 Claude Code 多插件开发仓库,用于管理和开发多个独立的 Claude Code 插件。
Claude Code Flourish 是一个插件生态集合,旨在提升 Claude Code 的开发体验。通过插件系统,你可以:
通知插件,支持在以下事件发生时发送通知到 Bark 等服务:
功能特点:
/plugin install <path-to-repo>/plugins/claude-notify
/reload-plugins
/plugin marketplace add https://cnb.cool/nowfun/claude-code-flourish.git
/plugin install claude-notify
/reload-plugins
在启动 Claude Code 前设置环境变量:
# ~/.zshrc 或 ~/.bashrc
export CLAUDE_NOTIFY_TYPE=bark
export BARK_DEVICE_KEY=your_device_key_here
plugins/
└── {plugin-name}/ # 每个插件独立目录
├── .claude-plugin/
│ └── plugin.json # 插件元数据
├── hooks/
│ └── hooks.json # 钩子事件配置
├── scripts/ # 钩子脚本实现
│ ├── *.js # 功能脚本
│ └── lib/
│ └── utils.js # 公共工具函数
└── README.md # 插件文档
{
"name": "plugin-name",
"description": "插件描述",
"version": "1.0.0",
"author": { "name": "作者名" },
"homepage": "https://cnb.cool/nowfun/-/tree/main/plugins/plugin-name",
"repository": "https://cnb.cool/nowfun/claude-code-flourish",
"license": "MIT",
"keywords": ["claude-code", "hooks"]
}
{
"$schema": "https://json.schemastore.org/claude-code-settings.json",
"hooks": {
"PreToolUse": [
{
"matcher": "Edit|Write",
"hooks": [
{
"type": "command",
"command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/handler.js\""
}
]
}
],
"PostToolUse": [],
"UserPromptSubmit": [],
"SessionEnd": []
}
}
| 事件 | 触发时机 | payload 关键字段 |
|---|---|---|
PreToolUse | 工具执行前 | tool_name, tool_input |
PostToolUse | 工具执行后(用户确认) | tool_name, tool_input, tool_result |
UserPromptSubmit | 用户提交提示 | prompt |
SessionEnd | 会话结束 | 无 |
Edit|Write - 匹配 Edit 或 Write 工具Bash - 匹配 Bash 工具#!/usr/bin/env node
const { readStdin } = require('./lib/utils');
async function handlePreToolUse(payload) {
const { tool_name, tool_input } = payload;
// 处理逻辑
}
async function main() {
try {
const payload = await readStdin();
switch (payload.hook_event_name) {
case 'PreToolUse':
await handlePreToolUse(payload);
break;
case 'PostToolUse':
await handlePostToolUse(payload);
break;
// ... 其他事件
}
} catch (error) {
// 静默处理错误,避免干扰 Claude Code 主流程
console.warn(`[plugin-name] Error: ${error.message}`);
}
}
main();
[plugin-name] 前缀标识日志和错误CLAUDE_PLUGIN_ROOT - 插件根目录的绝对路径,用于定位脚本文件plugins/{plugin-name}/ 目录开发/plugin install local-path 安装测试欢迎贡献新的插件!请遵循以下步骤:
claude-notify 的结构)marketplace.json 中注册你的插件MIT License
iGang