Available in
Marketplaces, most starred first
Tags
Add to README
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
By DennisLiuCkv0.1.0In 1 marketplace
Turns a plain-language request or a repeated correction into a rule that warns or blocks matching commands and file edits. Hooks run on every prompt and tool call, and rules with action: block can stop a command before it runs.
Trending plugins
7-day copy clicks
Run automatically on Claude Code events. Claude doesn't decide.
1 critical · 2 cautions to review before installing
A hook runs before every tool call and can block or approve it
A hook runs when Claude uses the Bash tool
A hook runs when Claude writes or edits files
Static checks of hooks, mods, MCP servers and commands. Not a security audit.
Of the plugin's README
Chinese
1 marketplace, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
通過分析對話模式或明確指示輕鬆創建自定義鉤子來防止不需要的行為。
hookify 插件使創建鉤子變得簡單,無需編輯複雜的 hooks.json 文件。相反,您創建輕量級 markdown 配置文件,定義要監視的模式和匹配這些模式時顯示的消息。
主要功能:
/hookify 在我使用 rm -rf 命令時警告我
這會分析您的請求並創建 .claude/hookify.warn-rm.local.md。
無需重新啟動! 規則會在下一次工具使用時立即生效。
要求 Claude 運行應觸發規則的命令:
運行 rm -rf /tmp/test
您應該立即看到警告消息!
帶參數:
/hookify 不要在 TypeScript 文件中使用 console.log
根據您的明確指示創建規則。
不帶參數:
/hookify
分析最近的對話以查找您更正或感到沮喪的行為。
列出所有規則:
/hookify:list
互動配置規則:
/hookify:configure
通過互動界面啟用/禁用現有規則。
獲取幫助:
/hookify:help
.claude/hookify.dangerous-rm.local.md:
---
name: block-dangerous-rm
enabled: true
event: bash
pattern: rm\s+-rf
action: block
---
⚠️ **檢測到危險的 rm 命令!**
此命令可能刪除重要文件。請:
- 驗證路徑是否正確
- 考慮使用更安全的方法
- 確保您有備份
操作字段:
warn:顯示警告但允許操作(默認)block:阻止操作執行(PreToolUse)或停止會話(Stop 事件).claude/hookify.sensitive-files.local.md:
---
name: warn-sensitive-files
enabled: true
event: file
action: warn
conditions:
- field: file_path
operator: regex_match
pattern: \.env$|credentials|secrets
- field: new_text
operator: contains
pattern: KEY
---
🔐 **檢測到敏感文件編輯!**
確保憑據未硬編碼,並且文件在 .gitignore 中。
所有條件都必須匹配 才能觸發規則。
bash:在 Bash 工具命令上觸發file:在 Edit、Write、MultiEdit 工具上觸發stop:當 Claude 想要停止時觸發(用於完成檢查)prompt:在用戶提示提交時觸發all:在所有事件上觸發使用 Python 正則表達式語法:
| 模式 | 匹配 | 示例 |
|---|---|---|
rm\s+-rf | rm -rf | rm -rf /tmp |
console\.log\( | console.log( | console.log("test") |
(eval|exec)\( | eval( 或 exec( | eval("code") |
\.env$ | 以 .env 結尾的文件 | .env, .env.local |
chmod\s+777 | chmod 777 | chmod 777 file.txt |
提示:
\s 表示空白\. 表示字面點| 表示 OR:(foo|bar).* 匹配任何內容action: block 用於危險操作action: warn(或省略)用於信息性警告---
name: block-destructive-ops
enabled: true
event: bash
pattern: rm\s+-rf|dd\s+if=|mkfs|format
action: block
---
🛑 **檢測到破壞性操作!**
此命令可能導致數據丟失。出於安全考慮,操作已被阻止。
請驗證確切路徑並使用更安全的方法。
此規則阻止操作 - Claude 將不被允許執行這些命令。
---
name: warn-debug-code
enabled: true
event: file
pattern: console\.log\(|debugger;|print\(
action: warn
---
🐛 **檢測到調試代碼**
在提交之前記得刪除調試語句。
此規則警告但允許 - Claude 看到消息但仍可繼續。
---
name: require-tests-run
enabled: false
event: stop
action: block
conditions:
- field: transcript
operator: not_contains
pattern: npm test|pytest|cargo test
---
**未在記錄中檢測到測試!**
停止之前,請運行測試以驗證您的更改是否正常工作。
如果會話記錄中沒有測試命令,這會阻止 Claude 停止。僅在需要嚴格執行時啟用。
同時檢查多個字段:
---
name: api-key-in-typescript
enabled: true
event: file
conditions:
- field: file_path
operator: regex_match
pattern: \.tsx?$
- field: new_text
operator: regex_match
pattern: (API_KEY|SECRET|TOKEN)\s*=\s*["']
---
🔐 **TypeScript 中的硬編碼憑據!**
使用環境變量而不是硬編碼值。
regex_match:模式必須匹配(最常見)contains:字符串必須包含模式equals:精確字符串匹配not_contains:字符串不得包含模式starts_with:字符串以模式開頭ends_with:字符串以模式結尾對於 bash 事件:
command:bash 命令字符串對於 file 事件:
file_path:正在編輯的文件路徑new_text:正在添加的新內容(Edit、Write)old_text:正在替換的舊內容(僅 Edit)content:文件內容(僅 Write)對於 prompt 事件:
user_prompt:用戶提交的提示文本對於 stop 事件:
暫時禁用:
編輯 .local.md 文件並設置 enabled: false
重新啟用:
設置 enabled: true
或使用互動工具:
/hookify:configure
只需刪除 .local.md 文件:
rm .claude/hookify.my-rule.local.md
/hookify:list
此插件是 Claude Code Marketplace 的一部分。安裝市場後,它應該會自動發現。
手動測試:
cc --plugin-dir /path/to/hookify
規則未觸發:
.claude/ 目錄中(在項目根目錄,而不是插件目錄)enabled: true/hookify:list 查看規則是否已加載導入錯誤:
python3 --version模式不匹配:
python3 -c "import re; print(re.search(r'pattern', 'text'))"鉤子似乎很慢:
發現有用的規則模式?考慮通過 PR 分享示例文件!
MIT License
Built from public signals: copy clicks on this site, GitHub stars and activity, the README and the manifest. Not a security audit or an endorsement.
npx claudepluginhub dennisliuck/claude-plugin-marketplace --plugin hookifyPlugins from other owners that cover similar ground