Skip to content

Git hooks for linters and formatters

Configure your checks once and run them before commits, while you work, or in CI. hk runs independent steps in parallel and coordinates changes to shared files.

mise use hk

Install with mise, or choose another installation method. All options →

hk.pklOne set of steps
local linters = new Mapping<String, Step> {
  ["prettier"] = Builtins.prettier
  ["eslint"] = Builtins.eslint
  ["ruff"] = Builtins.ruff
}

hooks {
  ["pre-commit"] {
    fix = true
    stash = "git"
    steps = linters
  }
  ["check"] { steps = linters }
}

Independent files, concurrent work

app.ts
checkfix
main.py
checkfix

Checks can read a file concurrently; fixes wait for exclusive access.

See the complete configuration

Parallel execution

Read/write locks coordinate overlapping steps. Diff and file-list checks let hk narrow the work that needs an exclusive lock.

How execution works →

Partial commits

Stash unstaged work before fixing the staged version of a file, then restore it after the hook finishes.

Understand stashing →

Linter configuration

Start with built-in configurations or write a shell command. Use mise or your existing package manager to provide the tools.

Browse builtins →

Run checks locally and in CI

Define your steps once in Pkl. Reuse them when you check a change, fix your working tree, or validate the whole repository.

Learn the workflow →
hk check
Check modified files
hk fix
Apply available fixes
hk check --all
Check the repository in CI
hk check --plan
Preview which steps will run
MIT LicenseCopyright © 2026jdx.dev