rules-to-hook
Installation
SKILL.md
Hook Context Rules
Author and maintain .claude/context-rules.json for the context-inject.mjs hook.
The engine supports both Claude Code and VS Code Copilot hook payload formats.
VS Code Copilot support
The engine auto-detects payloads from VS Code Copilot (camelCase fields, toolArgs
as JSON string). Key differences from Claude Code:
- Event name: VS Code doesn't include the event in the payload. Pass it as a
CLI argument:
node .claude/hooks/context-inject.mjs preToolUse. The engine normalizes camelCase (preToolUse) to PascalCase (PreToolUse) used in rules. - Tool input: VS Code sends
toolArgs(JSON string), nottool_input(object). The engine parses it automatically. - Output: VS Code only supports
permissionDecisiononpreToolUse— flat JSON, nohookSpecificOutputwrapper. Context injection (text,hint,learnings) has no effect on VS Code. - Supported inject types on VS Code: only
blockandallow(PreToolUse).