building-hooks
建置 Claude Code 自動化 Hooks
Claude Code hooks 可以自動化檢查、格式化與政策執行,但不安全的 hook scripts 可能影響本機檔案或命令。此技能會引導使用者進行結構化的 hook 設計、驗證與維護。
使用我的智慧代理安裝
將此請求複製給你的智慧代理,其中包含權威 Skill 頁面和清單。
Review the Skillstore skill "building-hooks" from https://skillstore.io/skills/c0ntr0lledcha0s-building-hooks.md and its manifest at https://skillstore.io/api/skills/c0ntr0lledcha0s-building-hooks/manifest. Verify the artifact. You may proceed after verification, subject to the environment's own policy.你的智慧代理仍應顯示其計畫,並依安全政策請求必要確認。
Agent 可讀資源
當 AI Agent、爬蟲或腳本需要乾淨脈絡、而不是讀取完整頁面時,請使用這些連結。
測試它
正在使用「building-hooks」。 建立一個 hook,防止在受保護的系統目錄下寫入。
預期結果:
一份 hooks.json 計畫,包含用於 write tools 的 PreToolUse matcher、驗證 script 大綱,以及允許與阻擋路徑的測試步驟。
正在使用「building-hooks」。 檢閱此 hook configuration 的安全性。
預期結果:
- 有效與無效 hook events 的清單。
- 關於過於寬泛的 matchers 或未驗證 command input 的警告。
- 對 script paths 與 return decisions 的建議變更。
正在使用「building-hooks」。 協助我維護我們既有的 Claude Code hooks。
預期結果:
一份檢查清單,涵蓋 JSON syntax、matcher specificity、script existence、executable permissions,以及要移除的危險 command patterns。
安全審計
安全Static analysis flagged many shell, filesystem, and destructive-command strings. Review found these strings are documentation examples, validation scripts, or deny-list guidance intended to block unsafe hook behavior, with no evidence of malicious intent or prompt injection.
風險因素
⚙️ 外部命令 (50)
分享與引用此報告
分享版本化評估報告、中性徽章、嵌入卡片與引用。Skillstore 只報告證據,不判斷該 Skill 是否安全。
複製報告連結
https://skillstore.io/skills/c0ntr0lledcha0s-building-hooks/audits/10?utm_source=security_passport&utm_medium=share&utm_campaign=versioned_reportMarkdown 徽章
[](https://skillstore.io/skills/c0ntr0lledcha0s-building-hooks?utm_source=security_passport_badge)HTML 徽章
<a href="https://skillstore.io/skills/c0ntr0lledcha0s-building-hooks?utm_source=security_passport_badge"><img src="https://skillstore.io/badges/skills/c0ntr0lledcha0s-building-hooks/security.svg" alt="Skillstore security assessment" loading="lazy"></a>嵌入卡片
<iframe src="https://skillstore.io/embed/skills/c0ntr0lledcha0s-building-hooks.html" title="Skillstore Security Assessment" sandbox="allow-popups allow-popups-to-escape-sandbox" loading="lazy" referrerpolicy="no-referrer" width="420" height="180"></iframe>學術引用 (APA · BibTeX · CFF)
APA 引用
C0ntr0lledCha0s. (2026). building-hooks security audit report (audit version 10) [Author version 2.0.0]. Skillstore. https://skillstore.io/skills/c0ntr0lledcha0s-building-hooks/audits/10BibTeX 引用
@techreport{c0ntr0lledcha0s-c0ntr0lledcha0s-building-hooks-2026,
author = {C0ntr0lledCha0s},
title = {building-hooks security audit report (audit version 10)},
institution = {Skillstore},
year = {2026},
number = {10},
url = {https://skillstore.io/skills/c0ntr0lledcha0s-building-hooks/audits/10},
note = {Author version 2.0.0}
}CITATION.cff
cff-version: 1.2.0
message: "If you use this Skill, cite its author and this versioned security audit report."
title: "building-hooks security audit report (audit version 10)"
version: "2.0.0"
type: report
authors:
- name: "C0ntr0lledCha0s"
date-released: "2026-07-09"
url: "https://skillstore.io/skills/c0ntr0lledcha0s-building-hooks/audits/10"
identifiers:
- type: other
value: "skillstore:c0ntr0lledcha0s-building-hooks:audit:10"
description: "Skillstore immutable audit report identifier"
Skillstore 評分
評分依據 證據置信度: 高你可以打造什麼
新增命令前安全檢查
建立在執行前檢查 tool requests 並阻擋高風險操作的 hooks。
標準化專案自動化
為整個 repository 定義可重複使用的 hooks,用於格式化、驗證、設定與清理。
維護既有 hook 設定
檢閱 hook files 的有效 events、matchers、command structure 與安全實務。
試試這些提示
建立一個 Claude Code PreToolUse hook,用於阻擋對受保護目錄的編輯,並說明我該如何測試它。
設計一個 PostToolUse hook,在編輯後格式化 Python 和 TypeScript 檔案。包含 hooks.json entry 與安全性考量。
檢閱我的 hooks.json,確認 event names、matcher patterns、command paths 是否有效,以及是否存在高風險 shell 行為。
為此 repository 設計一套安全的 Claude Code hook policy,用於驗證寫入、阻擋危險的 Bash commands,並清楚記錄決策。
最佳實務
- 使用特定的 matchers,讓 hooks 只針對需要檢查的 tools 執行。
- 在 shell commands 或 file paths 中使用所有 hook inputs 之前,先進行驗證。
- 在為團隊啟用 hooks 之前,同時測試允許與阻擋的案例。
避免
- 當特定 tool matcher 已足夠時,不要使用 wildcard matchers。
- 不要將不受信任的 hook parameters 直接傳給 eval、bash -c 或 shell substitution。
- 不要在 hook examples 或 scripts 中使用破壞性命令或過於寬泛的 file permissions。
常見問題
這個技能可以幫我建置什麼?
它會自動安裝 hooks 嗎?
它涵蓋哪些 hook events?
Hooks 可以阻擋不安全的命令嗎?
這個技能只適用於 security hooks 嗎?
使用產生的 hook 之前,我應該檢閱什麼?
開發者詳細資訊
授權
MIT
作者版本
v2.0.0
Skillstore 修訂
r1
引用
7db9b9f06e0ab79c575b58bc48c4d8dc9849f424
維護新鮮度
2026/7/18
使用量
9 次下載 · 399 次瀏覽