Sponsor Suno AI Music arrow_forward
Plugin

Hookify by anthropics

Easily create hooks to prevent unwanted behaviors by analyzing conversation patterns

Type
Plugin
GitHub stars
37.1k
License
Apache-2.0
Repo last updated
Sep 25, 2026
Author
Anthropic

What Hookify by anthropics is

Hookify by anthropics is a plugin published in the anthropics/claude-plugins-official repository on GitHub, which has about 37.1k stars. The repository describes itself as: “Official, Anthropic-managed directory of high quality Claude Code Plugins.”

A plugin is a package that bundles skills, slash commands, subagents, hooks, and MCP connectors so they install together. Plugins are plain files with a manifest at .claude-plugin/plugin.json, and they work in both Claude Code and Claude Cowork.

Installing Hookify adds everything it ships in one step. Connectors inside a plugin still need to be connected separately, and hooks and subagents only run in Cowork and Claude Code, not in regular chat.

How to install Hookify by anthropics

Claude Code

  1. Add the repository as a plugin marketplace: claude plugin marketplace add anthropics/claude-plugins-official
  2. Install the plugin: claude plugin install hookify@<marketplace-name>, using the marketplace name from the repository's .claude-plugin/marketplace.json.
  3. Restart the session if the new skills or commands don't appear straight away.

Claude Cowork

  1. Open Customize → Plugins and choose Add marketplace.
  2. Enter anthropics/claude-plugins-official (the owner/repo shorthand works for GitHub).
  3. Find Hookify in the list, click Install, then connect any connectors it needs from its Connectors tab.

New to extending Cowork? Our plugins guide and Customize guide explain how skills, plugins, and connectors fit together.

Inside the source file

An excerpt from plugins/hookify/.claude-plugin/plugin.json, shared under the repository's Apache-2.0 license. Read the full file on GitHub.

Easily create custom hooks to prevent unwanted behaviors by analyzing conversation patterns or from explicit instructions.

Overview

The hookify plugin makes it simple to create hooks without editing complex hooks.json files. Instead, you create lightweight markdown configuration files that define patterns to watch for and messages to show when those patterns match.

Key features:

  • 🎯 Analyze conversations to find unwanted behaviors automatically
  • 📝 Simple markdown configuration files with YAML frontmatter
  • 🔍 Regex pattern matching for powerful rules
  • 🚀 No coding required - just describe the behavior
  • 🔄 Easy enable/disable without restarting

Quick Start

1. Create Your First Rule

/hookify Warn me when I use rm -rf commands

This analyzes your request and creates .claude/hookify.warn-rm.local.md.

2. Test It Immediately

No restart needed! Rules take effect on the very next tool use.

Ask Claude to run a command that should trigger the rule:

Run rm -rf /tmp/test

You should see the warning message immediately!

Usage

Main Command: /hookify

With arguments:

/hookify Don't use console.log in TypeScript files

Creates a rule from your explicit instructions.

Without arguments:

/hookify

Analyzes recent conversation to find behaviors you've corrected or been frustrated by.

Helper Commands

List all rules:

/hookify:list

Configure rules interactively:

/hookify:configure

Enable/disable existing rules through an interactive interface.

Get help:

/hookify:help

Rule Configuration Format

Simple Rule (Single Pattern)

.claude/hookify.dangerous-rm.local.md:

---
name: block-dangerous-rm
enabled: true
event: bash
pattern: rm\s+-rf
action: block
---

⚠️ **Dangerous rm command detected!**

This command could delete important files. Please:
- Verify the path is correct
- Consider using a safer approach
- Make sure you have backups

Action field:

  • warn: Shows warning but allows operation (default)
  • block: Prevents operation from executing (PreToolUse) or stops session (Stop events)

Advanced Rule (Multiple Conditions)

.claude/hookify.sensitive-files.local.md:

---
name: warn-sensitive-files
enabled: true
event: file
action: warn
conditions:
  - field: file_path
    operator: regex_match
    pattern: \.env$|credentials|secrets
  - field: new_text
    operator: contains
    pattern: KEY
---

🔐 **Sensitive file edit detected!**

Ensure credentials are not hardcoded and file is in .gitignore.

All conditions must match for the rule to trigger.

Event Types

  • bash: Triggers on Bash tool commands
  • file: Triggers on Edit, Write, MultiEdit tools
  • stop: Triggers when Claude wants to stop (for completion checks)
  • prompt: Triggers on user prompt submission
  • all: Triggers on all events

Pattern Syntax

Use Python regex syntax:

Tips:

  • Use \s for whitespace
  • Escape special chars: \. for literal dot
  • Use | for OR: (foo|bar)
  • Use .* to match anything
  • Set action: block for dangerous operations
  • Set action: warn (or omit) for informational warnings

Examples

Example 1: Block Dangerous Commands

---
name: block-destructive-ops
enabled: true
event: bash
pattern: rm\s+-rf|dd\s+if=|mkfs|format
action: block
---

🛑 **Destructive operation detected!**

This command can cause data loss. Operation blocked for safety.
Please verify the exact path and use a safer approach.

This rule blocks the operation - Claude will not be allowed to execute these commands.

Example 2: Warn About Debug Code

---
name: warn-debug-code
enabled: true
event: file
pattern: console\.log\(|debugger;|print\(
action: warn
---

🐛 **Debug code detected**

Remember to remove debugging statements before committing.

This rule warns but allows - Claude sees the message but can still proceed.

Example 3: Require Tests Before Stopping

---
name: require-tests-run
enabled: false
event: stop
action: block
conditions:
  - field: transcript
    operator: not_contains
    pattern: npm test|pytest|cargo test
---

**Tests not detected in transcript!**

Before stopping, please run tests to verify your changes work correctly.

Before you install

  • Read the whole file first. Skills, commands, and subagents are instructions Claude will follow, so make sure they match what you want.
  • Check which tools, scripts, or MCP servers it uses. Local servers and scripts run with your permissions.
  • Try it in a test project or a copy of your files before pointing it at real work.
  • Pin the version you tested, and review changes before updating.
  • Watch for instructions that fetch web content or run shell commands; those are where prompt injection risks start. See our prompt injection guide.

FAQ

What is Hookify by anthropics?

Hookify by anthropics is a plugin for Claude Code and Claude Cowork from the anthropics/claude-plugins-official repository on GitHub. Easily create hooks to prevent unwanted behaviors by analyzing conversation patterns

How do I install Hookify by anthropics in Claude Code?

Add the repository as a plugin marketplace: claude plugin marketplace add anthropics/claude-plugins-official Install the plugin: claude plugin install hookify@<marketplace-name>, using the marketplace name from the repository's .claude-plugin/marketplace.json. Restart the session if the new skills or commands don't appear straight away.

Can I use Hookify by anthropics in Claude Cowork?

Open Customize → Plugins and choose Add marketplace. Enter anthropics/claude-plugins-official (the owner/repo shorthand works for GitHub). Find Hookify in the list, click Install, then connect any connectors it needs from its Connectors tab.

Is Hookify by anthropics safe to install?

It is a third-party community resource, not reviewed by Anthropic or this site. Read the source file first, check which tools and connectors it uses, and install only from sources you trust.

Similar resources

Browse all skills, subagents, and plugins →

Listing data comes from the public GitHub repository and was last checked in September 2026. Excerpts are © their authors and shared under Apache-2.0. This directory is independent and not affiliated with Anthropic or the resource's authors.