lefthook

lefthook is a skill for Claude Code, Codex from fmind/dot. It costs 44 tokens per session (916 once invoked), scanned A, original, MIT.

A setup guide for Lefthook, a tool that runs checks automatically at Git events such as commits and pushes. It connects those hooks to shared project tasks.

In plain words
What is it for?
Use it to configure formatting, secret scanning, and tests in pre-commit and pre-push hooks.
Why use it?
It keeps local checks and CI—the automated checks on a server—using the same commands before code is committed or pushed.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/fmind/dot/lefthook
Any agent
npx skills add fmind/dot --skill lefthook
Clone the repo
git clone --depth 1 https://github.com/fmind/dot

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for lefthook

README.md
[![agentmods](https://agentmods.dev/badge/skills/fmind/dot/lefthook.svg)](https://agentmods.dev/skills/fmind/dot/lefthook)
Your own site
<a href="https://agentmods.dev/skills/fmind/dot/lefthook"><img src="https://agentmods.dev/badge/skills/fmind/dot/lefthook.svg" alt="Measured on agentmods" height="20"></a>
Per session 44 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 916 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00044 $0.00916
Opus 5 $0.00022 $0.00458
Sonnet 5 $0.00009 $0.00183
Haiku 4.5 $0.00004 $0.00092

Measured yesterday against content hash e50cf13d7154, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

lefthook scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/lefthook/SKILL.md · 69 lines

How it starts

The opening of the file, as written. The whole thing — 69 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Lefthook

Thin git hooks that delegate every command to a mise run task so hooks and CI run identical checks; lefthook decides when, mise owns what.

Workflow

  1. Install: pin lefthook via mise or the stack's dev dependencies (go-stack, python-stack, typescript-stack).
  2. Configure: create lefthook.yml at the repository root from the template below; reference files live in go-stack and python-stack.
  3. Activate: lefthook install, wired into mise run install.

Template

output: [summary, failure, execution_out] # quiet commits: no version banner, no successful-step noise
pre-commit:
  parallel: false
  commands:
    format:dprint:
      glob: "*.{json,md,toml,yaml,yml}"
      priority: 10
      run: mise run format:dprint {staged_files}
      stage_fixed: true
    format:<lang>: # one per language: format:go / format:python / format:templ ...
      glob: "*.<ext>"
      priority: 10
      run: mise run format:<lang> {staged_files}
      stage_fixed: true
    check:leaks: # staged secret scan: history-mode gitleaks in `check` cannot see the incoming commit
      priority: 20
      run: mise run check:leaks --staged
    check:
      priority: 30
      run: mise run check
pre-push:
  commands:
    test:
      run: mise run test

Principles

  • pre-commit (fast): format staged files, then the static checks and the staged secret scan.
  • pre-push (slower): the test suite.
  • post-commit (optional): rebuild and redeploy a binary built from the repo's own sources, guarded to commits that touch a build input; git ignores its exit status, so it never blocks a commit.
  • Delegate, don't duplicate: every command is mise run <task> and its name mirrors the task; never inline tool commands.
  • Staged formatters, whole-tree checks: formatters take {staged_files} and restage fixes with stage_fixed: true; check and test take no files.

Read the full file on GitHub · 69 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 69 lines · 44 tokens per session scan A e50cf13d7154

Subscribe to this mod's changes

lefthook is a skill published in the GitHub repository fmind/dot (4 stars, last pushed today), licensed MIT. It adds 44 tokens to every session and 916 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.