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
Summary
Add the
block-no-verifypackage to prevent Claude Code from bypassing git hooks using the--no-verifyflag.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:commit,push,merge,cherry-pick,rebase,am)--no-verifyor-nflag is detectedConfiguration Required
Create
.claude/settings.json:{ "hooks": { "PreToolUse": [ { "matcher": "Bash", "hooks": [ { "type": "command", "command": "npx block-no-verify" } ] } ] } }Benefits
References