# Write Hookify Rules for Claude Code

Hook rules can be hard to write correctly across bash, file, stop, and prompt events. This skill gives Claude, Codex, and Claude Code practical guidance for creating and testing Hookify rules.

## Install

```bash
npx skillstore add anthropics/writing-hookify-rules
```

## Metadata

- Status: approved
- Slug: writing-hookify-rules
- Version: 0.1.0
- Author version: 0.1.0
- Skillstore revision: r1
- Version status: valid
- Tree hash: c8f8fed4693eac590f0829f2297bd34d57d509852bf15cca24eacfd8b24a0ce9
- Author: anthropics
- GitHub username: anthropics
- License: MIT
- Repository: https://github.com/anthropics/claude-code/tree/main/plugins/hookify/skills/writing-rules
- Ref: 26421118b848d9f1efc0aa169d8a7a9e7e0a877e
- Supported tools: Claude, Codex, Claude Code
- Audit status: complete
- Agent install advisory: allowed
- Manual install advisory: allowed
- Artifact signature: available
- Audit attestation: unavailable
- Human verification: not\_verified
- Risk factors: scripts, external\_commands, env\_access
- Quality score: 82
- Quality tier: silver
- Public page: https://skillstore.pages.dev/skills/writing-hookify-rules
- Manifest: https://skillstore.pages.dev/api/skills/writing-hookify-rules/manifest

## Capabilities

- Explains Hookify rule structure with YAML frontmatter and markdown messages.
- Describes bash, file, stop, prompt, and all event types.
- Shows single-pattern and multi-condition rule formats.
- Gives regex guidance for matching commands, edits, and prompts.
- Recommends naming, storage, testing, and gitignore practices.

## Use Cases

- Block risky terminal commands: Create a rule that warns or blocks commands such as recursive deletion, broad permission changes, or production deployment steps.
- Warn about unsafe file edits: Build file rules that catch debug statements, sensitive file changes, or generated file edits before they enter a workflow.
- Add completion checklists: Write stop-event rules that remind agents to run tests, check builds, or update documentation before finishing work.

## Prompt Templates

### Create a basic rule

```
Create a Hookify rule that warns when Claude tries to run a risky bash command. Include the event, pattern, action, and message.
```

### Convert a policy into a rule

```
Turn this team policy into a Hookify rule: [paste policy]. Explain the event type, matching pattern, and warning message.
```

### Design multi-condition matching

```
Write a Hookify file rule with multiple conditions for TypeScript files. It should warn when new text adds debug logging.
```

### Review a rule set

```
Review these Hookify rules for clarity, false positives, naming, and maintainability. Suggest specific improvements without changing the intent.
```

## Limitations

- Does not install Hookify or create plugin dependencies.
- Does not validate rules against a running Hookify engine.
- Does not provide a full regex safety analysis.
- Requires users to adapt examples to their project policies.

## Best Practices

- Use narrow patterns that match the behavior you actually want to catch.
- Write rule messages that explain the risk and suggest a safe next step.
- Name local rule files clearly and keep them inside the project Claude directory.

## Anti Patterns

- Using broad words that match unrelated commands, filenames, or prompts.
- Blocking common development actions without explaining the reason.
- Storing local Hookify rules in shared locations when they are project-specific.

## Security Audit

- Audited at: 2026-07-09T14:53:34.692\+00:00
- Summary: All static findings were false positives caused by markdown code fences, inline code formatting, and example regex patterns in SKILL.md. The skill provides documentation for writing Hookify rules and does not execute commands, evaluate code, read secrets, or access sensitive files.

## Stats

- Views: 383
- Downloads: 17
- Favorites: 0
- Popularity score: 0
