Quoting Geoffrey Huntley
Pre-commit hooks can enforce agent coding conventions by failing commits and injecting corrective prompts
“I write a pre-commit hook that checks the git diff for direct calls to observability modules that bypass my diagnostics module. Boom: fail the commit, inject a prompt telling the agent to use the diagnostics library. All of a sudden it's ten out of ten.”
Geoffrey Huntley describes using pre-commit hooks as a guardrail mechanism for AI coding agents, failing commits that violate conventions and injecting corrective prompts to steer agent behavior. This pattern treats git hooks as a runtime constraint layer for agents, not just humans. It's a practical, low-overhead technique for enforcing architectural conventions in agentic workflows.