Skip to content

Writing Hookify Rules

Guides the agent to write hookify rule files that warn about or block risky commands and code patterns.

Stars
45,770
Licence
Apache-2.0
Files
1 file

What it does

Hookify is 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, for example a dangerous shell command or a debug line being added to code. This skill teaches the agent the format of those rules: small markdown files with settings at the top (name, on/off switch, which kind of event to watch, and a regex pattern or list of conditions) and a message below that the agent reads when the rule fires. Once installed, the agent can help you create, edit, and test these rules correctly.

Great for

  • Developers who want guardrails against risky commands such as rm -rf or sudo in Claude Code
  • Teams that want reminders, such as checking tests before the agent stops, or warnings about editing .env files
  • People new to regular expressions who want help writing and testing patterns

Skip it if

  • Users who expect a rule to be a perfect security boundary: regex patterns are easy to evade and warnings can be ignored, so real access control needs other tools
  • Non-developers with no use for coding-agent hooks, since the skill only makes sense inside an agent workflow that uses hookify

Try asking

  • “Create a hookify rule that warns me when a command uses rm -rf”
  • “Write a hookify rule that warns when console.log is added to TypeScript files”
  • “Help me configure a hookify stop rule that reminds the agent to run tests before finishing”
  • “Check whether my hookify regex pattern for sudo matches what I expect”
Step-by-step guide: how to use Writing Hookify RulesInstall, first run, examples, tips and FAQs

Install in 3 steps

  1. 1

    Download the skill

    The ZIP contains the 1 original files, the Apache-2.0 licence and an attribution note.

    writing-rules.zip
  2. 2

    Add it to your agent

    Claude Code (all projects)

    mkdir -p ~/.claude/skills && unzip writing-rules.zip -d ~/.claude/skills/

    Claude Code / Agent SDK (this project only)

    mkdir -p .claude/skills && unzip writing-rules.zip -d .claude/skills/

    Claude apps (web/desktop): Settings → Capabilities → Skills → Upload skill, and choose the ZIP.

  3. 3

    Ask for the task

    No special command needed — the agent reads the skill's description and loads it when your request matches. Try one of the prompts above.

Get better results

  • Use unquoted YAML patterns such as pattern: rm\s+-rf to avoid double-escaping mistakes, and test each pattern before relying on it.
  • Start rules with action set to warn and only switch to block once you are confident they do not catch legitimate work.
  • Add .claude/*.local.md to your .gitignore so personal rules are not committed to shared repositories.

What's inside

  • SKILL.md

Redistributed unmodified from anthropics/claude-plugins-official under the Apache-2.0 licence. The assessment was drafted with AI from the skill's files on 2026-10-29. Skills can instruct your agent to run code — read SKILL.md and any scripts before installing.