Skip to content
Development
Command

/from-hook

Convert Python SDK hooks to declarative rules

From plugin
claude-night-market
325163 skills59 agents163 commands1 MCP
Install
$ npx -y skills add athola/claude-night-market --agent claude-code

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/from-hook

Context preview

What this command does when you run it.

Convert Python SDK hooks to declarative rules

Command definition

from-hook.md
name: from-hook
description: Convert Python SDK hooks to declarative rules

/hookify:from-hook

Convert Python SDK hooks to declarative hookify rules.

Usage

/hookify:from-hook <hook_file.py>           # Convert single hook
/hookify:from-hook --scan <hooks_dir>       # Scan directory
/hookify:from-hook <hook.py> -o rules.md    # Output to file

What It Does

1. Parses Python hook AST 2. Extracts regex patterns, string checks, startswith/endswith 3. Generates equivalent hookify rule YAML 4. Reports unconvertible hooks (network, file I/O, complex logic)

Example

Input hook:

import re
def hook(context):
    if re.search(r"rm -rf /", context["command"]):
        return {"action": "block", "message": "Dangerous!"}

Output rule:

---
name: block-rm-rf
event: bash
pattern: 'rm -rf /'
action: block
---
Dangerous command blocked.

Limitations

Cannot convert hooks with:

  • Network calls (API requests)
  • File I/O operations
  • Complex conditional logic
  • External dependencies

See Also

  • `hookify:browse` - Browse available rules
  • `hookify:install` - Install rules
Ships withclaude-night-market

A plugin marketplace for Claude Code. Install only the plugins you need to run git workflows, code review, spec-driven development, and autonomous agents from inside your Claude Code session.

Get the whole plugin, auto-invoked
Stats
325
Stars
0
Views
35
Forks
Active
Maintenance
Python
Language
MIT
License
1d ago
Last commit
8mo ago
Created

Repo: athola/claude-night-market