/plankit:guardfrom plankit
Prevents accidental git mutations and release bumps by enforcing branch, push, breaking, and bump policies via a PreToolUse hook. Useful for protecting main branches and release integrity.
Ships in plankit. 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.
None: SKILL.md is the whole skill.
pk guard is a PreToolUse hook on shell commands. Before the agent
runs a git mutation (am, cherry-pick, commit, merge, pull,
push, rebase, reset, revert) or a release command carrying
--bump, guard reads .pk.json and answers with a permission
decision. Four policies apply; the strongest decision wins, and deny
beats ask.
guard.mode): a mutation while a protected branch
(guard.branches) is checked out is denied (block), questioned
(ask), or ignored (off)guard.push): any git push, on any branch, is
denied, questioned, or ignored, because pushing is the developer's
actionguard.breaking): a commit whose message carries a
breaking marker is questioned (ask) or ignored (off)guard.bump): a pk ship or pk changelog whose
--bump is lower than the bump the commits infer is questioned
(ask) or ignored (off)The hook recognizes git through chains (&&, ||, ;, |, &),
subshells and command substitution, shell keywords such as then and
do, quoted words, environment prefixes, absolute paths, git -C,
and git.exe. A compound command is judged by its parts. A
here-document's body is read as data, not as commands.
A guardrail against an agent following its defaults, not a security
boundary. A command run through sudo, sh -c, eval, or a shell
reading a here-document is not read. An internal error fails open with a note on stderr.
An unconfigured repository (no .pk.json) is a no-op.
Edit .pk.json and commit it. The keys, their values, and their
defaults are under Settings below.
"guard": {
"branches": ["main"],
"breaking": "ask",
"bump": "ask",
"mode": "block",
"push": "block"
}
A breaking marker (! after the type, or a BREAKING CHANGE: footer)
drives the next major version. The marker is the developer's claim,
and an agent never adds one on its own judgment.
The hook asks before a git commit whose message carries a marker.
guard.breaking: "off" disables the ask, not the rule.
The message is read where the command line holds it: a -m or
--message argument, a here-document passed as
-m "$(cat <<'EOF' … EOF)", and a here-document on stdin with
-F -. A -F file and an editor commit pass through, because their
text is not in the command line.
The commits decide the version: a breaking marker is major, feat is
minor, anything else is patch, and pk changelog infers the bump from
them. --bump on pk ship or pk changelog overrides the inference,
and the override is the developer's call, like the marker. The hook
asks before a --bump lower than what the commits infer (patch over a
feat, minor or patch over a breaking change), and the question lists
the commits that call for the higher bump. A higher --bump passes. So
does --dry-run, which writes nothing, and an --exclude beside the
--bump counts in the measurement, as changelog counts it.
guard.bump: "off" disables the ask, not the rule.
The guard section of .pk.json:
"guard": {
"branches": ["<branch>", ...],
"breaking": "ask" | "off",
"bump": "ask" | "off",
"mode": "block" | "ask" | "off",
"push": "block" | "ask" | "off"
}
guard.branches: a list of branch names; default the release branch. The protected branches: a git mutation while one is checked out is judged by guard.mode.guard.breaking: ask or off; default ask. A commit whose message carries a breaking marker (! or BREAKING CHANGE) is questioned, or not.guard.bump: ask or off; default ask. A --bump on pk ship or pk changelog lower than the bump the commits infer is questioned, or not.guard.mode: block, ask, or off; default block. A git mutation while a protected branch is checked out is denied, questioned, or ignored.guard.push: block, ask, or off; default block. Any git push, on any branch, is denied, questioned, or ignored.An unknown key or a value outside these fails the whole file when it loads, with a message naming the key: pk commands exit 2, and each hook reports the message and takes no action until it is fixed. An absent key means its default. pk status reads the file back and reports the first problem.
Every command also accepts --plain, --project-dir <value>, and --quiet; see pk help help.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
14 skills in this plugin
/briefWhat each session is told about this repository's plankit policy at start, generated from .pk.json/changelogGenerate CHANGELOG.md from conventional commits and stage a release with the Release-Tag trailer/craftEngineering standards and reusable prompts for working in a plankit repository - load the standards, or run a named prompt/helpShow documentation for pk and its commandsnpx claudepluginhub markwharton/plankit --plugin plankitOther plugins' skills for the same job