block-no-verify-hook

Configure a PreToolUse hook that blocks git bypass flags in Claude Code.

Updated Apr 23, 2026
One-click install
npx skills add https://github.com/SanketAdlak/PDMProjectDesign --skill block-no-verify-hook-sanketadlak
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: block-no-verify-hook
Source: https://github.com/SanketAdlak/PDMProjectDesign/tree/main/.agents/skills/block-no-verify-hook
Command: npx skills add https://github.com/SanketAdlak/PDMProjectDesign --skill block-no-verify-hook-sanketadlak

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? AI coding agents can run git commands with flags like --no-verify or --no-gpg-sign that silently skip pre-commit hooks, linting, testing, security scans, and commit signing policies, letting unverified code enter the repository. ## Core Features & Use Cases - PreToolUse Hook Configuration: Adds a Bash-matcher hook to .claude/settings.json that inspects every shell command before execution and blocks bypass flags with exit code 2. - Extensible Flag Blocking: The grep pattern can be extended to block additional flags such as --force, and combined with other PreToolUse hooks like dangerous rm detection. - Use Case: A team enforcing pre-commit linting and GPG signing installs the hook in their project's .claude/settings.json so that any AI agent attempting git commit --no-verify is rejected with an explanatory error message. ## Quick Start Add the PreToolUse hook configuration to my project's .claude/settings.json so that git commands using --no-verify or --no-gpg-sign are blocked.

Frequently Asked Questions about block-no-verify-hook

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I block git --no-verify in Claude Code?

Add a PreToolUse hook with a Bash matcher to .claude/settings.json that greps the TOOL_INPUT variable for git commands containing --no-verify or --no-gpg-sign. When matched, the hook prints an error to stderr and exits with code 2, which rejects the tool call.

How do PreToolUse hooks work in Claude Code?

PreToolUse hooks run before a tool call executes and receive the tool input via the TOOL_INPUT environment variable. Exit code 0 allows the call, exit code 1 shows a warning but proceeds, and exit code 2 blocks the tool call entirely.

Can I apply the hook globally across all projects?

Yes, add the same PreToolUse hook configuration to ~/.claude/settings.json instead of the project-level file. This enforces the bypass-flag blocking across every project where Claude Code runs.

Can I block additional git flags like --force?

Yes, extend the grep pattern in the hook command to include more flags, such as --force or --force-with-lease. You can also stack multiple PreToolUse hook entries to block other dangerous commands like rm -rf /.

Why is my git commit still bypassing hooks after setup?

Verify the settings.json file is valid JSON and located at .claude/settings.json in the project root or ~/.claude/settings.json globally. Test by attempting git commit --no-verify -m "test" and confirm the hook prints the BLOCKED message.