setup-pre-commit
Installation
SKILL.md
Set Up Git Hooks
Three hooks, each fast:
| Hook | Checks |
|---|---|
pre-commit |
Format and lint the staged files, then type-check |
commit-msg |
The commit message: ASCII only, no attribution trailers, the subject pattern |
pre-push |
The branch name, then the aggregate check command (optional) |
The message and branch rules come from the pr-hygiene block in the coding
standard. scripts/pr_hygiene.py reads that block, and
CI runs the same script on every pull request.
1. Detect the project
- Package manager.
bun.lockorbun.lockb(bun),pnpm-lock.yaml(pnpm),yarn.lock(yarn), otherwise npm. Use it for every command below. - Formatter and linter. Read the manifest and config files. Use what the project already has. If it has neither, use the defaults: