spillwavesolutions/agent_rulez/mastering-hooks
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
Master RuleZ, the high-performance AI policy engine for development workflows. Use when asked to "install rulez", "create hooks", "debug hooks", "hook not firing", "configure context injection", "validate hooks.yaml", "PreToolUse", "PostToolUse", "block dangerous commands", "multi-platform hooks", "Gemini CLI hooks", "Copilot hooks", "OpenCode hooks", "dual-fire events", or "cross-platform rules". Covers installation, rule creation, multi-platform adapters, troubleshooting, and optimization.
Install
npx vskill@latest install spillwavesolutions/agent_rulez/mastering-hooksSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
mastering-hooks
Contents
Overview
RuleZ is a high-performance AI policy engine that intercepts AI coding assistant events and executes configured actions. It works across multiple platforms through adapter-based event translation.
Supported platforms:
- Claude Code (native) - Full event support
- Gemini CLI - Via adapter with dual-fire events
- GitHub Copilot - Via adapter
- OpenCode - Via adapter with dual-fire events
System components:
- RuleZ Binary (Rust): Fast, deterministic hook execution at runtime
- hooks.yaml: Declarative configuration defining rules, matchers, and actions
- Platform Adapters: Translate platform-specific events to unified RuleZ event types
- This Skill: Intelligent assistant for setup, debugging, and optimization
Decision Tree
Capabilities
1. Install & Initialize RuleZ
Use when: Setting up RuleZ for the first time in a project or user-wide.
Checklist:
- Verify RuleZ binary is installed:
rulez --version - Initialize configuration:
rulez init(creates.claude/hooks.yaml) - Register with Claude Code:
rulez install(project-local) orrulez install --global - Validate configuration:
rulez validate - Verify installation: Check
.claude/settings.jsonfor hook entries
Reference: cli-commands.md
2. Create Hook Rules
Use when: Adding new behaviors like context injection, command validation, or workflow automation.
Checklist:
- Identify the event type (PreToolUse, PostToolUse, BeforeAgent, etc.)
- Define matchers (tools, extensions, directories, patterns)
- Choose action type (inject, run, block, require_fields)
- Write the rule in hooks.yaml
- Validate:
rulez validate - Test with:
rulez debug <event> --tool <tool_name>
Rule anatomy:
Reference: hooks-yaml-schema.md | rule-patterns.md
3. Explain Configuration
Use when: Understanding what existing hooks do, why they exist, or how they interact.
Checklist:
- Run
rulez explain rule <rule-name>for specific rule analysis - Run
rulez explain rulesfor full configuration overview - Check rule precedence (first match wins within same event)
- Identify potential conflicts or overlaps
Example output from rulez explain rule python-standards:
Reference: cli-commands.md
4. Troubleshoot Hook Issues
Use when: Hooks not firing, unexpected behavior, or error messages.
Diagnostic checklist:
- Validate config:
rulez validate- catches YAML/schema errors - Check registration:
cat .claude/settings.json | grep hooks - Enable debug logging:
rulez debug PreToolUse --tool Write --verbose - Check logs:
rulez logs --limit 20 - Verify file paths: Ensure all
path:references exist
Common issues:
| Symptom | Likely Cause | Fix | |
|---|---|---|---|
| Hook never fires | Event/matcher mismatch | Use rulez debug to trace matching | |
| "file not found" | Invalid path in action | Check relative paths from project root | |
| Context not injected | Script returns invalid JSON | Validate script output format | |
| Permission denied | Script not executable | chmod +x script.sh | |
| Event not firing on Gemini | Wrong event name | Check platform-adapters.md for mappings |
Reference: troubleshooting-guide.md
5. Optimize Configuration
Use when: Too many rules, slow execution, or complex maintenance.
Optimization checklist:
- Consolidate overlapping rules with broader matchers
- Use
enabled_whenfor conditional rules instead of duplicates - Move shared context to reusable markdown files
- Order rules by frequency (most common first)
- Use
blockearly to short-circuit unnecessary processing
Reference: rule-patterns.md
6. Multi-Platform Setup
Use when: Configuring RuleZ to work with Gemini CLI, GitHub Copilot, or OpenCode in addition to Claude Code.
Key concepts:
- RuleZ uses platform adapters to translate each platform's native events into unified RuleZ event types
- Write rules using RuleZ event types (e.g.,
PreToolUse) — adapters handle translation automatically - Some platforms fire dual events (e.g., Gemini's
BeforeAgentfires bothBeforeAgentandUserPromptSubmit)
Checklist:
- Install RuleZ:
rulez install - Write rules using standard RuleZ event types
- Test with
rulez debug <event>to verify matching - Review platform-adapters.md for platform-specific event mappings
Reference: platform-adapters.md
When NOT to Use This Skill
- Simple Claude Code configuration: Use
settings.jsondirectly for basic permissions - One-time context injection: Just paste into your prompt
- Dynamic runtime decisions: RuleZ is deterministic; use MCP servers for complex logic
References
| Document | Purpose | |
|---|---|---|
| quick-reference.md | Events, matchers, actions, file locations | |
| hooks-yaml-schema.md | Complete YAML configuration reference | |
| cli-commands.md | All CLI commands with examples | |
| rule-patterns.md | Common patterns and recipes | |
| troubleshooting-guide.md | Diagnostic procedures | |
| platform-adapters.md | Multi-platform event mappings and dual-fire |
Example: Complete hooks.yaml
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingmastering-hooks/SKILL.md
Popularity
- Repository stars
- 34
- Repository forks
- 8
- 7-day trend score
- 18
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 25 Mar 2026, 7 months ago.
Extension points
hookPre/post lifecycle hooks
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/spillwavesolutions/agent_rulez/mastering-hooks)