feat: restore hookify command bundle

This commit is contained in:
Affaan Mustafa
2026-04-05 17:50:31 -07:00
parent ff303d71b6
commit 56bd57c543
11 changed files with 201 additions and 17 deletions

View File

@@ -0,0 +1,14 @@
---
description: Enable or disable hookify rules interactively
---
Interactively enable or disable existing hookify rules.
## Steps
1. Find all `.claude/hookify.*.local.md` files
2. Read the current state of each rule
3. Present the list with current enabled / disabled status
4. Ask which rules to toggle
5. Update the `enabled:` field in the selected rule files
6. Confirm the changes

46
commands/hookify-help.md Normal file
View File

@@ -0,0 +1,46 @@
---
description: Get help with the hookify system
---
Display comprehensive hookify documentation.
## Hook System Overview
Hookify creates rule files that integrate with Claude Code's hook system to prevent unwanted behaviors.
### Event Types
- `bash`: triggers on Bash tool use and matches command patterns
- `file`: triggers on Write/Edit tool use and matches file paths
- `stop`: triggers when a session ends
- `prompt`: triggers on user message submission and matches input patterns
- `all`: triggers on all events
### Rule File Format
Files are stored as `.claude/hookify.{name}.local.md`:
```yaml
---
name: descriptive-name
enabled: true
event: bash|file|stop|prompt|all
action: block|warn
pattern: "regex pattern to match"
---
Message to display when rule triggers.
Supports multiple lines.
```
### Commands
- `/hookify [description]` creates new rules and auto-analyzes the conversation when no description is given
- `/hookify-list` lists configured rules
- `/hookify-configure` toggles rules on or off
### Pattern Tips
- use regex syntax
- for `bash`, match against the full command string
- for `file`, match against the file path
- test patterns before deploying

21
commands/hookify-list.md Normal file
View File

@@ -0,0 +1,21 @@
---
description: List all configured hookify rules
---
Find and display all hookify rules in a formatted table.
## Steps
1. Find all `.claude/hookify.*.local.md` files
2. Read each file's frontmatter:
- `name`
- `enabled`
- `event`
- `action`
- `pattern`
3. Display them as a table:
| Rule | Enabled | Event | Pattern | File |
|------|---------|-------|---------|------|
4. Show the rule count and remind the user that `/hookify-configure` can change state later.

50
commands/hookify.md Normal file
View File

@@ -0,0 +1,50 @@
---
description: Create hooks to prevent unwanted behaviors from conversation analysis or explicit instructions
---
Create hook rules to prevent unwanted Claude Code behaviors by analyzing conversation patterns or explicit user instructions.
## Usage
`/hookify [description of behavior to prevent]`
If no arguments are provided, analyze the current conversation to find behaviors worth preventing.
## Workflow
### Step 1: Gather Behavior Info
- With arguments: parse the user's description of the unwanted behavior
- Without arguments: use the `conversation-analyzer` agent to find:
- explicit corrections
- frustrated reactions to repeated mistakes
- reverted changes
- repeated similar issues
### Step 2: Present Findings
Show the user:
- behavior description
- proposed event type
- proposed pattern or matcher
- proposed action
### Step 3: Generate Rule Files
For each approved rule, create a file at `.claude/hookify.{name}.local.md`:
```yaml
---
name: rule-name
enabled: true
event: bash|file|stop|prompt|all
action: block|warn
pattern: "regex pattern"
---
Message shown when rule triggers.
```
### Step 4: Confirm
Report created rules and how to manage them with `/hookify-list` and `/hookify-configure`.