nextjs - 💡(How to fix) Fix Add block-no-verify hooks to prevent agents from bypassing git hooks [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#91667Fetched 2026-04-08 01:02:36
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Author
Timeline (top)
referenced ×2closed ×1commented ×1labeled ×1

Code Example

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [{ "type": "command", "command": "npx [email protected]" }]
      }
    ]
  }
}

---

{
  "hooks": {
    "beforeShellExecution": [
      { "command": "npx [email protected]", "event": "beforeShellExecution" }
    ]
  }
}
RAW_BUFFERClick to expand / collapse

Feature: Add block-no-verify hooks to prevent agents from bypassing git hooks

Next.js has .claude/skills and .cursor/commands committed — but no .claude/settings.json or .cursor/hooks.json. There's no enforcement against agents bypassing git hooks via the hook-skip flag.

When Claude Code or Cursor agents run git commit or git push with the hook-bypass flag, it silently skips pre-commit hooks, commit-msg validation, and pre-push test suites — regardless of any quality gates configured elsewhere.

Proposed fix

Add [email protected] (github.com/tupe12334/block-no-verify) to both agent configs:

Claude Code — create .claude/settings.json:

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [{ "type": "command", "command": "npx [email protected]" }]
      }
    ]
  }
}

Cursor — create .cursor/hooks.json:

{
  "hooks": {
    "beforeShellExecution": [
      { "command": "npx [email protected]", "event": "beforeShellExecution" }
    ]
  }
}

Zero custom logic — the package handles detection and blocking.


Disclosure: I am the author and maintainer of block-no-verify.

extent analysis

Fix Plan

To prevent agents from bypassing git hooks, we will add the block-no-verify package to both Claude Code and Cursor agent configurations.

Step-by-Step Solution:

  • Install the block-no-verify package by running npm install [email protected] or yarn add [email protected].
  • Create a .claude/settings.json file for Claude Code with the following content:
{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [{ "type": "command", "command": "npx [email protected]" }]
      }
    ]
  }
}
  • Create a .cursor/hooks.json file for Cursor with the following content:
{
  "hooks": {
    "beforeShellExecution": [
      { "command": "npx [email protected]", "event": "beforeShellExecution" }
    ]
  }
}

Verification

To verify that the fix worked, try running git commit or git push with the hook-bypass flag. The block-no-verify package should detect and block the bypass attempt.

Extra Tips

  • Make sure to update the block-no-verify package to the latest version to ensure you have the latest features and bug fixes.
  • If you encounter any issues with the package, refer to the github.com/tupe12334/block-no-verify repository for documentation and support.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

nextjs - 💡(How to fix) Fix Add block-no-verify hooks to prevent agents from bypassing git hooks [1 comments, 2 participants]