When AI helps generate code, velocity goes up. So does the chance of shipping something you did not fully inspect.
If AI writes your code, hooks should gate your push.
- pre-commit: staged secret scan + SAST + API smoke tests
- pre-push: full secret scan + vulnerability/misconfig scan + coverage gate
AI makes output faster. Hooks keep quality and security non-optional.
- AI can produce plausible code that hides subtle security or logic risks.
- Teams under deadline pressure skip manual checks.
- Hooks convert "I should check" into "it must pass first".
- Secret scanning (
trufflehog) on staged changes and full repo before push. - Security scanning (
trivy/semgrep) with fail-on-high severity. - Fast API-focused tests at commit time.
- Full coverage gate at push time.
If AI writes your code, hooks should gate every push: pre-commit (staged secrets + SAST + API smoke tests) and pre-push (full secrets + vuln/misconfig scan + coverage gate). AI speeds output; hooks make security and quality non-optional.