← ClaudeAtlas

create-hooklisted

Create Cursor hooks. Use to create a hook, write hooks.json, add hook scripts, or automate behavior around agent events.
kensaurus/cursor-kenji · ★ 4 · Web & Frontend · score 77
Install: claude install-skill kensaurus/cursor-kenji
# Creating Cursor Hooks Create hooks when you want Cursor to run custom logic before or after agent events. Hooks are scripts or prompt-based checks that exchange JSON over stdin/stdout and can observe, block, modify, or follow up on behavior. When the user asks for a hook, don't stop at describing the format. Gather the missing requirements, then create or update the hook files directly. ## Gather Requirements Before you write anything, determine: 1. **Scope**: Should this be a project hook or a user hook? 2. **Trigger**: Which event should run the hook? 3. **Behavior**: Should it audit, deny/allow, rewrite input, inject context, or continue a workflow? 4. **Implementation**: Should it be a command hook (script) or a prompt hook? 5. **Filtering**: Does it need a matcher so it only runs for certain tools, commands, or subagent types? 6. **Safety**: Should failures fail open or fail closed? Infer these from the conversation when possible. Only ask for the missing pieces. ## Choose the Right Location - **Project hooks**: `.cursor/hooks.json` and `.cursor/hooks/*` - **User hooks**: `~/.cursor/hooks.json` and `~/.cursor/hooks/*` Path behavior matters: - **Project hooks** run from the project root, so use paths like `.cursor/hooks/my-hook.sh` - **User hooks** run from `~/.cursor/`, so use paths like `./hooks/my-hook.sh` or `hooks/my-hook.sh` Prefer **project hooks** when the behavior should be shared with the repository and checked into version control. ## Choose the H