file_type
instructions
title
Hook File Instructions
description
Guidelines for authoring portable guardrail hooks with explicit inputs, outputs, and safety outcomes
scope
repo-local
version
v1.0
last_updated
2026-05-29
owners
tags
hooks
guardrails
safety
automation
validation
applyTo
status
active
LightSpeed Hook File Instructions
Create reusable, safety-focused hooks for pre-commit, CI/CD, and automation workflows. Hooks must have explicit guardrails and clear documentation.
Hook files are stored in hooks/ at repository root
Each hook must have a clear purpose and trigger condition
Document all inputs, outputs, and side effects explicitly
Include safety constraints and guardrails upfront
Test hooks locally before committing
Use descriptive file names (e.g., validate-commit-message.md)
title — Descriptive name of the hook
description — What it validates or enforces
version — Semantic version
scope — "organization-wide" (for reusable hooks) or "repo-local"
trigger — When hook runs (pre-commit, pre-push, CI, etc.)
exit_code — Success (0) and failure codes
tags — Searchable keywords
Purpose — What safety risk or validation this hook addresses
Trigger — When and how the hook executes
Input — What data/files the hook receives
Validation Rules — Specific checks performed
Output — Success/failure messages
Guardrails — Constraints and limitations
Examples — Sample passing and failing cases
All hooks must:
Fail safely (err on the side of caution)
Have clear error messages
Not require user secrets or credentials
Be reversible or non-destructive
Document any system changes
Include rollback instructions if applicable
Test locally with various file types and edge cases
Verify exit codes match documentation
Ensure error messages are helpful
Test on both success and failure paths