Use this skill when users need help with git pre-commit hooks, code quality guardrails, or prek configuration. **Trigger this skill when:** - User mentions "pre-commit", "commit hooks", "prek", or "guardrails" - Project has no .pre-commit-config.yaml and user is working on code - User encounters formatting/linting issues that hooks could prevent - User asks about code quality automation - User creates a new project or initializes a git repository - User has existing hooks (husky, pre-commit, lefthook) and asks about alternatives
View on GitHubclaude-code/skills/guardrail-commit-hooks-skill/SKILL.md
February 1, 2026
Select agents to install to:
npx add-skill https://github.com/snowmead/guardrail-agent-skills/blob/main/claude-code/skills/guardrail-commit-hooks-skill/SKILL.md -a claude-code --skill guardrail-commit-hooks-skillInstallation paths:
.claude/skills/guardrail-commit-hooks-skill/# Guardrail Commit Hooks Skill This skill helps you create and manage prek pre-commit hooks for code quality guardrails. ## Command Dispatch This skill handles three operations based on the `args` parameter: | Args Pattern | Operation | Description | |--------------|-----------|-------------| | `analyze ...` | Analyze | Analyze project and recommend hooks | | `setup ...` | Setup | Full installation wizard | | `update ...` | Update | Update hooks to latest versions | If no args are provided, default to the **analyze** operation. --- ## What is prek? prek is a faster, dependency-free reimplementation of the pre-commit framework written in Rust. It's a drop-in replacement that works with existing `.pre-commit-config.yaml` files. **Key benefits:** - 4-10x faster than pre-commit - No Python runtime required (single binary) - 50% less disk usage - Compatible with existing pre-commit configurations ## Always Fetch Current Documentation **IMPORTANT**: Do not use hardcoded version numbers. Always fetch the latest documentation to get current hook versions. ### Documentation URLs to Fetch Before creating or updating configurations, use WebFetch on these URLs: 1. **Quickstart & Installation**: `https://prek.j178.dev/quickstart/` 2. **Built-in Hooks Reference**: `https://prek.j178.dev/builtin/` 3. **Configuration Format**: `https://prek.j178.dev/config/` 4. **Workspace Mode (monorepos)**: `https://prek.j178.dev/workspace/` ### For Latest Hook Versions Fetch GitHub releases to get current versions: - **Ruff** (Python): `https://api.github.com/repos/astral-sh/ruff-pre-commit/releases/latest` - **Biome** (JS/TS): `https://api.github.com/repos/biomejs/pre-commit/releases/latest` ## Installation Commands ```bash # Install prek (recommended via uv) uv tool install prek # Alternative: via pip pip install prek # Alternative: shell script curl -LsSf https://astral.sh/prek/install.sh | sh ``` --- ## Operation: analyze - Analyze and Recommend Hooks Analyze the cur