Directory · Hooks
rule2hook
A Claude Code slash command that converts plain-English project rules, or rules in CLAUDE.md, into hook configurations.
★ 400 stars · last updated 2025-07-01 · Free, open source · View on GitHub
Best for
- Generating hooks without hand-writing JSON
- Turning existing CLAUDE.md rules into enforced automation
- Setting up formatting, testing, or git commands that run after edits or on stop
Install
git clone https://github.com/zxdxjtu/claudecode-rule2hook.git
mkdir -p ~/.claude/commands
cp claudecode-rule2hook/.claude/commands/rule2hook.md ~/.claude/commands/
Our take
It is a single markdown slash command with no dependencies, so the hook generation is done by Claude itself rather than deterministic code. The README says hooks are saved to ~/.claude/hooks.json, which reflects an early hooks format; current Claude Code reads hooks from settings.json, so generated output may need checking. Last push was July 2025 and it uses the older /project: command prefix.
Similar hooks
- Claude Code Ultimate Guide: Large open guide to Claude Code covering agent workflows, hooks, skills, MCP, security, and team adoption, with reusable templates.
- dcg (Destructive Command Guard): Rust pre-execution hook that blocks destructive shell, git, filesystem, database, and cloud commands run by AI coding agents.
- Claude Code Showcase: Example Claude Code project config with hooks, skills, agents, slash commands, MCP setup, and GitHub Actions workflows to copy from.
- Claude Code Hooks Mastery: Reference project implementing all 13 Claude Code hook events as UV Python scripts, plus sub-agents, status lines, and output styles.
- Continuous Claude v3: Hooks, skills, and agents that keep Claude Code context across sessions via YAML handoffs, ledgers, and a PostgreSQL memory store.
- Build with Claude: Plugin marketplace and discovery hub of agents, commands, hooks, and skills for Claude Code users extending their workflows.