Skip to content

Built-in Linters Reference

hk provides 140+ pre-configured linters and formatters through the Builtins module. These are production-ready configurations that work out of the box.

Usage

Import and use builtins in your hk.pkl:

pkl
amends "package://github.com/jdx/hk/releases/download/v1.54.0/hk@1.54.0#/Config.pkl"
import "package://github.com/jdx/hk/releases/download/v1.54.0/hk@1.54.0#/Builtins.pkl"

hooks {
  ["pre-commit"] {
    steps {
      ["prettier"] = Builtins.prettier
      ["eslint"] = Builtins.eslint
    }
  }
}

You can also customize builtins:

pkl
["prettier"] = (Builtins.prettier) {
  batch = false  // Override the default batch setting
  glob = List("*.js", "*.ts")  // Override file patterns
}

Available Builtins

AsciiDoc

asciidoctor

AsciiDoc syntax validator and processor

  • Check: asciidoctor --failure-level=WARNING --out-file=/dev/null {{ files }}

Build Systems

buildifier-format

Formatter for Bazel BUILD, WORKSPACE, and Starlark files

  • Glob: **/BUILD, **/BUILD.bazel, WORKSPACE, WORKSPACE.bazel, MODULE.bazel, **/*.bzl, **/*.star, **/*.sky
  • Check: buildifier -mode=check {{ files }}
  • Fix: buildifier {{ files }}

buildifier-lint

Linter for Bazel BUILD, WORKSPACE, and Starlark files

  • Glob: **/BUILD, **/BUILD.bazel, WORKSPACE, WORKSPACE.bazel, MODULE.bazel, **/*.bzl, **/*.star, **/*.sky
  • Check: buildifier -mode=check -lint=warn {{ files }}
  • Fix: buildifier -lint=fix {{ files }}

CSS

stylelint

CSS linter

  • Glob: **/*.css, **/*.scss, **/*.sass, **/*.less
  • Check: stylelint {{ files }}
  • Fix: stylelint --fix {{ files }}

Configuration

sort-package-json

Sort package.json keys

  • Glob: **/package.json
  • Check: sort-package-json --check {{ files }}
  • Fix: sort-package-json {{ files }}

Data Formats

buf-format

Protocol Buffers formatter

  • Glob: **/*.proto
  • Check (diff): buf format {{workspace}} --diff --exit-code
  • Fix: buf format {{workspace}} --write

buf-lint

Protocol Buffers linter

  • Glob: **/*.proto
  • Check: buf lint {{workspace}}

jq

JSON processor

  • Glob: **/*.json
  • Check (diff): failed=0 for f in {{ files }}; do jq . "$f" | diff -u "$f" - || failed=1 done exit $failed
  • Fix: for f in {{ files }}; do tmp=$(mktemp) && jq -S . "$f" > "$tmp" && mv "$tmp" "$f" done

sql-fluff

SQL linter and formatter

  • Glob: **/*.sql
  • Check: sqlfluff lint {{ files }}
  • Fix: sqlfluff fix {{ files }}

taplo

TOML linter

  • Glob: **/*.toml
  • Check: taplo lint {{ files }}

taplo-format

TOML formatter

  • Glob: **/*.toml
  • Check (diff): taplo format --check --diff {{ files }}
  • Fix: taplo format {{ files }}

tombi

TOML linter

  • Glob: **/*.toml
  • Check: tombi lint --quiet {{ files }}

tombi-format

TOML formatter

  • Glob: **/*.toml
  • Check (diff): tombi format --quiet --check --diff {{ files }}
  • Fix: tombi format --quiet {{ files }}

xmllint

XML validator

  • Glob: **/*.xml
  • Check: xmllint --noout {{ files }}

yamlfmt

YAML formatter

  • Glob: **/*.yml, **/*.yaml
  • Check (diff): yamlfmt -lint {{ files }}
  • Fix: yamlfmt {{ files }}

yamllint

YAML linter

  • Glob: **/*.yml, **/*.yaml
  • Check: yamllint --strict {{ files }}

yq

YAML processor

  • Glob: **/*.yaml, **/*.yml
  • Check (diff): failed=0 for f in {{ files }}; do yq -P "$f" | diff -u "$f" - || failed=1 done exit $failed
  • Fix: yq -iP {{ files }}

EditorConfig

editorconfig-checker

Validate files against EditorConfig rules

  • Check: ec {{ files }}

Elixir

mix-compile

Compile Elixir with Mix

  • Glob: **/*.ex
  • Check: mix compile --warnings-as-errors --strict-errors {{files}}

mix-fmt

Format Elixir with Mix

  • Glob: **/*.ex, **/*.exs
  • Check: mix format --check-formatted {{files}}
  • Fix: mix format {{files}}

mix-test

Test Elixir with Mix

  • Glob: **/*.ex, **/*.exs
  • Check: mix test --warnings-as-errors {{files}}

Go

err-check

Error handling checker

  • Glob: **/*.go
  • Check: cd {{workspace}} && errcheck ./...

go-fmt

Go formatter

  • Glob: **/*.go
  • Check (diff): DIFF=$(gofmt -s -d {{files}}) if [ -n "$DIFF" ]; then echo "$DIFF" exit 1 fi
  • Fix: gofmt -s -w {{files}}

go-fumpt

Strict Go formatter

  • Glob: **/*.go
  • Fix: gofumpt -w {{ files }}

go-imports

Go import management

  • Glob: **/*.go
  • Check: goimports -l {{ files }}
  • Fix: goimports -w {{ files }}

go-lines

Long line fixer

  • Glob: **/*.go
  • Check: golines --dry-run {{ files }}
  • Fix: golines -w {{ files }}

go-sec

Security scanner

  • Glob: **/*.go
  • Check: cd {{workspace}} && gosec ./...

go-vet

Go code vetting

  • Glob: **/*.go
  • Check: cd {{workspace}} && go vet ./...

go-vuln-check

Vulnerability scanner

  • Glob: **/*.go
  • Check: cd {{workspace}} && govulncheck ./...

golangci-lint

Go meta-linter

  • Glob: **/*.go
  • Check: cd {{workspace}} && golangci-lint run --fix=false ./...
  • Fix: cd {{workspace}} && golangci-lint run --fix ./...

gomod-tidy

Go module maintenance

  • Glob: **/go.mod
  • Check (diff): go mod tidy -diff
  • Fix: go mod tidy

revive

Fast Go linter

  • Glob: **/*.go
  • Check: cd {{workspace}} && revive ./...

staticcheck

Go static analysis

  • Glob: **/*.go
  • Check: cd {{workspace}} && staticcheck ./...

Infrastructure

actionlint

GitHub Actions workflow linter

  • Glob: .github/workflows/*.yml, .github/workflows/*.yaml

dclint

Docker Compose linter

  • Glob: **/compose*.yml, **/compose*.yaml, **/docker-compose*.yml, **/docker-compose*.yaml
  • Check: dclint {{files}}
  • Fix: dclint --fix {{files}}

ghalint-action

GitHub Actions action linter

  • Glob: **/action.*
  • Check: ghalint run-action {{ files }}

ghalint-workflow

GitHub Actions workflow linter

  • Glob: .github/workflows/*
  • Check: ghalint run

hadolint

Dockerfile linter

  • Glob: **/Dockerfile*
  • Check: hadolint {{ files }}

hclfmt

Hashicorp's hclfmt

  • Glob: **/*.hcl
  • Fix: hclfmt -w {{ files }}

mise

mise-en-place's built-in formatter and linter

  • Glob: mise.toml, mise.*.toml, .mise.toml, .mise.*.toml, mise/config.toml, mise/config.*.toml, .mise/config.toml, .mise/config.*.toml, .config/mise.toml, .config/mise.*.toml, .config/mise/config.toml, .config/mise/config.*.toml, .config/mise/mise.toml, .config/mise/mise.*.toml, .config/mise/conf.d/*.toml
  • Check: mise fmt --check
  • Fix: mise fmt

pinact

Pin GitHub Actions to commit SHA for security

  • Glob: .github/workflows/*, */action.*
  • Check (diff): pinact run --verify --check {{ files }}
  • Fix: pinact run --verify {{ files }}

pinact-update

Pin GitHub Actions to update actions to latest versions

  • Glob: .github/workflows/*, */action.*
  • Check (diff): pinact run --update --verify --check {{ files }}
  • Fix: pinact run --update --verify {{ files }}

terraform

Terraform formatter

  • Glob: **/*.tf, **/*.tfvars, **/*.tftest.hcl
  • Check (list-files): terraform fmt -check {{ files }}
  • Fix: terraform fmt {{ files }}

tf-lint

Terraform linter

  • Glob: **/*.tf
  • Check: tflint
  • Fix: tflint --fix

tofu

OpenTofu formatter

  • Glob: **/*.tf, **/*.tfvars, **/*.tftest.hcl
  • Check (list-files): tofu fmt -check {{ files }}
  • Fix: tofu fmt {{ files }}

zizmor

GitHub Actions security static analysis tool

  • Glob: .github/workflows/*.yml, .github/workflows/*.yaml, .github/dependabot.yml, **/action.yml, **/action.yaml
  • Check (diff): zizmor --no-progress {{ files }}
  • Fix: zizmor --no-progress --fix {{ files }}

Java

google-java-format

Google Java Format

  • Glob: **/*.java
  • Check: google-java-format --dry-run --set-exit-if-changed {{ files }}
  • Fix: google-java-format --replace {{ files }}

JavaScript/TypeScript

biome

Fast formatter and linter

  • Glob: **/*.js, **/*.jsx, **/*.ts, **/*.tsx, **/*.json

deno

Deno formatter

  • Glob: **/*.js, **/*.jsx, **/*.ts, **/*.tsx
  • Check: deno fmt --check {{ files }}
  • Fix: deno fmt {{ files }}

deno-check

Deno type checker

  • Glob: **/*.js, **/*.jsx, **/*.ts, **/*.tsx
  • Check: deno check {{ files }}

eslint

Pluggable JavaScript linter

  • Glob: **/*.js, **/*.jsx, **/*.ts, **/*.tsx
  • Check: eslint {{ files }}
  • Fix: eslint --fix {{ files }}

knip

Find unused files, dependencies, and exports

  • Check: knip --no-progress --directory {{workspace}}
  • Fix: knip --fix --no-progress --directory {{workspace}}

knip-strict

Find unused files, dependencies, and exports with strict mode enabled

  • Check: knip --strict --no-progress --directory {{workspace}}
  • Fix: knip --fix --strict --no-progress --directory {{workspace}}

ox-lint

Oxidation compiler linter

  • Glob: **/*.js, **/*.mjs, **/*.cjs, **/*.ts, **/*.mts, **/*.cts, **/*.jsx, **/*.tsx, **/*.vue, **/*.svelte, **/*.astro
  • Check: oxlint --deny-warnings {{ files }}
  • Fix: oxlint --deny-warnings --fix {{ files }}

oxfmt

Fast Rust-powered code formatter (Prettier compatible)

  • Glob: **/*.js, **/*.mjs, **/*.cjs, **/*.ts, **/*.mts, **/*.cts, **/*.jsx, **/*.tsx, **/*.mdx, **/*.vue, **/*.json, **/*.jsonc, **/*.json5, **/*.yaml, **/*.yml, **/*.toml, **/*.md, **/*.markdown, **/*.html, **/*.htm, **/*.css, **/*.scss, **/*.less, **/*.graphql, **/*.gql, **/*.handlebars, **/*.hbs
  • Check: oxfmt --check --no-error-on-unmatched-pattern {{ files }}
  • Fix: oxfmt --write --no-error-on-unmatched-pattern {{ files }}

prettier

Opinionated code formatter

  • Glob: **/*.js, **/*.jsx, **/*.mjs, **/*.cjs, **/*.ts, **/*.tsx, **/*.mts, **/*.cts, **/*.css, **/*.scss, **/*.less, **/*.html, **/*.json, **/*.json5, **/*.jsonc, **/*.yaml, **/*.yml, **/*.markdown, **/*.markdown.mdx, **/*.md, **/*.graphql, **/*.handlebars, **/*.svelte, **/*.astro, **/*.htmlangular, **/*.vue

sherif

Opinionated, zero-config linter for TypeScript & JavaScript monorepos

  • Glob: **/package.json, **/pnpm-workspace.yaml
  • Check: sherif
  • Fix: sherif --fix --no-install

standard-js

JavaScript Standard Style

  • Glob: **/*.js, **/*.jsx, **/*.ts, **/*.tsx
  • Check: standard {{ files }}
  • Fix: standard --fix {{ files }}

tsc

TypeScript type checker

  • Glob: **/*.ts, **/*.tsx
  • Check: tsc --noEmit -p {{workspace_indicator}}

tsserver

TypeScript language server diagnostics

  • Glob: **/*.ts, **/*.tsx
  • Check: tsc-files --noEmit {{ files }}

vp-check

Formats, lints, and type checks code together

  • Glob: **/*.js, **/*.mjs, **/*.cjs, **/*.ts, **/*.mts, **/*.cts, **/*.jsx, **/*.tsx, **/*.mdx, **/*.vue, **/*.svelte, **/*.astro, **/*.json, **/*.jsonc, **/*.json5, **/*.yaml, **/*.yml, **/*.md, **/*.markdown, **/*.html, **/*.htm, **/*.css, **/*.scss, **/*.less, **/*.graphql, **/*.gql, **/*.handlebars, **/*.hbs, **/*.toml
  • Check: vp check {{ files }}
  • Fix: vp check --fix {{ files }}

vp-fmt

Formats code with Oxfmt

  • Glob: **/*.js, **/*.mjs, **/*.cjs, **/*.ts, **/*.mts, **/*.cts, **/*.jsx, **/*.tsx, **/*.mdx, **/*.vue, **/*.json, **/*.jsonc, **/*.json5, **/*.yaml, **/*.yml, **/*.toml, **/*.md, **/*.markdown, **/*.html, **/*.htm, **/*.css, **/*.scss, **/*.less, **/*.graphql, **/*.gql, **/*.handlebars, **/*.hbs
  • Check: vp fmt --check {{ files }}
  • Fix: vp fmt {{ files }}

vp-lint

Lints code with OxLint

  • Glob: **/*.js, **/*.mjs, **/*.cjs, **/*.ts, **/*.mts, **/*.cts, **/*.jsx, **/*.tsx, **/*.mdx, **/*.vue, **/*.svelte, **/*.astro
  • Check: vp lint --deny-warnings {{ files }}
  • Fix: vp lint --deny-warnings --fix {{ files }}

xo

JavaScript/TypeScript linter with great defaults

  • Glob: **/*.js, **/*.jsx, **/*.ts, **/*.tsx
  • Check: xo {{ files }}
  • Fix: xo --fix {{ files }}

Lua

luacheck

Lua linter

  • Check: luacheck {{ files }}

selene

Lua linter

  • Check (diff): selene {{ files }}

stylua

Lua formatter

  • Check (diff): stylua --check {{ files }}
  • Fix: stylua {{ files }}

Markdown

contextlint

Rule-based linter for structured Markdown documents

  • Check: contextlint {{ files }}

markdown-lint

Markdown linter

  • Glob: **/*.md, **/*.markdown
  • Check: markdownlint {{ files }}
  • Fix: markdownlint --fix {{ files }}

mdschema

Schema-based Markdown documentation validator

  • Check: mdschema check {{ files }}

rumdl

Markdown linter

  • Glob: **/*.md, **/*.markdown
  • Check (diff): rumdl check --diff {{ files }}
  • Fix: rumdl check --fix {{ files }}

rumdl-format

Markdown formatter

  • Glob: **/*.md, **/*.markdown
  • Check (diff): rumdl fmt --check --diff {{ files }}
  • Fix: rumdl fmt {{ files }}

ryl-markdown

Lint YAML embedded in Markdown (front matter + fenced yaml blocks) with ryl

  • Check (diff): ryl --diff --markdown {{ files }}
  • Fix: ryl --fix --markdown {{ files }}

Nix

alejandra

Alternative Nix formatter

  • Glob: **/*.nix
  • Check: alejandra --check {{ files }}
  • Fix: alejandra {{ files }}

deadnix

Scan Nix files for dead code

  • Glob: **/*.nix
  • Check: deadnix --fail {{ files }}
  • Fix: deadnix --edit {{ files }}

nil

Nix Language server

  • Glob: **/*.nix
  • Check: nil diagnostics --deny-warnings {{ files }}

nix-fmt

Nix formatter

  • Glob: **/*.nix

nixf-diagnose

Nix linter based on libnixf

  • Glob: **/*.nix
  • Check: nixf-diagnose {{ files }}

nixpkgs-format

Nixpkgs formatter

  • Glob: **/*.nix
  • Check: nixpkgs-fmt --check {{ files }}
  • Fix: nixpkgs-fmt {{ files }}

Other Languages

astro

Astro component checker

  • Glob: **/*.astro
  • Check: astro check {{ files }}

clang-format

C/C++ formatter

  • Glob: **/*.c, **/*.h, **/*.cpp, **/*.hpp, **/*.cc, **/*.hh, **/*.cxx, **/*.hxx
  • Check: clang-format --dry-run -Werror {{ files }}
  • Fix: clang-format -i {{ files }}

cmake-format

Source code formatter for cmake listfiles

  • Glob: **/CMakeLists.txt, **/*.cmake
  • Check: cmake-format --check {{ files }}
  • Fix: cmake-format --in-place {{ files }}

cpp-lint

C++ style checker

  • Glob: **/*.c, **/*.h, **/*.cpp, **/*.hpp, **/*.cc, **/*.hh, **/*.cxx, **/*.hxx
  • Check: cpplint {{ files }}

dprint

Pluggable code formatter

  • Check: dprint check --allow-no-files {{ files }}
  • Fix: dprint fmt --allow-no-files {{ files }}

ktlint

Kotlin linter and formatter

  • Glob: **/*.kt
  • Check: ktlint {{ files }}
  • Fix: ktlint -F {{ files }}

swiftlint

Swift style and conventions

  • Glob: **/*.swift
  • Check: swiftlint lint {{ files }}
  • Fix: swiftlint --fix {{ files }}

vacuum

Fast OpenAPI linter

  • Glob: **/*openapi*.yaml, **/*openapi*.yml, **/*openapi*.json, **/*swagger*.yaml, **/*swagger*.yml, **/*swagger*.json
  • Check: vacuum lint {{files}}
  • Fix: vacuum lint --fix {{files}}

PHP

php-cs

PHP coding standards

  • Glob: **/*.php
  • Check: phpcs {{ files }}
  • Fix: phpcbf {{ files }}

Package

aqua-update-checksum

create or update aqua checksums

  • Glob: {aqua,.aqua}.{yml,yaml}, {aqua,.aqua}/**/*.{yml,yaml}, aqua-checksums.json, {aqua,.aqua}/aqua-checksums.json
  • Fix: aqua update-checksum --prune

Pkl

pkl

Pkl configuration language

  • Check: pkl eval {{files}} >/dev/null

pkl-format

Pkl formatter

  • Check (list-files): pkl format --diff-name-only {{ files }}
  • Fix: pkl format --write {{ files }} code=$? if [ $code -eq 11 ]; then exit 0 else exit $code fi

Python

black

Opinionated Python formatter

  • Glob: **/*.py
  • Check (diff): black --check --diff {{ files }}
  • Fix: black {{ files }}

flake8

Python style guide enforcement

  • Glob: **/*.py
  • Check: flake8 {{ files }}

isort

Python import sorter

  • Glob: **/*.py
  • Check: isort --check-only {{ files }}
  • Fix: isort {{ files }}

mypy

Static type checker for Python

  • Glob: **/*.py, **/*.pyi
  • Check: mypy {{ files }}

pylint

Python code analysis

  • Glob: **/*.py
  • Check: pylint {{ files }}

python-check-ast

Validate Python syntax by parsing the AST

  • Glob: **/*.py
  • Check: hk util python-check-ast {{files}}

python-debug-statements

Detect debug statements in Python code

  • Glob: **/*.py
  • Check: hk util python-debug-statements {{files}}

ruff

Fast Python linter

  • Glob: **/*.py, **/*.pyi

ruff-format

Fast Python formatter (part of ruff)

  • Glob: **/*.py, **/*.pyi
  • Check (diff): ruff format --quiet --force-exclude --diff {{ files }}
  • Fix: ruff format --quiet --force-exclude {{ files }}

ty

Fast Python type checker

  • Glob: **/*.py, **/*.pyi
  • Check: ty check {{ files }}

Ruby

brakeman

Security scanner for Rails

  • Check: brakeman -q -w2 {{ files }}

bundle-audit

Dependency security audit

  • Glob: **/Gemfile.lock
  • Check: bundle-audit check {{ files }}
  • Fix: bundle-audit update

erb

ERB template linter

  • Glob: **/*.erb
  • Check: erb -P -x -T - {{ files }} | ruby -c

fasterer

Performance suggestions

  • Check: fasterer {{ files }}

reek

Code smell detector

  • Check: reek {{ files }}

rubocop

Ruby style guide

  • Glob: **/*.rb, **/*.arb, **/*.axlsx, **/*.builder, **/*.gemfile, **/*.gemspec, **/*.jb, **/*.jbuilder, **/*.mspec, **/*.opal, **/*.pluginspec, **/*.podspec, **/*.rabl, **/*.rake, **/*.rbw, **/*.ru, **/*.ruby, **/*.schema, **/*.spec, **/*.thor, **/.irbrc, **/.pryrc, **/.simplecov, **/buildfile, **/Appraisals, **/Berksfile, **/Brewfile, **/Buildfile, **/Capfile, **/Dangerfile, **/Deliverfile, **/Fastfile, **/*Fastfile, **/Gemfile, **/Guardfile, **/Jarfile, **/Mavenfile, **/Podfile, **/Puppetfile, **/Rakefile, **/rakefile, **/Schemafile, **/Snapfile, **/Steepfile, **/Thorfile, **/Vagrantfile
  • Check: rubocop --force-exclusion {{ files }}
  • Fix: rubocop --force-exclusion --autocorrect {{ files }}

rubocop-server

Ruby style guide (using RuboCop's --server mode)

  • Glob: **/*.rb, **/*.arb, **/*.axlsx, **/*.builder, **/*.gemfile, **/*.gemspec, **/*.jb, **/*.jbuilder, **/*.mspec, **/*.opal, **/*.pluginspec, **/*.podspec, **/*.rabl, **/*.rake, **/*.rbw, **/*.ru, **/*.ruby, **/*.schema, **/*.spec, **/*.thor, **/.irbrc, **/.pryrc, **/.simplecov, **/buildfile, **/Appraisals, **/Berksfile, **/Brewfile, **/Buildfile, **/Capfile, **/Dangerfile, **/Deliverfile, **/Fastfile, **/*Fastfile, **/Gemfile, **/Guardfile, **/Jarfile, **/Mavenfile, **/Podfile, **/Puppetfile, **/Rakefile, **/rakefile, **/Schemafile, **/Snapfile, **/Steepfile, **/Thorfile, **/Vagrantfile
  • Check: rubocop --server --force-exclusion {{ files }}
  • Fix: rubocop --server --force-exclusion --autocorrect {{ files }}

sorbet

Type checker for Ruby

  • Check: srb tc {{ files }}

standard-rb

Ruby Standard Style

  • Check: standardrb {{ files }}
  • Fix: standardrb --fix {{ files }}

Rust

cargo-check

Fast Rust type checking

  • Glob: **/*.rs
  • Check: cargo +nightly check -Zwarnings --quiet
  • Fix: cargo fix --allow-dirty --allow-staged --quiet

cargo-clippy

Rust linter

  • Glob: **/*.rs
  • Check: cargo clippy --manifest-path {{workspace_indicator}} --quiet
  • Fix: cargo clippy --manifest-path {{workspace_indicator}} --fix --allow-dirty --allow-staged --quiet

cargo-deny

Rust dependency linter

  • Glob: **/Cargo.toml, **/Cargo.lock, **/deny.toml, **/.deny.toml, **/deny.exceptions.toml, **/.deny.exceptions.toml
  • Check: cd {{workspace}} && cargo-deny --locked --workspace check

cargo-fmt

Rust code formatter

  • Glob: **/*.rs
  • Check: cargo fmt --check --manifest-path {{workspace_indicator}}
  • Fix: cargo fmt --manifest-path {{workspace_indicator}}

rustfmt

Rust code formatter (standalone)

  • Glob: **/*.rs

Secrets

betterleaks

A Better Secrets Scanner built for configurability and speed

  • Check: betterleaks dir --redact --verbose --no-banner {{ files }}

gitleaks

Secret scanner for Git repositories

  • Check: gitleaks dir --redact --verbose --no-banner {{ files }}

Shell

shellcheck

Shell script analyzer

shellharden

The corrective bash syntax highlighter

  • Check: shellharden --check {{ files }}
  • Fix: shellharden --replace {{ files }}

shfmt

Shell formatter

  • Check (diff): shfmt -d --apply-ignore {{ files }}
  • Fix: shfmt -w --apply-ignore {{ files }}

Special Purpose

byte-order-marker

Detect UTF-8 BOM

  • Check (diff): hk util check-byte-order-marker --diff {{files}}
  • Fix: hk util fix-byte-order-marker {{files}}

check-added-large-files

Prevent committing large files

  • Glob: **/*
  • Check: hk util check-added-large-files {{files}}

check-case-conflict

Detect case-insensitive filename conflicts

  • Glob: **/*
  • Check: hk util check-case-conflict {{files}}

check-conventional-commit

Verify commit message matches conventional commits formatting

  • Check: hk util check-conventional-commit {{commit_msg_file}}

check-executables-have-shebangs

Verify executable files have shebang lines

  • Check: hk util check-executables-have-shebangs {{files}}

check-merge-conflict

Detect merge conflict markers

  • Check: hk util check-merge-conflict --assume-in-merge {{files}}

Detect broken symlinks

  • Glob: **/*
  • Check: hk util check-symlinks {{files}}

cocogitto-commit-msg

Conventional commits linter

  • Check: cog --quiet verify --file {{commit_msg_file}}

detect-private-key

Detect accidentally committed private keys

  • Check: hk util detect-private-key {{files}}

fix-smart-quotes

Replace smart quotes with regular quotes

  • Check (diff): hk util fix-smart-quotes --diff {{files}}
  • Fix: hk util fix-smart-quotes {{files}}

harper

Grammar checker for prose and documentation

  • Check: harper-cli lint {{ files }}

harper-commit-message

Grammar checker for commit message

  • Check: harper-cli lint {{commit_msg_file}}

hk-test

Run step-defined hk's tests

  • Glob: hk.pkl, .config/hk.pkl
  • Check: hk test --quiet

just-format

Justfile formatter

  • Glob: **/justfile, **/*.just
  • Fix: xargs -d' ' -I {} -- just --fmt --unstable --justfile {}

lychee

Fast, async, stream-based link checker

  • Check: lychee --no-progress {{ files }}

mixed-line-ending

Detect and fix mixed line endings

  • Check (diff): hk util mixed-line-ending --diff {{files}}
  • Fix: hk util mixed-line-ending --fix {{files}}

newlines

Ensure files end with newline

  • Check (diff): hk util end-of-file-fixer --diff {{files}}
  • Fix: hk util end-of-file-fixer --fix {{files}}

no-commit-to-branch

Prevent direct commits to protected branches

  • Check: hk util no-commit-to-branch

textlint

Pluggable natural language linter

  • Glob: **/*.md, **/*.markdown, **/*.txt
  • Check: textlint {{ files }}
  • Fix: textlint --fix {{ files }}

trailing-whitespace

Detect and remove trailing whitespace

  • Check (diff): hk util trailing-whitespace --diff {{files}}
  • Fix: hk util trailing-whitespace --fix {{files}}

typos

Source code spell checker

  • Check (diff): output=$(typos --force-exclude --diff {{files}}) [ -z "$output" ] && exit 0 printf "%s" "$output" exit 1
  • Fix: typos --force-exclude --write-changes {{ files }}

vale

Prose linter for markup and code comments

  • Check: vale sync && vale {{ files }}

Uncategorized

check-byte-order-marker

  • Check (diff): hk util check-byte-order-marker --diff {{files}}
  • Fix: hk util fix-byte-order-marker {{files}}

fix-byte-order-marker

  • Check (diff): hk util check-byte-order-marker --diff {{files}}
  • Fix: hk util fix-byte-order-marker {{files}}

YAML

ryl

Re-implementation of yamllint in Rust

  • Check (diff): ryl --diff {{ files }}
  • Fix: ryl --fix {{ files }}

Customizing Builtins

Override Properties

pkl
["prettier"] = (Builtins.prettier) {
  // Override glob patterns
  glob = List("src/**/*.js", "src/**/*.ts")

  // Disable batch processing
  batch = false

  // Add environment variables
  env {
    ["PRETTIER_CONFIG"] = ".prettierrc.json"
  }
}

Add Dependencies

pkl
["eslint"] = (Builtins.eslint) {
  // Run after prettier
  depends = "prettier"
}

Workspace-Specific Configuration

pkl
["cargo_clippy"] = (Builtins.cargo_clippy) {
  // Only run in directories with Cargo.toml
  workspace_indicator = "Cargo.toml"

  // Custom command using workspace
  check = "cargo clippy --manifest-path {{workspace}}/Cargo.toml"
}

Profile-Based Configuration

pkl
["mypy"] = (Builtins.mypy) {
  // Only run with "python" profile
  profiles = List("python")
}

Creating Custom Steps

If a builtin doesn't exist for your tool:

pkl
["custom-tool"] {
  glob = List("*.custom")
  check = "custom-tool --check {{files}}"
  fix = "custom-tool --fix {{files}}"
  batch = true  // Enable parallel processing
}

See Also

MIT LicenseCopyright © 2026jdx.dev