pre-commit Framework
Standardise local pre-commit hooks across teams.
Setup
The pre-commit framework is the standard tool for managing git commit hooks across a team. The setup is bounded; the benefits compound across every commit. The discipline is selecting the right hooks and curating the configuration over time.
What setup looks like:
- .pre-commit-config.yaml lists hooks.: The configuration file lives in the repository. Each hook is defined; the version is pinned; the configuration is shared across the team.
- pre-commit install activates.: Each developer runs pre-commit install once. The command sets up the hooks in their local git; commits trigger the hooks.
- Per-language formatters.: Formatters for each language in the codebase. Black for Python, gofmt for Go, prettier for JavaScript, rustfmt for Rust. The formatting is consistent; arguments about style are eliminated.
- Security scanners.: Secret detection, vulnerability scanners, license checkers. The security checks run before commit; issues are caught at the earliest possible moment.
- Custom hooks.: Beyond standard hooks, teams add custom hooks for their specific patterns. The framework supports custom hooks; the discipline extends to team-specific concerns.
The setup is bounded. The configuration is shared; the benefits accrue from each developer's adoption.
Benefits
Pre-commit hooks produce consistency and catch issues early. The benefits compound across the team's commits and across the team's lifetime.
- Consistent across team.: Every developer's commits go through the same hooks. The output is consistent; the formatting is uniform; the team's discipline is shared.
- Catches issues before CI.: Hooks catch issues at commit time. CI does not have to catch the same issues; the CI's role is the higher-stakes checks that hooks cannot do locally.
- Faster CI.: CI does not have to run all the same checks. Format checks, simple linting, basic security scans all happen in pre-commit; CI runs only what cannot be done locally.
- Faster feedback loop.: The developer's feedback loop is seconds, not minutes. The hook fails locally; the developer fixes; the next commit succeeds. The CI loop is reserved for substantial changes.
- Onboarding is faster.: New developers' first commits produce hook output that teaches them the team's standards. The hooks are part of the onboarding; the team's culture transfers through the configuration.
The benefits are real and compounding. Each commit produces value; the cumulative effect is significant.
Avoid
Pre-commit can be over-applied. Too many hooks slow every commit; the friction outweighs the value. The discipline includes curation.
- Hook spam.: Adding every available hook produces commit-time bloat. The team's commit experience degrades; developers find ways to bypass the hooks; the discipline is undermined.
- Too many hooks slow commits.: Sequential hooks add up. A 10-second commit feels fine; a 60-second commit is annoying; a 5-minute commit produces revolt.
- Curate.: The team reviews the hook list periodically. Hooks that produce few findings are candidates for removal; hooks that catch real issues stay.
- Remove rarely-useful ones.: Hooks that fire rarely contribute little to the team's value. Removing them speeds commits; the hooks that remain are higher-leverage.
- Track findings.: Hook findings can be tracked. Hooks that catch many real issues are valuable; hooks that catch many false alarms or noise are not. The data drives curation decisions.
The pre-commit framework is one of those developer tooling disciplines that pays off across many commits. Nova AI Ops integrates with development tooling, surfaces commit-time patterns, and helps teams understand whether their hook setup is producing value or friction.