claudecode-rule2hook  by zxdxjtu

Natural language to Claude Code automation hooks

created 1 month ago
303 stars

Top 87.9% on SourcePulse

GitHubView on GitHub
Project Summary

This project provides a tool to translate natural language descriptions of project automation rules into executable hooks for Claude Code. It targets developers and teams using Claude Code who want to streamline workflows like code formatting, testing, and validation without manual hook configuration. The primary benefit is enabling users to define complex automation simply by writing plain English.

How It Works

The tool leverages Claude Code's natural language processing capabilities to interpret user-provided rules. It analyzes the input to identify trigger events (e.g., after editing, before committing), target tools or actions, and the specific commands to execute. Claude then generates the appropriate hook configuration, which is saved to ~/.claude/hooks.json or a project-specific location, ensuring safe application by backing up existing configurations.

Quick Start & Requirements

  • Installation: Clone the repository and copy rule2hook.md to ~/.claude/commands/ for global access or to your project's .claude/commands/ directory for project-specific use.
  • Prerequisites: Claude Code.
  • Usage: In Claude Code, use /rule2hook "Your natural language rule" or /project:rule2hook "Your natural language rule".
  • Resources: Claude Code Documentation, Hooks Documentation, Slash Commands Guide.

Highlighted Details

  • Supports defining rules for code formatting, testing, Git workflows, validation, and custom commands.
  • Can read and process rules directly from a CLAUDE.md file.
  • Includes validation scripts (validate-hooks.py) for generated hooks.
  • Offers interactive testing via ./quick-test.sh.

Maintenance & Community

The project is community-driven with contributions welcomed for bug reporting, feature suggestions, documentation improvements, and pull requests. Discussions and issues are managed on GitHub.

Licensing & Compatibility

Licensed under the MIT License, permitting commercial use and integration with closed-source projects.

Limitations & Caveats

The effectiveness of generated hooks is dependent on Claude Code's interpretation of the natural language rules. Complex or ambiguous rules may require refinement.

Health Check
Last commit

1 month ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
1
Star History
267 stars in the last 30 days

Explore Similar Projects

Starred by John Resig John Resig(Author of jQuery; Chief Software Architect at Khan Academy) and Didier Lopes Didier Lopes(Founder of OpenBB).

CCPlugins by brennercruvinel

5.0%
2k
Claude Code CLI enhancement framework
created 3 weeks ago
updated 2 weeks ago
Starred by Boris Cherny Boris Cherny(Creator of Claude Code; MTS at Anthropic) and Adam Wolff Adam Wolff(Claude Code Core; MTS at Anthropic).

claude-code-sdk-python by anthropics

3.4%
829
SDK for Claude Code interaction
created 2 months ago
updated 3 days ago
Feedback? Help us improve.