/hk:hk-creating-checksfrom hk
Guides writing and fixing hk checks (steps) in hk.pkl, including picking builtins, writing custom commands, declaring effects for --safe, and handling syntax differences between hk 1.x and 2.x.
Ships in hk. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
A check is an hk step: a name, the files it applies to, and check / fix commands, defined in hk.pkl (hk's config, written in the Pkl language). This skill is about writing one that works on the hk version the project actually runs.
Syntax and agent-safety features changed a lot between 1.x and 2.x. Find out before writing anything:
hk --version # the runtime
grep -m1 'hk@' hk.pkl # the schema the config amends ([email protected])
grep -n 'hk' mise.toml .mise.toml 2>/dev/null # what the project pins
The amends URL decides what syntax is valid; the binary decides what runs. They can disagree. Check references/versions.md for what each version supports. The short version:
| hk | What you can use |
|---|---|
| before 1.55 | String commands only. No effect, no --safe, no hk agent. |
| 1.55 and later | CommandSpec with effect, --safe, hk agent, hk mcp. |
| 2.0 and later | Top-level steps (implicit check, fix, pre-commit hooks), flat builtins with options, Pkl-only config. |
hk builtins | grep -i <tool>. Use Builtins.<name> and override only what differs: (Builtins.ruff) { glob = List("src/**/*.py") }. Builtins already declare effects (1.55 and later).argv), templates like {{files}}, and check vs fix vs check_diff.CommandSpec, hk's wrapper that lets a command carry an effect. --safe refuses a step whose effect is unknown, and coding-agent hooks run --safe. See references/effects.md for how to choose read, write, or destructive.steps and it appears in check, fix, and pre-commit. On 1.x, add it to each hooks { ... steps { } } block.hk validate # config loads
hk run check --plan --all # which steps and files would run
hk run check --step <name> --all # run just this step
hk run check --safe --all --format json # what an agent hook will see (1.55 and later)
If --safe fails with effect is unknown, the step needs a CommandSpec. If it passes a step you expect to fail, run the step's command by hand: hk only reports what the command's exit status says.
| Symptom | Cause | Fix |
|---|---|---|
--safe refused to run: s.check: effect is unknown | String command, or CommandSpec without effect | Wrap in new CommandSpec { command = "..."; effect = "read" } |
unexpected argument '--safe' | hk older than 1.55 | Drop --safe, or upgrade the pin |
Hook 'check' not found | hk.pkl has hooks but no check hook | 2.x: define top-level steps. 1.x: add a check hook |
cannot add property 'argv' to non-open class | argv put directly on CommandSpec | command = new Command { argv = List(...) } |
Template error on a command with {{ | The command's own syntax uses {{ and hk renders it as a template | Wrap in {% raw %}...{% endraw %} |
| Step runs on no files | No glob, so it runs whenever the hook does | Add glob, or accept it as a whole-project check |
| Check edits files | check must be read-only, and hk's file locking assumes it is | Move the edit to fix, or declare effect = "write" honestly |
Built from the upstream hk docs and release notes, current as of hk 2.7.1 (2026-10-19). Examples marked verified were run against real hk 2.0.0 and 2.7.1. See references/versions.md for how to refresh.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub technicalpickles/pickled-claude-plugins --plugin hkOther plugins' skills for the same job