Skip to content

feat: Add block-no-verify to prevent AI agents from bypassing git hooks #3198

@tupe12334

Description

@tupe12334

Summary

Add the block-no-verify package to prevent AI coding agents from bypassing git hooks using the --no-verify flag.

Problem

AI coding agents (Claude Code, Gemini CLI) can bypass pre-commit hooks by running git commit --no-verify, which defeats the purpose of code quality checks enforced by git hooks.

Proposed Solution

Integrate block-no-verify (v1.1.1) which:

  • Monitors git commands (commit, push, merge, cherry-pick, rebase, am)
  • Blocks execution when --no-verify or -n flag is detected
  • Supports both Claude Code and Gemini CLI

Configuration Required

For Claude Code - Create .claude/settings.json:

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

For Gemini CLI - Create .gemini/settings.json:

{
  "hooks": {
    "BeforeTool": [
      {
        "matcher": "shell",
        "hooks": [
          {
            "type": "command",
            "command": "npx block-no-verify"
          }
        ]
      }
    ]
  }
}

Benefits

  • Enforces code quality checks even when using AI agents
  • MIT licensed, lightweight dependency
  • No changes needed to existing git hooks setup

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions