Skip to content

Guide · Agent skill

How to use the Writing Hookify Rules agent skill

Updated · written with AI from the project's own documentation and checked against our catalogue data

The writing-hookify-rules skill teaches an AI agent the file format for hookify rules, which are small markdown files that tell Claude Code to warn about or block actions matching a pattern. It is aimed at developers who want guardrails in Claude Code, and at people who are new to regular expressions. After following this guide you will know how to install the skill, ask the agent for a rule in plain language, and check the rule files it produces.

Writing Hookify Rulesanthropics/claude-plugins-official · Apache-2.0

Quick start

  1. 1Install hookify. Make sure the hookify plugin is installed in Claude Code, since the rules only run through it.
  2. 2Add the skill. Unzip the downloaded skill into ~/.claude/skills/ or your project's .claude/skills/, or upload it under Settings → Capabilities → Skills.
  3. 3Describe the behaviour. Ask the agent in plain language for a rule that catches the action you want to watch.
  4. 4Review the generated file. Check the name, event, pattern and message in the .claude/hookify.{name}.local.md file it creates.
  5. 5Test the pattern. Run the Python 3 test command or try sample text in a regex tester before relying on it.
  6. 6Trigger and refine. Perform the action in Claude Code, see whether the warning appears, and adjust the pattern or message.

What is an agent skill and what does this one do?

An agent skill is a folder with a SKILL.md file that gives an AI agent specific instructions for a task. This skill applies only inside a workflow that uses hookify, a tool for Claude Code that watches what the agent does and can show it a warning or block an action when a pattern matches.

The skill covers the rule format: a markdown file with settings at the top (name, enabled switch, event type, and either a regex pattern or a list of conditions) and a message below that the agent reads when the rule fires. With it installed, the agent can help you create, edit and test these rules.

Install the Writing Hookify Rules skill

Download the ZIP from this page and unzip it. For a personal install, place the folder in ~/.claude/skills/. For a single project, place it in that project's .claude/skills/ folder.

You can also upload the skill in the Claude apps under Settings → Capabilities → Skills.

Hookify itself must be installed in Claude Code for the rules to do anything.

  • Personal: ~/.claude/skills/
  • Project only: .claude/skills/ inside your project

Trigger the skill with natural requests

You do not need to name the skill. The skill description is written to load when you ask for things such as creating a hookify rule, writing a hook rule, configuring hookify, adding a hookify rule, or when you need help with hookify rule syntax and patterns.

Describe the behaviour you want to catch and which kind of event it happens on. The agent will then pick the event type and write the pattern.

  • "Create a hookify rule that warns me before running rm -rf."
  • "Add a hookify rule that warns when a console.log is added to a TypeScript file."
  • "Configure hookify so it reminds me to run tests before the agent stops."

Understand the rule file format

Each rule lives in .claude/hookify.{rule-name}.local.md. The frontmatter holds name, enabled and event, plus a pattern for simple rules. The text below the frontmatter is the message Claude sees when the rule triggers.

Event types are bash (Bash commands), file (Edit, Write and MultiEdit), stop (when the agent wants to stop), prompt (when the user submits a prompt) and all. An optional action field can be warn (the default) or block. For rules with several conditions, use a conditions list instead of pattern; all conditions must match for the rule to trigger.

  • name: kebab-case and action-oriented, such as warn-dangerous-rm
  • enabled: true or false, so you can switch a rule off without deleting it
  • event: bash, file, stop, prompt or all
--- name: rule-identifier enabled: true event: bash|file|stop|prompt|all pattern: regex-pattern-here --- Message to show Claude when this rule triggers.

Test and refine patterns

Patterns use Python regex syntax. The skill suggests testing a pattern with Python 3 before you rely on it. Watch for patterns that are too broad, such as matching log inside login, and for escaping mistakes in YAML: unquoted patterns are the recommended form.

Rules are read on the next tool use, so you can test a change straight away. To disable a rule temporarily, set enabled to false; to remove it permanently, delete the .local.md file.

  • Broad: pattern log also matches login and dialog. Better: console\.log\(|logger\.
  • Specific: rm -rf /tmp only matches one path. Better: rm\s+-rf
python3 -c "import re; print(re.search(r'your_pattern', 'test text'))"

Keep rule files out of version control

The skill recommends putting all rules in the .claude/ directory and adding .claude/*.local.md to your .gitignore, so personal guardrails are not committed. Give files descriptive names such as hookify.dangerous-rm.local.md or hookify.require-tests.local.md rather than hookify.rule1.local.md.

.claude/*.local.md

What people use it for

  • Warn before the agent runs dangerous shell commands such as rm -rf, dd or mkfs.
  • Block or warn on sudo and chmod 777 in Bash commands.
  • Warn when debug code like console.log or debugger is added to a file.
  • Warn when edits touch .env or .pem files, with a reminder to check .gitignore.
  • Remind the agent to run tests and check documentation before it stops.

Frequently asked questions

Is the Writing Hookify Rules skill free?

The source file does not state a licence beyond the listing's Apache-2.0 licence for the repository. Check that licence for terms. Hookify and Claude Code are separate products and are not covered by this page.

What do I need to use this skill?

You need Claude Code with the hookify plugin installed. Python 3 is needed only if you want to use the suggested command for testing regex patterns. The skill runs no scripts and uses no network.

How do I install the writing-hookify-rules skill?

Download the ZIP from this page and unzip it into ~/.claude/skills/ for personal use or into a project's .claude/skills/ folder. You can also upload it in the Claude apps under Settings → Capabilities → Skills.

Can hookify rules replace security tools?

No. Regex patterns are easy to evade and warnings can be ignored, so they are not a security boundary. Real access control needs other tools.

How do I turn off a hookify rule?

Set enabled to false in the rule's frontmatter to disable it temporarily. Delete the .local.md file to remove it permanently.

Why isn't my hookify rule triggering?

Check that the file is named .claude/hookify.{name}.local.md, that enabled is true, and that the event matches the tool you used. Then test the pattern, since an escaping mistake in YAML is a common cause.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

This skill is worth installing if you use Claude Code with hookify and want the agent to write correct rule files, especially if you are new to regex. Do not rely on it for security enforcement; use proper access controls for that. If you do not use coding-agent hooks, it will not be useful to you.

Download the skill