Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .claude/skills/prek-precommit-hook/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
name: prek-precommit-hook
description: Instructions for managing and running git hooks using `prek`. Use this skill for any mention of pre-commit hooks, as `prek` overrides pre-commit hooks.
---
# Prek Pre-commit Hook Skill

This skill provides instructions for using `prek`, a fast, native pre-commit runner that replaces the traditional Python-based `pre-commit`. **`prek` should be used for any mention of pre-commit hooks and overrides traditional pre-commit hooks.**

## Commands

Use the following commands to interact with `prek`:

- `prek run`: Runs the configured hooks on the staged files.
- `prek run --all-files`: Runs the configured hooks on all files in the repository.
- `prek install`: Installs the git hooks into `.git/hooks`.
- `prek uninstall`: Uninstalls the git hooks.
- `prek list`: Lists the configured hooks.

## Configuration

The configuration is stored in `prek.toml` in the root of the repository.

Example `prek.toml`:
```toml
[[repos]]
repo = "https://github.com/pre-commit/pre-commit-hooks"
rev = "v4.6.0"
hooks = [
{ id = "check-added-large-files" },
]

[[repos]]
repo = "local"
hooks = [
{ id = "ruff-check", name = "Run ruff linter", entry = "uv run ruff check", language = "system", pass_filenames = false, always_run = true },
]
```

## Workflow

1. **Before Committing**: `prek` hooks will run automatically if installed via `prek install`.
2. **Manual Check**: You can manually run checks using `prek run --all-files`.
3. **CI**: In CI environments, you can use `prek run --all-files` to enforce checks.
49 changes: 0 additions & 49 deletions .pre-commit-config.yaml

This file was deleted.

18 changes: 18 additions & 0 deletions prek.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[[repos]]
repo = "https://github.com/pre-commit/pre-commit-hooks"
rev = "v4.6.0"
hooks = [
{ id = "check-added-large-files" },
]

[[repos]]
repo = "local"
hooks = [
{ id = "lint-links", name = "Lint markdown links", entry = "make lint_links", language = "system", pass_filenames = false, always_run = true },
{ id = "make-fmt", name = "Run formatter (make fmt)", entry = "make fmt", language = "system", pass_filenames = false, always_run = true },
{ id = "ruff-check", name = "Run ruff linter", entry = "uv run ruff check", language = "system", pass_filenames = false, always_run = true },
{ id = "ruff-complexity", name = "Check cyclomatic complexity", entry = "uv run ruff check --select C901", language = "system", pass_filenames = false, always_run = true },
{ id = "ruff-tech-debt", name = "Check TODO/FIXME markers", entry = "uv run ruff check --select FIX", language = "system", pass_filenames = false, always_run = true },
{ id = "pylint-duplicate-code", name = "Detect duplicate code", entry = "uv run pylint --disable=all --enable=R0801 src common utils", language = "system", pass_filenames = false, always_run = true },
{ id = "ai-writing-check", name = "AI writing check", entry = "uv run python scripts/check_ai_writing.py", language = "system", pass_filenames = false, always_run = true },
]