Configure a PreToolUse hook to prevent AI agents from skipping git pre-commit hooks with --no-verify and other bypass flags. Use when setting up Claude Code projects that enforce commit quality gates.
The block-no-verify-hook skill provides a PreToolUse hook configuration designed to prevent AI coding agents from bypassing Git safety mechanisms when executing shell commands. It addresses a common issue where agents may use flags such as `--no-verify` or `--no-gpg-sign` to skip pre-commit hooks, commit-message validation, GPG signing requirements, and other repository quality controls. By intercepting commands before execution, the hook helps ensure that established development workflows, code quality checks, and security policies remain enforced during AI-assisted development.
The skill works by adding a `PreToolUse` hook to a Claude Code settings file and targeting Bash tool calls. The hook inspects the pending command through the `$TOOL_INPUT` environment variable and searches for prohibited bypass flags when they appear in Git commands. If a restricted flag is detected, the hook rejects the tool call by returning exit code 2 and displaying an explanatory error message. Commands that do not contain the blocked flags proceed normally, allowing standard development tasks to continue without interruption. The configuration specifically blocks `--no-verify` and `--no-gpg-sign` because these options can circumvent important validation and signing processes.
This skill is intended for teams and developers who use AI coding assistants in repositories with enforced quality gates. It is particularly useful in projects that rely on pre-commit hooks for formatting, linting, testing, security scanning, or commit-signing policies. Organizations seeking consistent compliance with repository standards can deploy the configuration either on a per-project basis through `.claude/settings.json` or more broadly through a global Claude settings configuration.
The hook blocks Git commands that use the `--no-verify` or `--no-gpg-sign` flags, preventing AI agents from bypassing pre-commit hooks or commit-signing requirements.
The configuration targets only `Bash` tool calls through the `matcher` setting and does not affect other tools such as Read, Edit, or Grep.
It examines the command contained in the `$TOOL_INPUT` environment variable and checks for blocked flags when they are used with Git commands.
Yes. The documentation describes both per-project installation using `.claude/settings.json` and a global setup using `~/.claude/settings.json`.
The documented configuration specifically checks for the `--no-verify` and `--no-gpg-sign` flags in Git commands. No additional bypass detection mechanisms are described in the provided content.
Quick Setup:
.claude/skills/Repository
wshobson/agents