← ClaudeAtlas

pre-commitlisted

pre-commit as the local gate — config at .config/pre-commit-config.yaml, hooks that call mise tasks so the same command runs locally and in CI, revs pinned and updated deliberately, and `files:` scoping so a hook fires only for what it validates. Auto-applies when editing a pre-commit config.
virajp/ai-plugins · ★ 1 · Code & Development · score 78
Install: claude install-skill virajp/ai-plugins
# pre-commit — the local gate pre-commit runs the quality gates before a commit is made, so a broken commit is never created rather than being caught later. The config lives at **`.config/pre-commit-config.yaml`**, with the rest of the repo's tooling config, which means every invocation carries `--config`: ```sh mise run setup:precommit # autoupdate + install the hooks mise run code:precommit # run against changed files mise run code:precommit --all # run against everything pre-commit run --config .config/pre-commit-config.yaml --all-files ``` `setup:precommit` also clears any `core.hooksPath` the repo has set locally — a leftover hooks path silently wins over pre-commit's installed hook, and the symptom is a gate that reports nothing rather than one that errors. ## Local hooks call mise tasks A repo-local hook should invoke the task, not the tool: ```yaml - repo: local hooks: - id: code-format name: format entry: mise x -- mise run code:format language: system pass_filenames: false files: ^(src/|packages/) stages: [ pre-commit ] ``` `entry` names the **mise task** so the same command runs locally, in the hook, and in CI — one definition, three callers. A hook that inlines the tool invocation is a second copy that drifts from the task, and the drift shows up as CI failing what pre-commit passed. `mise x --` is what makes the hook work in a bare shell: pre-commit does not run under the developer's activated en