From hookify
Creates Claude Code hooks to prevent unwanted behaviors by analyzing conversation patterns or from explicit instructions. Use when user says 'create a hook', 'prevent behavior X', or invokes /hookify.
How this skill is triggered — by the user, by Claude, or both
Slash command
/hookify:hookify [optional — specific behavior to prevent, e.g.: don't use rm -rf][optional — specific behavior to prevent, e.g.: don't use rm -rf]This skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Creates rule files to prevent Claude from performing unwanted behaviors — no manual `settings.json` editing required.
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.Provides UI/UX resources: 50+ styles, color palettes, font pairings, guidelines, charts for web/mobile across React, Next.js, Vue, Svelte, Tailwind, React Native, Flutter. Aids planning, building, reviewing interfaces.
Fetches up-to-date documentation from Context7 for libraries and frameworks like React, Next.js, Prisma. Use for setup questions, API references, and code examples.
npx claudepluginhub minhthang1009/dotclaude --plugin hookify