Skip to content

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

Description

@tupe12334

Feature: Add block-no-verify PreToolUse hook to .claude/settings.json

Repomix's .claude/settings.json currently enables agent teams but has no hooks. There's one enforcement gap worth closing: the git hook-bypass flag.

When Claude Code (or a subagent) runs 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 block-no-verify@1.1.2 (github.com/tupe12334/block-no-verify) as a PreToolUse Bash hook in .claude/settings.json:

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

The package reads the command from Claude Code's hook stdin, detects the hook-bypass flag across all git subcommands, and exits 2 to block. No custom scripts needed.


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

Metadata

Metadata

Assignees

No one assigned

    Labels

    ideaneeds discussionIssues needing discussion and a decision to be made before action can be taken

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions