create-hook

Creates JSON hook files that enforce policies or automate agent lifecycle events.

Updated Aug 30, 2026
One-click install
npx skills add https://github.com/Tyrizx/Tyrizx --skill create-hook-tyrizx
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: create-hook
Source: https://github.com/Tyrizx/Tyrizx/tree/main/extensions/copilot/assets/prompts/skills/create-hook
Command: npx skills add https://github.com/Tyrizx/Tyrizx --skill create-hook-tyrizx

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Teams need a consistent way to enforce policies and automate behaviors around AI agent sessions, such as blocking risky commands or injecting context at the right moment, without manually writing hook configuration files from scratch. ## Core Features & Use Cases - Policy Enforcement: Create hooks that block or gate specific tool actions, such as preventing certain commands from running. - Lifecycle Automation: Configure hooks for agent events like PreToolUse, SessionStart, or Stop to inject context or trigger scripts. - Conversation-Driven Extraction: Generalizes concerns expressed during a conversation (e.g., "always check before doing X") into a concrete hook definition saved in .github/hooks/. - Use Case: A user repeatedly tells the agent not to run destructive git commands. This Skill drafts a PreToolUse hook JSON that blocks those commands, saves it to .github/hooks/, and suggests how to test it. ## Quick Start Ask the agent to create a hook that blocks a specific command or injects context at session start, and it will draft and save the hook JSON in .github/hooks/.

Frequently Asked Questions about create-hook

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

FAQPage Schema
How do I create a hook to block certain agent commands?▼

Describe the behavior you want blocked, and the Skill drafts a PreToolUse hook JSON saved to .github/hooks/. It generalizes your concern into a policy, then iterates with you on ambiguous parts before finalizing.

What events can trigger an agent hook?▼

Hooks can trigger on agent lifecycle events such as PreToolUse, SessionStart, and Stop. You choose whether the hook blocks an action, warns the user, or injects context at that point.

Where are hook files stored and how do paths resolve?▼

Hooks are saved in the .github/hooks/ directory. Hook commands and companion scripts run with the working directory defaulting to the workspace root, falling back to the user home directory, and relative paths resolve from that working directory.

Can I use environment variables in hook paths?▼

No, environment variables should not be used for pathing in hooks. The only exception is plugin-provided environment variables in hooks shipped as part of an agent plugin; use relative or deliberate absolute paths otherwise.

When should I use a hook instead of other agent customizations?▼

Use a hook when you need deterministic enforcement or automation at specific lifecycle events, such as gating tool use or injecting context at session start. For broader behavior guidance, related customizations like agent instructions may fit better.