create-hook

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

Updated Apr 28, 2026
Ready to run
npx skills add https://github.com/CokiStudios/cokistudios.github.io --skill create-hook-cokistudios
💬 Prompt for ChatGPT / Claude Chat▼
Please help me install this Agent Skill.
Skill: create-hook
Source: https://github.com/CokiStudios/cokistudios.github.io/tree/main/vscode-src/extensions/copilot/assets/prompts/skills/create-hook
Command: npx skills add https://github.com/CokiStudios/cokistudios.github.io --skill create-hook-cokistudios

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 automatically block actions, inject context, or run automation at defined lifecycle events. ## Core Features & Use Cases - Policy Enforcement: Create hooks in .github/hooks/ that block or gate specific tool actions before they run. - Lifecycle Automation: Trigger behavior at events such as PreToolUse, SessionStart, or Stop, including context injection and companion scripts. - Conversation Extraction: Generalize concerns raised during a session (e.g., "always check before doing X") into a reusable hook definition. - Use Case: A user repeatedly tells the agent not to run a destructive command. This Skill drafts a PreToolUse hook JSON that blocks that command, 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 before any tool runs in this workspace.

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 workflow?▼

Describe the action you want blocked, and the Skill drafts a PreToolUse hook JSON saved to .github/hooks/. The hook intercepts the tool call before execution and can block, warn, or gate the action.

What events can trigger an agent hook?▼

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

Where are hook files stored in a workspace?▼

Hook JSON files are saved in the .github/hooks/ directory at the workspace root. 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.

When should I use a hook instead of repeating instructions to the agent?▼

Use a hook when a policy must be enforced deterministically, such as blocking a dangerous command or injecting context at session start. Hooks persist across sessions and run automatically, unlike conversational reminders.