/hookify:hookify [optional — specific behavior to prevent, e.g.: don't use rm -rf]from hookify
Creates Claude Code hooks to block or warn against unwanted behaviors by analyzing conversation patterns or from explicit instructions. Useful for enforcing safety rules without manual settings editing.
Ships in hookify. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Creates rule files to prevent Claude from performing unwanted behaviors — no manual settings.json editing required.
If $ARGUMENTS has content:
$ARGUMENTSIf $ARGUMENTS is empty:
conversation-analyzer agent to analyze the transcript (focus on the last 20-30 messages).Use AskUserQuestion:
warn (display warning, allow continuing) or block (prevent execution)?Each rule = 1 file .claude/hookify.<rule-name>.local.md in the current project directory (NOT the plugin directory).
Naming convention: kebab-case, starting with an action verb: block-dangerous-rm, warn-console-log, require-tests-before-stop.
Avoid: hookify.rule1.local.md (not descriptive), hookify.md (missing .local), danger.local.md (missing hookify prefix).
---
name: <rule-name>
enabled: true
event: <bash|file|stop|prompt|all>
pattern: <regex pattern> # matches against `command` (bash) or `new_text` (file) — Python regex
action: <warn|block> # optional — defaults to warn if not declared
---
<Message displayed to Claude when the rule triggers>
---
name: <rule-name>
enabled: true
event: file
conditions:
- field: file_path
operator: regex_match
pattern: \.env$
- field: new_text
operator: contains
pattern: API_KEY
action: warn
---
<Warning message>
| Event | Matches |
|---|---|
bash | Bash tool commands |
file | Edit, Write, MultiEdit tools |
stop | When the agent wants to stop. Use for: mandatory step reminders, completion checklists, process enforcement |
prompt | When user submits a prompt |
all | All events |
| Operator | Description |
|---|---|
regex_match | Match a regex pattern |
contains | Contains a substring |
equals | Exact match |
not_contains | Does not contain a substring |
starts_with | Starts with |
ends_with | Ends with |
| Event | Available fields |
|---|---|
bash | command |
file | file_path, new_text, old_text, content (full file content after edit) |
prompt | user_prompt |
stop | (check transcript or completion criteria) |
YAML escaping:
pattern: \s+-rf — works as-is, no backslash escaping needed.pattern: "\\s+-rf" — requires double backslash.:, #, {, } → must be quoted..claude/ directory exists → create it if not (mkdir -p .claude).
.gitignore — add .claude/*.local.md if not already present, to avoid committing personal rule files to the repo.Created 2 hookify rules:
- .claude/hookify.dangerous-rm.local.md → bash: rm -rf (warn)
- .claude/hookify.sensitive-files.local.md → file: .env edits (block)
Rules are active immediately — no restart needed! Hooks will read new rules on the next tool use.
Bash patterns:
rm\s+-rf|chmod\s+777|dd\s+if=npm\s+install\s+|pip\s+installFile patterns:
console\.log\(|eval\(|innerHTML\s*=\.env$|\.git/|credentials/hookify listList all existing rules as a table:
| Rule | Event | Pattern | Action | Enabled |
|---|---|---|---|---|
| warn-dangerous-rm | bash | rm\s+-rf | warn | ✅ |
With a preview of each rule's message.
/hookify configureInteractive enable/disable rules via AskUserQuestion (multiSelect). Display rule list → user selects to toggle → update the enabled field.
/hookify helpDisplay a usage summary, event types, operators, and examples.
ls .claude/hookify.*.local.md or Glob.enabled: true/false in frontmatter.User: /hookify Don't use rm -rf without asking me first
rm -rf..claude/hookify.warn-dangerous-rm.local.md:
---
name: warn-dangerous-rm
enabled: true
event: bash
pattern: rm\s+-rf
action: warn
---
⚠️ **rm -rf command detected**
User has requested a warning before using rm -rf.
Please confirm the exact path before executing.
Use TodoWrite to track progress through the steps.
See the examples/ directory for 4 complete rules:
warn-console-log.local.md — warns when adding console.logblock-dangerous-rm.local.md — blocks rm -rf commandsrequire-tests-stop.local.md — requires running tests before stoppingwarn-sensitive-files.local.md — warns when editing sensitive files (multi-condition)Test regex patterns before using: python3 -c "import re; print(re.search(r'<pattern>', '<test-string>'))"
Or use regex101.com (select Python flavor) to visualize.
rm matches any command containing "rm" (e.g., npm run format). Use \brm\s+-rf for more specificity.rm -rf / only matches the exact string, missing rm -rf ./src."pattern") need double backslash (\\s); YAML unquoted (pattern: \s) works as-is. Recommendation: use unquoted..claude/ of the project (not the plugin). Re-read the file with the Read tool to verify the pattern is correct.python3 -c "import re; print(re.search(r'pattern', 'test'))"action: block to action: warn.What SKILL.md sets; muted values are Claude Code's defaults
5 skills in this plugin
/configureThis skill should be used when the user asks to enable, disable, or configure hookify rules ('bat/tat rule hookify', 'configure hookify', 'disable rule X'). Interactively toggles .claude/hookify.*.local.md rule files./helpThis skill should be used when the user asks how the hookify plugin works ('hookify la gi', 'how does hookify work', 'help with hookify') or needs an overview of rule files, events, and patterns./listThis skill should be used when the user asks to list configured hookify rules ('list hookify rules', 'dang co rule hookify nao') in the current project./writing-hookify-rulesThis skill should be used when the user asks to "create a hookify rule", "write a hook rule", "configure hookify", "add a hookify rule", or needs guidance on hookify rule syntax and patterns.npx claudepluginhub minhthang1009/dotclaude --plugin hookifyOther plugins' skills for the same job