create-hook

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

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Agent sessions often need consistent guardrails—blocking risky commands, injecting context at the right moment, or automating setup at session start. This Skill turns those recurring concerns into concrete hook definitions stored in .github/hooks/, so policies are enforced automatically instead of repeated in every prompt. ## Core Features & Use Cases - Policy Enforcement: Draft hook JSON that blocks, warns on, or gates specific tool actions such as dangerous commands. - Lifecycle Automation: Configure hooks for events like PreToolUse, SessionStart, or Stop to inject context or run companion scripts. - Conversation-Driven Extraction: Generalize concerns expressed during the conversation (e.g., "always check before doing X") into reusable hook rules. - Use Case: A user repeatedly tells the agent not to run destructive git commands. The Skill extracts that concern, drafts a PreToolUse hook in .github/hooks/ that blocks the command, and suggests how to test it. ## Quick Start Ask the agent to create a hook that blocks force-pushing to the main branch before any git push command runs.

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 action you want blocked, and the Skill drafts a hook JSON in .github/hooks/ targeting the PreToolUse event. The hook can block, warn, or gate the command before the agent executes it.

What events can trigger an agent hook?▼

Hooks can trigger on lifecycle events such as PreToolUse, SessionStart, and Stop. PreToolUse runs before a tool action, SessionStart runs when a session begins, and Stop runs when the agent finishes.

Where are hook files stored and what format do they use?▼

Hooks are stored as JSON files in the .github/hooks/ directory of the workspace. Companion scripts referenced by hooks run with the working directory defaulting to the workspace root.

Can hooks use environment variables for file paths?▼

No, hooks should not use environment variables for pathing. The only exception is plugin-provided environment variables in hooks shipped as part of an agent plugin; use relative paths from the workspace root or deliberate absolute paths instead.

What working directory do hook scripts run in?▼

Hook commands and companion scripts run with cwd defaulting to the workspace root when a workspace folder is available. If no workspace is open, cwd falls back to the user home directory, and relative paths resolve from that cwd.