Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Guides creating Cursor hooks: writing hooks.json, hook scripts, and project or user hook events for agent behavior.
Use this skill ↓41% 86%+45 ptsof test cases passed
Passed 19 of 22 test cases with the skill, and 9 of 22 without it.
3 of 3 safety checks passed
Not used yet
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.
Before you write anything, determine:
Infer these from the conversation when possible. Only ask for the missing pieces.
.cursor/hooks.json and .cursor/hooks/*~/.cursor/hooks.json and ~/.cursor/hooks/*Path behavior matters:
.cursor/hooks/my-hook.sh~/.cursor/, so use paths like ./hooks/my-hook.sh or hooks/my-hook.shPrefer project hooks when the behavior should be shared with the repository and checked into version control.
Use the narrowest event that matches the user's goal.
sessionStart, sessionEnd: set up or audit a sessionpreToolUse, postToolUse, postToolUseFailure: work across all toolssubagentStart, subagentStop: control or continue Task/subagent workflowsPreview what this skill puts in front of your model, and check which requests trigger it. No model call, no sign-up.
Skills that do similar work, with their benchmark result.
Next to this one in the catalogue, plus more from the same author.