# How do you enforce design checks in a pre-commit hook?

Updated 2026-11-21 · https://briefatto.com/guides/design-check-in-pre-commit-hook/

Run `npx briefatto-board check .` in the hook: it renders your pieces and sets exit status 1 when any fails, and Git aborts the commit when a pre-commit hook exits non-zero. The same command works as a CI step.

## The hook

On a frozen board, save this as `.git/hooks/pre-commit` and make it executable:

```sh
#!/bin/sh
npx briefatto-board check . "outputs/*.html"
```

The quotes pass the glob to Board, which expands it itself, so the same line works in PowerShell on Windows.

## What stops the commit

- Text that is clipped, off the canvas, over other text or too small where it is seen.
- A font that never loaded, and contrast below WCAG.
- Anti-patterns found by the Impeccable detector.
- A delivery PNG or PDF listed in `deliverables.json` that does not match its editable HTML. A PNG must match every decoded RGBA pixel.

## In CI

Run the same command as a step after installing dependencies. `board check` writes a receipt that records which checks ran, so the log says what was tested as well as what failed.

## Questions and answers

### Does it check exported PNG and PDF files too?

Yes. Board decodes every file listed in `deliverables.json`, compares it with its HTML source and records in the receipt the SHA-256 of the checked bytes.

### Does the hook need a browser?

Yes, Chromium. If it is missing, the first render prints the Playwright command that installs it.

### Is Briefatto Board free?

Yes. It is open source under the Apache-2.0 licence and installs with `npx briefatto-board install`.

## Try it

```
npx briefatto-board install
```

Briefatto Board is free and open source under Apache-2.0: https://github.com/Briefatto/briefatto-board

## Related guides

- [Design checks as scripts instead of prompts: how board check works](https://briefatto.com/guides/deterministic-design-checks-vs-prompts/)
- [How do I make an agent follow a design skill every time?](https://briefatto.com/guides/make-an-agent-follow-a-skill/)
- [How do you verify that an exported PNG or PDF matches its HTML source?](https://briefatto.com/guides/verify-exported-png-matches-html/)
- [How to make an AI agent follow your design rules](https://briefatto.com/guides/make-an-agent-follow-your-design-rules/)

## Sources

- https://github.com/Briefatto/briefatto-board/blob/main/src/board/cli.ts
- https://github.com/Briefatto/briefatto-board/blob/main/README.md
- https://git-scm.com/docs/githooks (checked 2026-11-21)
- https://github.com/Briefatto/briefatto-board/blob/main/skill/briefatto-board/SKILL.md
- https://github.com/Briefatto/briefatto-board/blob/main/LICENSE
