Skip to content

feat: Add block-no-verify to prevent Claude Code from bypassing git hooks #5247

Description

@tupe12334

Summary

Add the block-no-verify package to prevent Claude Code from bypassing git hooks using the --no-verify flag.

Problem

Claude Code 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
  • Integrates with Claude Code via PreToolUse hooks

Configuration Required

Create .claude/settings.json:

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

Benefits

  • Enforces code quality checks even when using Claude Code
  • 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