# Ancplua Ancplua Claude Plugins Writing Rules

> Writing Hookify Rules

- Skill: `tomevault-io/ancplua-ancplua-claude-plugins-writing-rules` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/ancplua-ancplua-claude-plugins-writing-rules`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/ancplua-ancplua-claude-plugins-writing-rules/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: tomevault-io (https://skillmd.com/u/tomevault-io)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tomevault-io/ancplua-ancplua-claude-plugins-writing-rules

---


# Writing Hookify Rules

## When to Use

- User asks to create, write, or configure hookify rules
- User wants to prevent specific behaviors in Claude Code

## Process

1. **Identify the behavior** to prevent
2. **Choose the event type** (bash, file, stop, prompt, all)
3. **Write the pattern** (regex or conditions)
4. **Create the rule file** in `.claude/hookify.{name}.local.md`
5. **Test immediately** — rules take effect on next tool use

## Rule File Format

```markdown
---
name: rule-identifier
enabled: true
event: bash|file|stop|stopfailure|prompt|all
pattern: regex-pattern-here
---

Message shown to Claude when rule triggers.
```

## Event Types

| Event | Matches Against | Use For |
|-------|----------------|---------|
| `bash` | Command text | Dangerous commands, privilege escalation |
| `file` | File path + content | Debug code, sensitive files, security risks |
| `stop` | Always (use `.*`) | Completion checklists, required steps |
| `stopfailure` | `error_type`, `error_message` | API error alerts, rate limit handling |
| `prompt` | User prompt text | Deployment gates, process enforcement |
| `all` | All events | Cross-cutting concerns |

## Actions

- `warn` (default): Show message, allow operation
- `block`: Prevent operation entirely

## Advanced: Multiple Conditions

```yaml
conditions:
  - field: file_path
    operator: regex_match
    pattern: \.env$
  - field: new_text
    operator: contains
    pattern: API_KEY
```

**Operators:** `regex_match`, `contains`, `equals`, `not_contains`, `starts_with`, `ends_with`

**Fields:** bash → `command` | file → `file_path`, `new_text`, `old_text`, `content` | prompt → `user_prompt`

All conditions must match for the rule to trigger.

## File Organization

- **Location:** `.claude/hookify.{descriptive-name}.local.md`
- **Gitignore:** Add `.claude/*.local.md` to `.gitignore`
- **Naming:** Start with verb: `warn-dangerous-rm`, `block-console-log`, `require-tests`

See `references/` for regex patterns, examples, and common pitfalls.

## If Connectors Available

- ~~github~~ Commit generated rule files and open a PR for team review
- ~~slack~~ Notify the team when a new blocking rule is added to the project
- ~~linear~~ Track rule creation as a task linked to the behavior it guards against

---
> Converted and distributed by [TomeVault](https://tomevault.io/claim/ancplua) — claim your Tome and manage your conversions.
<!-- tomevault:4.0:skill_md:2026-04-13 -->

