hook-conventions

Enforce agent lifecycle hook conventions for git and shell operations.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/zcawood-mie/agentz --skill hook-conventions
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hook-conventions
Source: https://github.com/zcawood-mie/agentz/tree/main/skills/hook-conventions
Command: npx skills add https://github.com/zcawood-mie/agentz --skill hook-conventions

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Defines conventions and guardrails for agent lifecycle hooks and their scripts so teams can deterministically enforce safety, prevent dangerous operations, and standardize hook behavior across environments.

Core Features & Use Cases

  • Lifecycle Mapping: Documents events like PreToolUse, PostToolUse, SessionStart, UserPromptSubmit and their expected uses.
  • Script Guidance: Specifies input/output contracts (JSON stdin/stdout), exit code semantics, timeout expectations, and fault-tolerant practices for hook scripts.
  • Governance & Safety: Provides rules and example scripts to block destructive git commands, require approvals for hook edits, and auto-format or scan outputs after tools run.
  • Use Case: Validate and enforce project hooks to block force-pushes, scan diffs for secrets before push, and auto-format files after modifications.

Quick Start

Use the hook-conventions skill to audit and validate your project's hooks configuration and scripts before running any tool.

Frequently Asked Questions about hook-conventions

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enforce git hook conventions to block dangerous commands in agent workflows?

Git hook conventions are enforced by validating lifecycle event scripts that block destructive commands like force-pushes, requiring explicit exit code semantics and JSON stdin/stdout contracts for deterministic safety during agent operations.

What are lifecycle hooks and how do PreToolUse and PostToolUse events work?

Lifecycle hooks are event-driven scripts executed during agent workflows; PreToolUse runs before a tool executes to validate or block actions, while PostToolUse runs after to scan outputs or auto-format modified files.

How do I configure shell scripts to read JSON from stdin and write JSON to stdout for hook execution?

Configure shell scripts by reading JSON input from stdin, processing the payload according to hook event rules, and writing JSON output to stdout with explicit exit codes to signal approval, blocking, or timeout handling.

Do I need a global hooks JSON file to set up PreToolUse and SessionStart lifecycle events?

Yes, a global hooks JSON file located at ~/.agents/hooks/global.json is required to define and register lifecycle events like PreToolUse, PostToolUse, SessionStart, and UserPromptSubmit for deterministic agent workflow enforcement.

Can I scan git diffs for secrets before push using PostToolUse lifecycle hooks?

Yes, PostToolUse lifecycle hooks can execute shell scripts to scan staged git diffs for secrets before a push completes, leveraging JSON stdin/stdout contracts and timeout handling to ensure safe automated execution.

What are the limitations of using lifecycle hooks for automated git security enforcement?

Lifecycle hook scripts must adhere to strict timeout handling and explicit exit code semantics; failing to follow JSON stdin/stdout contracts or exceeding execution timeouts can break agent workflows and bypass security enforcement.