Skip to content

Add block-no-verify hook to prevent agents from bypassing git hooks #1088

@tupe12334

Description

@tupe12334

Add block-no-verify as a Claude Code PreToolUse hook

When a Claude Code agent runs git commit or git push with the hook-bypass flag, it silently disables pre-commit, commit-msg, and pre-push hooks — defeating any quality gates you've put in place.

block-no-verify is a lightweight Claude Code hook that detects the hook-bypass flag across all git subcommands and exits 2 to block the command.

Proposed change to .claude/settings.json

Add a PreToolUse Bash hook:

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [{ "type": "command", "command": "npx block-no-verify@1.1.2" }]
      }
    ]
  }
}

This keeps agents from bypassing your git hooks without explicit human override.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    In progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions