ConfigsJul 2, 2026·3 min read

Prek — Fast Git Hooks Manager Written in Rust

Prek is a fast git hooks manager written in Rust, designed as a drop-in alternative to pre-commit. It runs hook scripts in parallel with minimal configuration overhead.

Agent ready

Ready-to-run agent install

This asset can be installed after the agent chooses its runtime, checks the plan, and runs the matching command.

Native · 98/100Policy: allow
Agent surface
Any MCP/CLI agent
Kind
Skill
Install
Single
Trust
Trust: Established
Entrypoint
Prek Overview
Direct install command
npx -y tokrepo@latest install fc0ee751-7615-11f1-9bc6-00163e2b0d79 --target codex

Run after dry-run confirms the install plan.

Introduction

Prek is an open-source git hooks manager written in Rust by j178. It serves as a faster alternative to the popular pre-commit framework, focusing on speed and simplicity. Prek is designed to be a drop-in replacement, reading existing pre-commit configuration files while executing hooks significantly faster through parallel execution and a compiled runtime.

What Prek Does

  • Manages git hook scripts across pre-commit, commit-msg, post-commit, and other git hook stages
  • Runs hook checks in parallel by default, reducing total hook execution time
  • Reads .pre-commit-config.yaml files for compatibility with existing pre-commit setups
  • Installs itself as the git hook handler with a single command
  • Caches hook environments and tool installations to avoid repeated setup on each commit

Architecture Overview

Prek is a single compiled Rust binary with no runtime dependencies. When triggered by a git hook event, it reads the repository's configuration file, resolves which hooks apply to the changed files, and executes them in parallel across available CPU cores. Hook repositories are cloned and cached locally. The Rust implementation avoids the Python startup overhead that pre-commit incurs, resulting in noticeably faster hook execution, especially in large repositories with many hooks.

Self-Hosting & Configuration

  • Install via cargo install prek, or download a prebuilt binary from GitHub releases
  • Run prek install in a repository to set up the git hook integration
  • Configure hooks in .prek.toml or use an existing .pre-commit-config.yaml
  • Set environment variables like PREK_CACHE to control where hook tools are cached
  • Supports running on Linux, macOS, and Windows

Key Features

  • Parallel hook execution across all available cores by default
  • Compatible with the pre-commit config format for easy migration
  • Single static binary with no Python or Node.js dependency
  • Fast startup time due to compiled Rust implementation
  • Built-in support for common hook languages including Python, Node, Rust, and Go

Comparison with Similar Tools

  • pre-commit — the established Python-based hooks framework; widely adopted but slower due to Python startup and sequential default execution
  • Lefthook — Go-based git hooks manager with parallel execution; similar speed goals but uses its own config format
  • Husky — JavaScript-focused git hooks tool tied to the npm ecosystem; less suitable for polyglot repositories
  • overcommit — Ruby-based hooks manager with built-in hook definitions; requires a Ruby runtime

FAQ

Q: Can I use my existing pre-commit config with Prek? A: Yes. Prek can read .pre-commit-config.yaml files directly, making migration straightforward.

Q: How much faster is Prek compared to pre-commit? A: Speed improvements depend on the number of hooks and repository size. The main gains come from parallel execution and eliminating Python startup overhead. Benchmarks in the project repository show significant reductions in hook run time.

Q: Does Prek support custom local hooks? A: Yes. You can define local hooks in the configuration file that run arbitrary commands without needing an external hook repository.

Q: What platforms does Prek support? A: Prek runs on Linux, macOS, and Windows. Prebuilt binaries are available for all three platforms.

Sources

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets