Skip to content

Commit ca989c2

Browse files
authored
Merge pull request #131 from Miyamura80/feat/replace-pre-commit-with-prek-760911467584852843
Replace pre-commit with prek and add Claude skill
2 parents 8ad16a3 + b2a863b commit ca989c2

3 files changed

Lines changed: 61 additions & 49 deletions

File tree

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
name: prek-precommit-hook
3+
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.
4+
---
5+
# Prek Pre-commit Hook Skill
6+
7+
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.**
8+
9+
## Commands
10+
11+
Use the following commands to interact with `prek`:
12+
13+
- `prek run`: Runs the configured hooks on the staged files.
14+
- `prek run --all-files`: Runs the configured hooks on all files in the repository.
15+
- `prek install`: Installs the git hooks into `.git/hooks`.
16+
- `prek uninstall`: Uninstalls the git hooks.
17+
- `prek list`: Lists the configured hooks.
18+
19+
## Configuration
20+
21+
The configuration is stored in `prek.toml` in the root of the repository.
22+
23+
Example `prek.toml`:
24+
```toml
25+
[[repos]]
26+
repo = "https://github.com/pre-commit/pre-commit-hooks"
27+
rev = "v4.6.0"
28+
hooks = [
29+
{ id = "check-added-large-files" },
30+
]
31+
32+
[[repos]]
33+
repo = "local"
34+
hooks = [
35+
{ id = "ruff-check", name = "Run ruff linter", entry = "uv run ruff check", language = "system", pass_filenames = false, always_run = true },
36+
]
37+
```
38+
39+
## Workflow
40+
41+
1. **Before Committing**: `prek` hooks will run automatically if installed via `prek install`.
42+
2. **Manual Check**: You can manually run checks using `prek run --all-files`.
43+
3. **CI**: In CI environments, you can use `prek run --all-files` to enforce checks.

.pre-commit-config.yaml

Lines changed: 0 additions & 49 deletions
This file was deleted.

prek.toml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[[repos]]
2+
repo = "https://github.com/pre-commit/pre-commit-hooks"
3+
rev = "v4.6.0"
4+
hooks = [
5+
{ id = "check-added-large-files" },
6+
]
7+
8+
[[repos]]
9+
repo = "local"
10+
hooks = [
11+
{ id = "lint-links", name = "Lint markdown links", entry = "make lint_links", language = "system", pass_filenames = false, always_run = true },
12+
{ id = "make-fmt", name = "Run formatter (make fmt)", entry = "make fmt", language = "system", pass_filenames = false, always_run = true },
13+
{ id = "ruff-check", name = "Run ruff linter", entry = "uv run ruff check", language = "system", pass_filenames = false, always_run = true },
14+
{ id = "ruff-complexity", name = "Check cyclomatic complexity", entry = "uv run ruff check --select C901", language = "system", pass_filenames = false, always_run = true },
15+
{ id = "ruff-tech-debt", name = "Check TODO/FIXME markers", entry = "uv run ruff check --select FIX", language = "system", pass_filenames = false, always_run = true },
16+
{ 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 },
17+
{ 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 },
18+
]

0 commit comments

Comments
 (0)