com um clique
hk
Use when bootstrapping hk pre-commit hooks for a project.
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Menu
Use when bootstrapping hk pre-commit hooks for a project.
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Baseado na classificação ocupacional SOC
| name | hk |
| description | Use when bootstrapping hk pre-commit hooks for a project. |
| argument-hint | [stacks... | --check | --update] |
| allowed-tools | ["Glob","Grep","Read","Bash(command -v:*)","Bash(git log --oneline:*)","Bash(git rev-parse:*)","Bash(hk --version:*)","Bash(hk check:*)","Bash(hk validate:*)","Bash(mise --version:*)","Bash(mise ls-remote:*)","Bash(mise registry:*)","Bash(mise which:*)","Bash(test -d:*)","Bash(test -f:*)"] |
$ARGUMENTS
Git repo root: !`git rev-parse --show-toplevel 2>/dev/null || echo "NOT A GIT REPO"`
hk.pkl exists: !`test -f hk.pkl && echo "yes" || echo "no"`
hk available: !`command -v hk 2>/dev/null && hk --version 2>/dev/null || echo "not installed"`
mise available: !`command -v mise 2>/dev/null && mise --version 2>/dev/null || echo "not installed"`
Conventional commits: !`git log --oneline -10 2>/dev/null || echo "no git history"`
EnterPlanMode before making any changes. This skill is plan-first — detection and analysis happen before any writes.git -C <path> — it rewrites the command prefix, breaking allowed-tools pattern matching and forcing unnecessary user approval.mise use hk as the first install step.--mise flags: hk init --mise (scaffolds mise.toml with hk task) and hk install --mise (hooks execute via mise x so tools are in PATH without shell activation).Detection and validation tools are auto-allowed (Read, Glob, Grep, hk validate, hk check, etc.). Mutating operations — mise use, hk install, hk fix, Write, Edit — are not in allowed-tools, so Claude Code will prompt the user to approve each one. This is the intended flow: the agent proceeds through install/write/fix steps normally, and the user gates each action via Claude Code's standard approval UI.
Determine the mode from arguments:
| Pattern | Mode |
|---|---|
| (empty) | Auto-detect: scan project, detect stacks, full bootstrap |
--check | Check: validate existing hk.pkl, run hk check --all |
--update | Update: detect new stacks, propose additions to existing hk.pkl |
rust shell go ... | Force stacks: use specified stacks, skip auto-detection |
If arguments contain --check:
hk.pkl exists — error if nothk validate to check config syntaxhk check --all to run all checkshk fix --all or /hk --updateCall EnterPlanMode now. All remaining work happens in plan mode.
Probe for indicator files to determine which stacks apply:
| Indicator | Stack | Stack File |
|---|---|---|
| (always) | essential | stacks/essential.md |
*.sh, *.bash, bin/ with scripts | shell | stacks/shell.md |
.github/workflows/*.yml | github-actions | stacks/github-actions.md |
Cargo.toml | rust | stacks/rust.md |
go.mod | go | stacks/go.md |
Dockerfile*, Containerfile*, docker-compose.yml, compose.yml | docker | stacks/docker.md |
*.pkl, PklProject, **/*.yml (non-GHA) | config-languages | stacks/config-languages.md |
*.lua, .stylua.toml, init.lua | lua | stacks/lua.md |
For force stacks mode: use only the specified stacks (plus essential always).
For update mode: detect stacks not already covered in existing hk.pkl.
Read each detected stack's .md file from the stacks/ directory (relative to this skill). Extract:
Builtins.xxx syntaxCheck for additional context that affects configuration:
.editorconfig exist? (affects editorconfig-checker, shfmt)action.yml exist? (affects ghalint_action).tmpl files? (affects shell stack exclusions)commitlint, .commitlintrc).github/? (affects yaml linter inclusion).json files with // comments — VS Code/Cursor configs). Exclude from jq.docs/reference/, vendor/, gitingest dumps). Exclude from content-sensitive checks (detect-private-key, markdown-lint).hk.pkl? Add them to the global exclude.mise ls-remote hk | tail -1
Use the result for the amends line in hk.pkl.
Mentally compose the hk.pkl config following this structure:
amends "package://github.com/jdx/hk/releases/download/vX.Y.Z/hk@X.Y.Z#/Config.pkl"
import "package://github.com/jdx/hk/releases/download/vX.Y.Z/hk@X.Y.Z#/Builtins.pkl"
local linters = new Mapping<String, Step | Group> {
// essential builtins
// stack-specific builtins with overrides from gotchas
}
hooks = new {
["pre-commit"] {
fix = true
stash = "git"
steps = linters
}
["pre-push"] {
steps = linters
}
["check"] {
steps = linters
}
["fix"] {
fix = true
steps = linters
}
}
If conventional commits detected, add:
["commit-msg"] {
steps {
["check-conventional-commit"] = Builtins.check_conventional_commit
}
}
Write the plan including:
hk.pkl — full file content, including global exclude for nested projectsmise use tool@VERSION commands (resolve versions via mise ls-remote).markdownlint.json, .stylua.toml, .editorconfig, etc.hk.pkl, .mise.toml, .markdownlint.json, .stylua.toml, etc.)hk fix --all auto-formatted changes to tracked filesCall ExitPlanMode and wait for approval.
Run these steps in order:
Install tools one at a time with pinned versions:
mise use hk@X.Y.Z
mise use ghalint@X.Y.Z
# etc. — one tool per command to avoid partial failures
After each install, verify it landed in the project .mise.toml (not global config).
Use mise x -- TOOL --version if the tool isn't in PATH yet (avoids shell reload).
If the project has no .mise.toml yet, run mise x -- hk init --mise after installing hk
to scaffold a mise.toml with an hk pre-commit task definition.
Write config files — hk.pkl, .markdownlint.json, .stylua.toml, etc.
Install hooks (with mise integration):
mise x -- hk install --mise
The --mise flag makes hooks execute via mise x, so all mise-managed tools are
automatically in PATH — other developers don't need mise activated in their shell.
Validate config:
mise x -- hk validate
Run checks:
mise x -- hk check --all
If check failures, offer to fix:
mise x -- hk fix --all
Then re-run hk check --all to verify.
Commit in sequence (per the plan's commit strategy):
hk fixReport results — summarize what was installed, configured, and any remaining issues.
Use when checking Buildkite CI/CD builds, investigating failures, viewing job logs, or answering questions about pipeline status.
Write a handoff brief summarizing the current conversation so a fresh agent can pick up the work. Writes to a file if given, otherwise copies to the clipboard.
Use when adding, updating, troubleshooting, or managing mise tool dependencies. Supplements /install with mise-specific context about backends, lockfiles, and the github-first policy.
Add a tool pattern to the global Claude Code permissions allow list in bin/sync-claude-settings
Use when labeling GitHub issues or triaging the backlog. Applies the project's label taxonomy from docs/labels.md.
Morning update routine: merge Renovate PRs, rebase local work, apply chezmoi changes