
Writing Hookify Rules
This lets you set up guardrails for Claude Code by writing markdown files with YAML frontmatter that pattern match against bash commands, file edits, agent stops, or prompts. You drop these files in `.claude/hookify.{rule-name}.local.md` and define regex patterns that either warn or block when they match. The use cases are obvious: stop yourself from running `rm -rf /`, catch leftover `console.log` statements before commit, protect `.env` files, or require a checklist before the agent stops. It's straightforward regex matching with simple operators like `contains` and `starts_with`, nothing fancy. Worth setting up a few rules early so you don't have to babysit the agent as much later.
- skills.sh installs
- 7.4K
- GitHub stars
- 46.7K
- last updated
- Aug 21, 2026
Install
$ npx -y skills add anthropics/claude-plugins-official --skill writing-hookify-rules --agent claude-codeInstalls into .claude/skills of the current project.
Files
Writing Hookify Rules
Overview
Hookify rules are markdown files with YAML frontmatter that define patterns to watch for and messages to show when those patterns match. Rules are stored in .claude/hookify.{rule-name}.local.md files.
Rule File Format
Basic Structure
---
name: rule-identifier
enabled: true
event: bash|file|stop|prompt|all
pattern: regex-pattern-here
---
Message to show Claude when this rule triggers.
Can include markdown formatting, warnings, suggestions, etc.
Frontmatter Fields
name (required): Unique identifier for the rule
- Use kebab-case:
warn-dangerous-rm,block-console-log - Be descriptive and action-oriented
- Start with verb: warn, prevent, block, require, check
enabled (required): Boolean to activate/deactivate
true: Rule is activefalse: Rule is disabled (won't trigger)- Can toggle without deleting rule
event (required): Which hook event to trigger on
bash: Bash tool commandsfile: Edit, Write, MultiEdit toolsstop: When agent wants to stopprompt: When user submits a promptall: All events
Sponsors
Details
- Repository
- github.com/anthropics/claude-plugins-official
- Category
- Documentation
- First seen
- May 16, 2026
More from anthropics/claude-plugins-official
All 24- Build Mcp Server7.4K
- Plugin Structure7.3K
- Plugin Settings7.3K
- Build Mcp App7.1K
- Build Mcpb6.9K
- Math Olympiad4.7K
- Configure4.5K
- Access4.5K
- Session Report4.3K
- M5 Onboard3.5K
- Cardputer Buddy3.5K
- Stripe Best Practices1.4K
- Example Skill208
- Frontend Design18.4K
- Claude Md Improver14.2K
- Claude Automation Recommender10.7K
- Playground8.6K
- Skill Creator8.3K
- Agent Development7.9K
- Skill Development7.7K
- Hook Development7.5K
- Mcp Integration7.5K
- Command Development7.4K