block-no-verify-hook
Ce qu’il fait
Cette fonctionnalité empêche les assistants IA de contourner les contrôles de sécurité importants lorsqu'ils soumettent du code. Elle garantit que tous les contrôles de qualité, comme le formatage et les tests, sont bien exécutés.
Quand l’utiliser
- ✓Lors de la configuration d'un projet pour garantir la qualité du code.
- ✓Lorsque vous voulez être sûr que le code soumis a passé tous les contrôles.
- ✓Pour empêcher l'IA de contourner des étapes de validation essentielles.
Lien du skill
https://github.com/wshobson/agents/blob/main/plugins/block-no-verify/skills/block-no-verify-hook/SKILL.mdCopiez-le et collez-le dans votre IA (Claude, ChatGPT ou Cursor) en lui demandant de suivre les instructions.
Comment l’utiliser
Le plus simple : copiez le message et collez-le dans votre IA. Elle lit le skill et suit les instructions.
Message prêt à coller
Pour Claude Code, Codex ou Cursor : lancez-la dans le dossier du projet et le skill est installé.
Téléchargez le SKILL.md et placez-le dans le dossier de skills de votre agent.
Exemple de demande à votre IA
“Configurez le projet pour que l'IA ne contourne pas les contrôles lors des commits.”
5 nouveaux skills par semaine. 1 minute de lecture.
Comment ça marche
Elle ajoute une règle qui inspecte les commandes que l'IA tente d'exécuter. Si une commande tente de contourner les contrôles (en utilisant des options comme '--no-verify'), la règle la bloque et affiche un message.
Contenu technique (SKILL.md original)
Texte original de l’auteur, en anglais, directement depuis GitHub.
Block No-Verify Hook
PreToolUse hook configuration that intercepts and blocks bypass-flag usage before execution, ensuring AI agents cannot skip pre-commit hooks, GPG signing, or other git safety mechanisms.
Overview
AI coding agents (Claude Code, Codex, etc.) can run shell commands with flags like --no-verify that bypass pre-commit hooks. This defeats the purpose of linting, formatting, testing, and security checks configured in pre-commit hooks. The block-no-verify hook adds a PreToolUse guard that rejects any tool call containing bypass flags before execution.
Problem
When AI agents commit code, they may use bypass flags to avoid hook failures:
# These commands skip pre-commit hooks entirely
git commit --no-verify -m "quick fix"
git push --no-verify
git commit --no-gpg-sign -m "unsigned commit"
git merge --no-verify feature-branch
This allows:
- Unformatted code to enter the repository
- Linting errors to bypass checks
- Security scanning to be skipped
- Unsigned commits to bypass signing policies
- Test suites to be circumvented
Solution
Add a PreToolUse hook to .claude/settings.json that inspects every Bash tool call and blocks commands containing bypass flags.
Configuration
Add the following to your project's .claude/settings.json:
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "if grep -qE '\"command\"[[:space:]]*:[[:space:]]*\"([^\"\\\\]|\\\\.)*(--no-(ver|g)|commit([^\"\\\\]|\\\\.)*([[:space:]]|\\\\[tn])-[a-zA-Z]*n)'; then echo 'BLOCKED: --no-verify and --no-gpg-sign flags are not allowed. Run the commit without bypass flags so that pre-commit hooks execute properly.' >&2; exit 2; fi"
}
]
}
]
}
}
How It Works
- Matcher: The hook targets only
Bashtool calls, so it does not interfere with other tools (Read, Edit, Grep, etc.). - Inspection: Claude Code sends the tool call to the hook as JSON on stdin and sets no
$TOOL_INPUTvariable. The hook searches thecommandvalue in that JSON withgrep -E, so it needs nojqornode, and text in other fields, such ascwdor the tool call's description, can't trigger it. It blocks--no-verify,--no-gpg-sign, and any shorter prefix of them that git accepts, e.g.,--no-veri. It also blocks a short option group withnthat followscommitin the same command, e.g.,-nor-nm, because-nis the short form of--no-verify. The hook doesn't look for the wordgit, so it also catchesif git ...,sudo git ..., andg=git; $g commit --no-verify. A false match, such as a commit message that mentions a flag, blocks the call, which is the safe way to fail. - Blocking: If a bypass flag is found in a git command, the hook exits with code 2 and prints an error message. Exit code 2 signals Claude Code to reject the tool call entirely.
- Pass-through: If no bypass flag is found, the hook exits with code 0 and the command executes normally.
- Limits: The hook checks text, so it stops an agent that reaches for a bypass flag out of habit. It doesn't stop an agent that sets out to evade it, e.g., by building the flag from pieces or by running
git -c core.hooksPath=/dev/null commit.
Exit Codes
| Code | Meaning |
|---|---|
| 0 | Allow the tool call to proceed |
| 1 | Error (tool call still proceeds, warning shown) |
| 2 | Block the tool call entirely |
Blocked Flags
| Flag | Purpose | Why Blocked |
|---|---|---|
--no-verify |
Skips pre-commit and commit-msg hooks | Bypasses linting, formatting, testing, security checks |
--no-gpg-sign |
Skips GPG commit signing | Bypasses commit signing policy |
Installation
Per-Project Setup
Create or update .claude/settings.json in your project root:
mkdir -p .claude
cat > .claude/settings.json << 'EOF'
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "if grep -qE '\"command\"[[:space:]]*:[[:space:]]*\"([^\"\\\\]|\\\\.)*(--no-(ver|g)|commit([^\"\\\\]|\\\\.)*([[:space:]]|\\\\[tn])-[a-zA-Z]*n)'; then echo 'BLOCKED: --no-verify and --no-gpg-sign flags are not allowed. Run the commit without bypass flags so that pre-commit hooks execute properly.' >&2; exit 2; fi"
}
]
}
]
}
}
EOF
Global Setup
…
Questions fréquentes
Pourquoi l'IA contournerait-elle les contrôles ?
L'IA pourrait essayer de les contourner pour aller plus vite, mais cela peut entraîner des erreurs ou un code de faible qualité dans le projet.
Quels contrôles sont empêchés d'être contournés ?
Des contrôles comme le formatage du code, les tests automatisés, l'analyse de sécurité et la signature des commits.
Que se passe-t-il si l'IA tente de contourner un contrôle ?
La commande est bloquée, et l'IA reçoit un message expliquant qu'elle ne peut pas contourner les contrôles et doit les exécuter normalement.
Détails
Description originale de l’auteur
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.
repo: wshobson/agents
Popularité
- Étoiles GitHub
- 41k
- Position au classement
- #6645
- Licence
- MIT
- Mis à jour
- 15/10/2026
Commentaires
- …
Autres skills de ce dépôt
screen-reader-testing
41kPermet à votre agent de tester les sites web avec des lecteurs d'écran pour vérifier leur accessibilité.
wcag-audit-patterns
41kAide votre agent à auditer l'accessibilité des sites web et à corriger les problèmes selon les directives WCAG.
multi-reviewer-patterns
41kPermet à votre agent de coordonner des revues de code en parallèle, de dédoublonner les résultats et de consolider les rapports.
parallel-debugging
41kPermet à votre agent de déboguer des problèmes complexes grâce à des investigations en parallèle et à l'analyse des causes racines.
Skills similaires
diffs
394kPermet à votre agent de produire un diff réel et partageable de vos modifications, sous forme de lien ou d'image, plutôt qu'un résumé écrit à la main.
coding-agent
394kAide votre agent à confier une tâche de programmation plus importante à Codex, Claude Code ou OpenCode comme travailleur en arrière-plan, puis à suivre sa progression.
gh-issues
394kAide votre agent à trouver des tickets GitHub, choisir ceux à traiter et ouvrir des pull requests avec des correctifs, y compris le suivi des commentaires de relecture.