.cursor/skills/meta/hook-create/SKILL.md
Create or modify Cursor lifecycle hooks. Use when adding a beforeSubmitPrompt, beforeShellExecution, beforeReadFile, stop, or other hook; or when the user wants to intercept Cursor agent actions.
npx skillsauth add JuroOravec/agents meta-hook-createInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Create and configure Cursor lifecycle hooks that run scripts when the agent takes certain actions (e.g. before submitting a prompt, before reading a file, when a task stops).
Trigger this skill when:
.cursor/hooks.json or modifying existing hooks.This project has a working example: the capture-prompts hook logs each user message with last turn preview (from transcript) and context. Use it as a template.
| File | Purpose |
| ---------------------------------- | ----------------------------------------------------------- |
| .cursor/hooks.json | Declares which commands run for each hook event |
| .cursor/hooks/capture-prompts.sh | Script that receives JSON on stdin, logs to .cursor/logs/ |
| .cursor/hooks/README.md | Hooks documentation |
See capture-prompts.sh and hooks/README.md for the full implementation.
sessionStart — When a new Agent Chat session begins. Payload: conversation_id, generation_id, workspace_roots, etc. Can return additional_context to inject text into the agent's context. See session-id-injection.md.beforeSubmitPrompt — When user sends a message, before it reaches the model. Payload: prompt, conversation_id, generation_id, attachments, workspace_roots.beforeReadFile — Before the agent reads a file. Can filter/redact content.beforeShellExecution — Before running a shell command. Can allow/deny.beforeMCPExecution — Before an MCP tool call.afterFileEdit — After the agent edits a file. Payload: file_path, edits (old_string, new_string).stop — When the task completes. Payload: status (completed, aborted, error).Hooks are merged from (in order): user ~/.cursor/hooks.json, enterprise /etc/cursor/hooks.json, project .cursor/hooks.json.
Format: All skills MUST use ### Phase N: Title for each workflow step. Enforced by validation script in CI.
Skill-eval (meta-evaluation): From the project root, run ./scripts/skill-eval.sh start {conversation_id} meta-hook-create at workflow start (conversation_id is injected at session start—look for "Conversation ID (for skill-eval)" in context). Capture the printed skill_id from the terminal output. Preserve both conversation_id and skill_id for the duration—if context gets summarized, ensure these IDs are retained. After each phase (or when skipping a phase), run ./scripts/skill-eval.sh complete {skill_id} {phase_no} or ./scripts/skill-eval.sh complete {skill_id} {phase_no} --skipped from the project root.
Create todo tasks for each phase before proceeding.
Look up best practices and state-of-the-art for Cursor hooks and lifecycle interception: Cursor docs, community examples, similar tooling (VS Code hooks, editor extensions). Avoid assumptions about payload shapes or event ordering — verify against current docs.
Create or edit .cursor/hooks.json:
{
"version": 1,
"hooks": {
"beforeSubmitPrompt": [{ "command": ".cursor/hooks/your-script.sh" }]
}
}
Command path: Use .cursor/hooks/script.sh (relative to workspace root). Avoid hooks/script.sh — Cursor's cwd may differ and it can fail with "no such file or directory".
.cursor/hooks/your-script.sh (or .ts, .js).chmod +x .cursor/hooks/your-script.sh.jq (shell) or JSON.parse (Node).Example (shell):
#!/usr/bin/env bash
payload=$(cat)
prompt=$(echo "$payload" | jq -r '.prompt // ""')
# ... your logic
Cursor only loads hooks at startup. After any change to hooks.json or a hook script:
Document this in your hook README so users (and future you) know to reload.
echo "debug message" >&2 — stdout is reserved for Cursor; stderr appears in the Hooks panel.hooks.json exists and lists the correct command path..cursor/logs/ or output location is in .gitignore if logs contain sensitive data.meta-skill-create, meta-agent-create.beforeMCPExecution.data-ai
Configure which projects are connected to a root repo via nested git clones. Applies when the repo has shared .cursor/ and imported projects as normal clone folders. Use when adding, removing, or soft/hard switching projects. Soft switch = toggle .gitignore (no push, WIP stays). Hard switch = remove/add clone folders. Handles progress storage and window reload reminders.
development
Execute development work from a pool of GitHub issues. Take one at a time, implement via act-dev, close the issue when done. Use when architect/PM has produced a backlog of issues to implement in parallel.
testing
Adversarial reviewer that independently checks completed work for incomplete output, non-holistic approach, glaring issues, and skill discovery.
development
Project manager agent for capture, triage, and prioritization. Use when capturing ideas, going over inbox (elevate/drop/prioritize), triaging backlog, asking "what's next?", or restoring context. First local, then GitHub — never auto-create issues.