Hook Register
Validates and registers hook manifest files (YAML) in the Hook Registry for versioned hook management.
What this skill does
# hook.register Skill
Validates and registers hook manifest files, adding them to the Hook Registry for automatic enforcement.
## Purpose
While `hook.define` creates hooks on-the-fly and updates the live configuration (`.claude/hooks.yaml`), the `hook.register` skill formalizes this by validating a hook manifest and adding it to a versioned registry (`/registry/hooks.json`). This enables:
- **Version Control**: Track hooks as code with full history
- **Review Process**: Hook manifests can go through code review before activation
- **Centralized Management**: Single source of truth for all hooks in the organization
- **Formal Schema**: Ensures hooks conform to required structure
This skill is part of Betty's Layer 5 (Hooks/Policy) infrastructure, enabling automated governance and validation.
## Difference from hook.define
| Feature | hook.define | hook.register |
|---------|-------------|---------------|
| **Purpose** | Create hooks immediately | Register hook manifests for version control |
| **Output File** | `.claude/hooks.yaml` (live config) | `/registry/hooks.json` (registry) |
| **Use Case** | Quick development, testing | Production deployment, formal tracking |
| **Versioning** | Not tracked | Full version history |
| **Schema Validation** | Basic | Comprehensive |
## Usage
```bash
python skills/hook.register/hook_register.py <path_to_hook_manifest.yaml>
```
### Arguments
| Argument | Type | Required | Description |
|----------|------|----------|-------------|
| manifest_path | string | Yes | Path to the hook manifest YAML file to validate |
## Hook Manifest Schema
### Required Fields
- **name**: Unique hook identifier (kebab-case recommended, e.g., `validate-openapi-specs`)
- **version**: Semantic version (e.g., `0.1.0`)
- **description**: Human-readable description of what the hook does
- **event**: Hook trigger event (see Valid Events table below)
- **command**: Command to execute when hook triggers
### Optional Fields
- **when**: Conditional execution
- `pattern`: File pattern to match (e.g., `"*.openapi.yaml"`, `"specs/**/*.yaml"`)
- **blocking**: Whether hook should block operation if it fails (default: `false`)
- **timeout**: Timeout in milliseconds (default: `30000`)
- **on_failure**: What to do on failure: `show_errors`, `silent`, `log_only` (default: `show_errors`)
- **status**: Hook status (`draft` or `active`, defaults to `draft`)
- **tags**: Array of tags for categorization (e.g., `["api", "validation", "compliance"]`)
### Valid Events
| Event | Triggers When | Common Use Cases |
|-------|---------------|------------------|
| `on_file_edit` | File is edited in editor | Real-time syntax validation |
| `on_file_save` | File is saved to disk | Code generation, formatting |
| `on_commit` | Git commit attempted | Breaking change detection, linting |
| `on_push` | Git push attempted | Full validation suite, security scans |
| `on_tool_use` | Any tool is used | Audit logging, usage tracking |
| `on_agent_start` | Agent begins execution | Context injection, authorization |
| `on_workflow_end` | Workflow completes | Cleanup, notifications, reporting |
## Validation Rules
The skill performs comprehensive validation:
1. **Required Fields** – Ensures `name`, `version`, `description`, `event`, and `command` are present
2. **Name Format** – Validates hook name is non-empty and follows naming conventions
3. **Version Format** – Ensures version follows semantic versioning (e.g., `0.1.0`)
4. **Event Type** – Verifies event is one of the supported triggers
5. **Command Validation** – Ensures command is non-empty
6. **Type Checking** – Validates `blocking` is boolean, `timeout` is positive number
7. **Pattern Validation** – If `when.pattern` is provided, ensures it's a valid string
8. **Name Uniqueness** – Checks that hook name doesn't conflict with existing hooks in registry
## Outputs
### Success Response
```json
{
"ok": true,
"status": "registered",
"errors": [],
"path": "hooks/validate-openapi.yaml",
"details": {
"valid": true,
"status": "registered",
"registry_updated": true,
"manifest": {
"name": "validate-openapi-specs",
"version": "0.1.0",
"description": "Validate OpenAPI specs against Zalando guidelines",
"event": "on_file_edit",
"command": "python skills/api.validate/api_validate.py {file_path} zalando",
"when": {
"pattern": "*.openapi.yaml"
},
"blocking": true,
"timeout": 10000,
"status": "active",
"tags": ["api", "validation", "openapi"]
}
}
}
```
### Failure Response
```json
{
"ok": false,
"status": "failed",
"errors": [
"Invalid event: 'on_file_change'. Must be one of: on_file_edit, on_file_save, on_commit, on_push, on_tool_use, on_agent_start, on_workflow_end"
],
"path": "hooks/invalid-hook.yaml",
"details": {
"valid": false,
"errors": [
"Invalid event: 'on_file_change'. Must be one of: on_file_edit, on_file_save, on_commit, on_push, on_tool_use, on_agent_start, on_workflow_end"
],
"path": "hooks/invalid-hook.yaml"
}
}
```
## Examples
### Example 1: Register OpenAPI Validation Hook
**Hook Manifest** (`hooks/validate-openapi.yaml`):
```yaml
name: validate-openapi-specs
version: 0.1.0
description: "Validate OpenAPI specs against Zalando guidelines on every edit"
event: on_file_edit
command: "python skills/api.validate/api_validate.py {file_path} zalando"
when:
pattern: "*.openapi.yaml"
blocking: true
timeout: 10000
status: active
tags: [api, validation, openapi, zalando]
```
**Registration Command**:
```bash
$ python skills/hook.register/hook_register.py hooks/validate-openapi.yaml
{
"ok": true,
"status": "registered",
"errors": [],
"path": "hooks/validate-openapi.yaml",
"details": {
"valid": true,
"status": "registered",
"registry_updated": true
}
}
```
### Example 2: Register Breaking Change Detection Hook
**Hook Manifest** (`hooks/prevent-breaking-changes.yaml`):
```yaml
name: prevent-breaking-changes
version: 0.1.0
description: "Block commits that introduce breaking API changes"
event: on_commit
command: "python skills/api.compatibility/check_compatibility.py {file_path} --fail_on_breaking"
when:
pattern: "specs/**/*.yaml"
blocking: true
timeout: 30000
on_failure: show_errors
status: active
tags: [api, compatibility, breaking-changes, commit-hook]
```
### Example 3: Register Audit Log Hook
**Hook Manifest** (`hooks/audit-tool-usage.yaml`):
```yaml
name: audit-tool-usage
version: 0.1.0
description: "Log all tool usage for compliance audit trail"
event: on_tool_use
command: "python skills/audit.log/log_tool_usage.py {tool_name} {timestamp}"
blocking: false
timeout: 5000
on_failure: log_only
status: active
tags: [audit, compliance, logging]
```
## Integration
### With Workflows
Hooks can be registered as part of a workflow:
```yaml
# workflows/setup_governance.yaml
steps:
- skill: hook.register
args:
- "hooks/validate-openapi.yaml"
required: true
- skill: hook.register
args:
- "hooks/prevent-breaking-changes.yaml"
required: true
```
### With CI/CD
Validate hooks in continuous integration:
```yaml
# .github/workflows/validate-hooks.yml
name: Validate Hooks
on: [push, pull_request]
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Validate all hooks
run: |
for hook in hooks/*.yaml; do
python skills/hook.register/hook_register.py "$hook" || exit 1
done
```
### Loading Hooks at Runtime
Once registered, hooks can be loaded from the registry:
```python
import json
with open('/registry/hooks.json') as f:
registry = json.load(f)
active_hooks = [h for h in registry['hooks'] if h['status'] == 'active']
```
## Common Errors
| Error | Cause | Solution |
|-------|-------|----------|
| "Missing required fields: name" | Hook manifest missing required field | Add all required fields: Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.