mcpField
S
suggesting-cursor-hooks

suggesting-cursor-hooks

github.com/revitalb-portAgent workflows051 installsUpdated 10w ago
Repository

About suggesting-cursor-hooks

A Cursor skill that notices repeated requests to run checks and suggests automating them with hooks. It describes common hook triggers, implementation guidance, and safeguards for existing configuration and script behavior.

Key features

  1. 01Detect repeated validation requests
  2. 02Suggest hooks for recurring commands
  3. 03Map common checks to hook events
  4. 04Preserve existing hook configuration
  5. 05Keep scripts fast and non-blocking

Use cases

  1. 01Automate linting after file edits
  2. 02Run related tests after code changes
  3. 03Add a local type-check hook
  4. 04Warn before shell access to secrets files

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/revitalb-port/skills-registry-demo --skill suggesting-cursor-hooks

After installing, type/suggesting-cursor-hooksin Claude Code to confirm it loaded.

Details

From the project README

Suggesting Cursor Hooks

Watch for repeated manual requests. When the user keeps asking you to run the same command after changes, suggest a hook to automate it.

Triggers

Suggest a hook when you notice:

  • The user asks you to run the same check 2+ times (e.g. "run lint", "run tests", "check types")
  • The user says "always run X after editing" or "make sure to test after changes"
  • You keep forgetting to run a validation step and the user catches it
  • A CI failure could have been caught locally with a post-edit check

How to Suggest

You've asked me to run [command] after edits a few times. Want me to 
set up a Cursor hook so it runs automatically?

If they say yes, create .cursor/hooks.json and the script:

{
  "hooks": [
    {
      "event": "afterFileEdit",
      "script": ".cursor/hooks/<name>.sh",
      "pattern": "<glob>"
    }
  ]
}

Common Hooks to Suggest

User keeps asking...Hook
"run lint" / "fix formatting"afterFileEdit → eslint --fix or prettier --write
"check types"afterFileEdit → tsc --noEmit on .ts/.tsx
"run tests"afterFileEdit → run related test file
"don't touch .env"beforeShellExecution → warn on secrets files
"make sure it builds"stop → quick build check

Rules

  • Only suggest after a real repeated pattern, not preemptively
  • Hook scripts must be fast (under 5 seconds) or the agent feels slow
  • Scripts should exit 0 and report via stdout — don't block the agent unless the user explicitly wants that
  • Check for existing .cursor/hooks.json first — merge, don't overwrite
  • Keep it casual — "want me to automate this?" not a formal proposal

Comments

Markdown supported