projectb-create-hook

Create Codex hooks with hooks.json configuration and event-triggered scripts.

Updated May 28, 2023
One-click install
npx skills add https://github.com/steveulrich/ProjectB --skill projectb-create-hook-steveulrich
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: projectb-create-hook
Source: https://github.com/steveulrich/ProjectB/tree/main/.agents/skills/projectb-create-hook
Command: npx skills add https://github.com/steveulrich/ProjectB --skill projectb-create-hook-steveulrich

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Automating custom logic around agent events requires knowing the correct hook events, file locations, JSON schema, and output fields, which is error-prone when done by hand. This Skill guides the creation of working Codex hooks that observe, block, modify, or follow up on agent behavior. ## Core Features & Use Cases - Hook Configuration: Creates or updates hooks.json files with schema version 1, choosing the correct project-level or user-level location and path style. - Event and Matcher Selection: Picks the narrowest hook event (such as beforeShellExecution, preToolUse, or afterFileEdit) and adds JavaScript-style regex matchers to limit when hooks fire. - Command and Prompt Hooks: Writes executable command hook scripts that exchange JSON over stdin/stdout, or prompt hooks for lightweight policy decisions. - Use Case: A user wants to block risky network commands in their repository. The Skill creates a project-level beforeShellExecution hook with a failClosed script that flags curl, wget, or nc commands for review before execution. ## Quick Start Create a project hook that asks for approval before any shell command containing curl or wget runs.

Frequently Asked Questions about projectb-create-hook

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

FAQPage Schema
How do I create a hook that blocks shell commands?▼

Create a beforeShellExecution hook in hooks.json pointing to a script that reads JSON from stdin and returns a permission field of allow, ask, or deny. Set failClosed to true so the action is blocked if the hook crashes or times out.

What is the difference between project hooks and user hooks?▼

Project hooks live in the repository's hooks.json and run from the project root, making them shareable through version control. User hooks live in the home directory configuration and apply across all projects for that user.

Should I use a command hook or a prompt hook?▼

Use a command hook when the logic must be deterministic and auditable, such as matching specific command patterns. Use a prompt hook when the policy is easier to describe in natural language than to script, like judging whether a command looks safe.

Why is my hook not loading or firing?▼

Hooks usually fail to load due to matcher or config parsing errors, so remove the matcher and confirm the base hook works first. Also verify relative paths match the hook location, the script is executable, and restart the host if reloading on save does not help.

What regex syntax do hook matchers support?▼

Matchers use JavaScript-style regular expressions, not POSIX or grep syntax. Avoid POSIX classes like [[:space:]] and use JavaScript equivalents such as \s instead.