create-hook

Create JSON hooks that enforce policy or automate agent lifecycle events.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Agent sessions often repeat the same mistakes or miss required checks, and manually reminding the agent every time is unreliable. This Skill turns concerns expressed in conversation into persistent hook files that block actions, inject context, or automate behavior at lifecycle events. ## Core Features & Use Cases - Policy Enforcement: Create hooks that block or gate specific tool actions, such as preventing dangerous commands before they run. - Context Injection: Automatically inject relevant context at events like SessionStart or PreToolUse so the agent always has the right information. - Lifecycle Automation: Automate tasks at session start, session end, or tool use with optional companion scripts. - Use Case: After telling the agent multiple times to never run a destructive command, use this Skill to generalize that concern into a PreToolUse hook saved in .github/hooks/ that blocks it permanently. ## Quick Start Ask the agent to create a hook that blocks a specific command or injects context at session start, and it will draft the JSON hook file in .github/hooks/ for your review.

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 a command in my agent?▼

Describe the behavior you want blocked, and the Skill drafts a hook JSON file saved in .github/hooks/ that triggers on events like PreToolUse. It generalizes your concern from the conversation into a persistent policy.

What events can trigger an agent hook?▼

Hooks can trigger on lifecycle events such as PreToolUse, SessionStart, and Stop. Depending on the event, a hook can block an action, warn the user, or inject context into the session.

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 cwd defaulting to the workspace root, falling back to the user home directory, and relative paths resolve from that cwd.

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.

Does a hook need a companion script?▼

Not always. Simple hooks can be pure JSON, but more complex automation may need a companion script, which the Skill helps you draft alongside the hook definition.