home/dot_claude/skills/hk/SKILL.md
Use when bootstrapping hk pre-commit hooks for a project.
npx skillsauth add ivy/dotfiles hkInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
$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/[email protected]#/Config.pkl"
import "package://github.com/jdx/hk/releases/download/vX.Y.Z/[email protected]#/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 [email protected]
mise use [email protected]
# 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.
tools
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.
data-ai
Use when the user wants to set, change, or clear git commit co-authors for pair or mob programming.
testing
Interview the user relentlessly about a plan or design until reaching shared understanding, resolving each branch of the decision tree. Use when user wants to stress-test a plan, get grilled on their design, or mentions "grill me".
tools
--- name: gitingest description: Use when the user wants to fetch and contextualize a GitHub repository for future reference. argument-hint: [url | user/repo | repo-name] [filters...] allowed-tools: - Bash(mkdir docs/reference) - Bash(gitingest:*) - Read --- # Fetch GitHub Repository Context ## Arguments ``` $ARGUMENTS ``` ## Instructions ### 1. Parse Input - **Full URL**: use directly - **user/repo**: construct `https://github.com/{user/repo}` - **Single name**: infer canonical repo