docs(pc-skills): trim generic pre-commit boilerplate (finding 38)
Collapse the per-language hook tables in pc-author's hooks-by-language.md into one shared-repo table plus an "other repos" table, dropping the repeated repo/rev/rationale text that just restated what each hook does. 128 -> 92 lines. Kept both "Unverified — not in research corpus" flags and the rev-freshness caveat. Remove the generic SSH/proxy CI failure sections, the shellcheck SC-code listing, and compress the generic validate-config schema-error bullets in pc-run's failure-patterns.md, all of which just restated pre-commit.com's own docs. 133 -> 109 lines. Kept the rtk-prefixed re-stage/recommit fix (ADR-0023), the "do NOT reach for `pre-commit install -f`" warning, and both gitleaks/shellcheck not-sourced-from-corpus notes. Combined cut: 60 lines. Flat mirrors regenerated via scripts/sync-plugin-content.sh and verified byte-identical (--check exits 0); no plugin.json drift. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YR2CjVumUbEGWcMikcoXBD
This commit is contained in:
@@ -16,70 +16,34 @@ files but do NOT re-stage them, so the commit is still blocked and the user has
|
||||
again. Say so when proposing one — otherwise the first blocked commit reads as the hook being
|
||||
broken.
|
||||
|
||||
## Universal (recommend for every repo)
|
||||
## `pre-commit/pre-commit-hooks` (rev `v6.0.0`)
|
||||
|
||||
| Hook ID | Repo | Rev | Rationale |
|
||||
|---------|------|-----|-----------|
|
||||
| `end-of-file-fixer` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Ensures files end with a newline — prevents spurious diffs |
|
||||
| `trailing-whitespace` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Strips trailing whitespace — prevents invisible diff noise |
|
||||
| `check-merge-conflict` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Catches unresolved merge markers before commit |
|
||||
| `detect-private-key` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Blocks PEM private key material |
|
||||
| `check-added-large-files` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Blocks accidentally committing large binary files |
|
||||
| `check-case-conflict` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Catches filenames that would collide on case-insensitive filesystems |
|
||||
| `mixed-line-ending` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Normalizes line endings |
|
||||
| `no-commit-to-branch` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Blocks direct commits to protected branches — defaults to blocking `main`+`master` with no args; add `args: [--branch, <name>]` only to protect additional branch names |
|
||||
| Hook ID | Language / Context |
|
||||
|---------|---------------------|
|
||||
| `end-of-file-fixer` | Universal |
|
||||
| `trailing-whitespace` | Universal |
|
||||
| `check-merge-conflict` | Universal |
|
||||
| `detect-private-key` | Universal |
|
||||
| `check-added-large-files` | Universal |
|
||||
| `check-case-conflict` | Universal |
|
||||
| `mixed-line-ending` | Universal |
|
||||
| `no-commit-to-branch` | Universal — defaults to blocking `main`+`master` with no args; add `args: [--branch, <name>]` only to protect additional branch names |
|
||||
| `check-ast` | Python (`.py`) |
|
||||
| `check-builtin-literals` | Python (`.py`) |
|
||||
| `check-json` | JSON (`.json`) |
|
||||
| `pretty-format-json` | JSON (`.json`) |
|
||||
| `check-yaml` | YAML (`.yaml`, `.yml`) — for Kubernetes/Helm with custom tags add `args: ['--unsafe']` and `exclude: ^helm/templates/` |
|
||||
| `check-toml` | TOML (`.toml`) |
|
||||
|
||||
## Shell (`.sh`)
|
||||
Full repo URL: `https://github.com/pre-commit/pre-commit-hooks`. For Python formatting, check if `black`, `ruff`, or `isort` is already configured in `pyproject.toml` before recommending them.
|
||||
|
||||
| Hook ID | Repo | Rev | Rationale |
|
||||
|---------|------|-----|-----------|
|
||||
| `shellcheck` | `https://github.com/jumanjihouse/pre-commit-hooks` | `3.0.0` | **Unverified — not in research corpus, verify upstream before use.** Static analysis for shell scripts; catches common errors |
|
||||
## Other repos
|
||||
|
||||
Recommended args: `args: [--severity=warning]`
|
||||
|
||||
## Python (`.py`)
|
||||
|
||||
| Hook ID | Repo | Rev | Rationale |
|
||||
|---------|------|-----|-----------|
|
||||
| `check-ast` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Validates Python files parse as valid AST |
|
||||
| `check-builtin-literals` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Enforces literal syntax for `dict()`, `list()` |
|
||||
|
||||
For formatting: check if `black`, `ruff`, or `isort` is already configured in `pyproject.toml` before recommending them.
|
||||
|
||||
## JSON (`.json`)
|
||||
|
||||
| Hook ID | Repo | Rev | Rationale |
|
||||
|---------|------|-----|-----------|
|
||||
| `check-json` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Validates JSON parses correctly |
|
||||
| `pretty-format-json` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Auto-formats JSON (fixer — warns user to re-stage after commit) |
|
||||
|
||||
## YAML (`.yaml`, `.yml`)
|
||||
|
||||
| Hook ID | Repo | Rev | Rationale |
|
||||
|---------|------|-----|-----------|
|
||||
| `check-yaml` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Validates YAML parses correctly |
|
||||
|
||||
For Kubernetes/Helm YAML with custom tags, add `args: ['--unsafe']` and `exclude: ^helm/templates/`.
|
||||
|
||||
## TOML (`.toml`)
|
||||
|
||||
| Hook ID | Repo | Rev | Rationale |
|
||||
|---------|------|-----|-----------|
|
||||
| `check-toml` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Validates TOML parses correctly |
|
||||
|
||||
## Secrets / security
|
||||
|
||||
| Hook ID | Repo | Rev | Rationale |
|
||||
|---------|------|-----|-----------|
|
||||
| `gitleaks` | `https://github.com/gitleaks/gitleaks` | `v8.30.1` | **Unverified — not in research corpus, verify upstream before use.** Scans for secrets and high-entropy strings |
|
||||
|
||||
## Commit message
|
||||
|
||||
| Hook ID | Repo | Rev | Stage | Rationale |
|
||||
|---------|------|-----|-------|-----------|
|
||||
| `conventional-pre-commit` | `https://github.com/compilerla/conventional-pre-commit` | `v2.4.0` | `commit-msg` | Enforces Conventional Commits format |
|
||||
|
||||
When adding commit-msg hooks, also add `default_install_hook_types: [pre-commit, commit-msg]` to the top-level config if not already present.
|
||||
| Hook ID | Repo | Rev | Notes |
|
||||
|---------|------|-----|-------|
|
||||
| `shellcheck` | `https://github.com/jumanjihouse/pre-commit-hooks` | `3.0.0` | **Unverified — not in research corpus, verify upstream before use.** Recommended args: `args: [--severity=warning]` |
|
||||
| `gitleaks` | `https://github.com/gitleaks/gitleaks` | `v8.30.1` | **Unverified — not in research corpus, verify upstream before use.** |
|
||||
| `conventional-pre-commit` | `https://github.com/compilerla/conventional-pre-commit` | `v2.4.0` | Stage `commit-msg`; also add `default_install_hook_types: [pre-commit, commit-msg]` to the top-level config if not already present |
|
||||
|
||||
## Meta-validation (add last, after all other repos)
|
||||
|
||||
@@ -125,4 +89,4 @@ Language choices for local hooks:
|
||||
|
||||
## Rev pin freshness
|
||||
|
||||
The revs above were last verified current at time of writing (matched against the plugin's own research corpus in `docs/research/docs/pre-commit/`; rows marked "Unverified" have no such backing and must be checked against upstream before use). Since the "Rev staleness" check in `references/modify-config.md` treats this table as ground truth, a pin that goes stale here produces false-positive staleness warnings for users who already have a newer, correct rev. Re-verify these pins periodically (e.g. against each repo's latest release tag). When in doubt, treat `pre-commit autoupdate`'s own output as the authoritative staleness signal, not a mismatch against this table.
|
||||
The revs above were last verified current at time of writing (matched against the plugin's own research corpus in `docs/research/docs/pre-commit/`; rows marked "Unverified" have no such backing and must be checked against upstream before use). Since the "Rev staleness" check in `references/modify-config.md` treats these tables as ground truth, a pin that goes stale here produces false-positive staleness warnings for users who already have a newer, correct rev. Re-verify these pins periodically (e.g. against each repo's latest release tag). When in doubt, treat `pre-commit autoupdate`'s own output as the authoritative staleness signal, not a mismatch against these tables.
|
||||
|
||||
@@ -36,10 +36,7 @@ Suggestions:
|
||||
|
||||
Cause: shellcheck found a shell script issue. The output includes the file path, line number, and SC-code.
|
||||
|
||||
Fix: Look up the SC-code on shellcheck.net or pass `--explain SCxxxx` to shellcheck for a detailed explanation. The most common fixes:
|
||||
- SC2086 (unquoted variable): wrap in double quotes.
|
||||
- SC2046 (unquoted command substitution): wrap in double quotes.
|
||||
- SC2181 (check exit code of `$?`): use `if command; then` directly.
|
||||
Fix: Look up the SC-code on shellcheck.net or pass `--explain SCxxxx` to shellcheck for a detailed explanation.
|
||||
|
||||
## `check-hooks-apply` fails
|
||||
|
||||
@@ -53,23 +50,6 @@ Cause: An `exclude` pattern matches no files.
|
||||
|
||||
Fix: Remove or fix the pattern.
|
||||
|
||||
## SSH cloning fails in CI
|
||||
|
||||
Cause: The CI environment lacks SSH credentials to clone hook repos over SSH.
|
||||
|
||||
Fix: Export `SSH_AUTH_SOCK` in the CI environment, or switch hook repo URLs to HTTPS.
|
||||
|
||||
## HTTP proxy needed
|
||||
|
||||
Cause: The CI/sandbox network requires a proxy to reach hook repos.
|
||||
|
||||
Fix:
|
||||
```bash
|
||||
export http_proxy=http://proxy.example.com:3128
|
||||
export https_proxy=http://proxy.example.com:3128
|
||||
export no_proxy=localhost,127.0.0.1
|
||||
```
|
||||
|
||||
## `rev` is a branch name — `autoupdate` broke it
|
||||
|
||||
Cause: Branch refs are mutable and drift over time; pre-commit resolves them once at install time, so pinning to a branch name (instead of a tag or commit SHA) leads to silent version drift.
|
||||
@@ -126,8 +106,4 @@ Or add `default_install_hook_types` to `.pre-commit-config.yaml` and re-run `pre
|
||||
|
||||
## `validate-config` schema error
|
||||
|
||||
Common causes:
|
||||
- Missing `id` under a hook block
|
||||
- Missing `rev` under a non-local repo block
|
||||
- `repo: local` hook missing `language` or `entry`
|
||||
- Indentation error (valid YAML but invalid pre-commit schema)
|
||||
Common causes: missing `id` under a hook block, missing `rev` under a non-local repo block, a `repo: local` hook missing `language` or `entry`, or an indentation error (valid YAML but invalid pre-commit schema).
|
||||
|
||||
@@ -16,70 +16,34 @@ files but do NOT re-stage them, so the commit is still blocked and the user has
|
||||
again. Say so when proposing one — otherwise the first blocked commit reads as the hook being
|
||||
broken.
|
||||
|
||||
## Universal (recommend for every repo)
|
||||
## `pre-commit/pre-commit-hooks` (rev `v6.0.0`)
|
||||
|
||||
| Hook ID | Repo | Rev | Rationale |
|
||||
|---------|------|-----|-----------|
|
||||
| `end-of-file-fixer` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Ensures files end with a newline — prevents spurious diffs |
|
||||
| `trailing-whitespace` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Strips trailing whitespace — prevents invisible diff noise |
|
||||
| `check-merge-conflict` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Catches unresolved merge markers before commit |
|
||||
| `detect-private-key` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Blocks PEM private key material |
|
||||
| `check-added-large-files` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Blocks accidentally committing large binary files |
|
||||
| `check-case-conflict` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Catches filenames that would collide on case-insensitive filesystems |
|
||||
| `mixed-line-ending` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Normalizes line endings |
|
||||
| `no-commit-to-branch` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Blocks direct commits to protected branches — defaults to blocking `main`+`master` with no args; add `args: [--branch, <name>]` only to protect additional branch names |
|
||||
| Hook ID | Language / Context |
|
||||
|---------|---------------------|
|
||||
| `end-of-file-fixer` | Universal |
|
||||
| `trailing-whitespace` | Universal |
|
||||
| `check-merge-conflict` | Universal |
|
||||
| `detect-private-key` | Universal |
|
||||
| `check-added-large-files` | Universal |
|
||||
| `check-case-conflict` | Universal |
|
||||
| `mixed-line-ending` | Universal |
|
||||
| `no-commit-to-branch` | Universal — defaults to blocking `main`+`master` with no args; add `args: [--branch, <name>]` only to protect additional branch names |
|
||||
| `check-ast` | Python (`.py`) |
|
||||
| `check-builtin-literals` | Python (`.py`) |
|
||||
| `check-json` | JSON (`.json`) |
|
||||
| `pretty-format-json` | JSON (`.json`) |
|
||||
| `check-yaml` | YAML (`.yaml`, `.yml`) — for Kubernetes/Helm with custom tags add `args: ['--unsafe']` and `exclude: ^helm/templates/` |
|
||||
| `check-toml` | TOML (`.toml`) |
|
||||
|
||||
## Shell (`.sh`)
|
||||
Full repo URL: `https://github.com/pre-commit/pre-commit-hooks`. For Python formatting, check if `black`, `ruff`, or `isort` is already configured in `pyproject.toml` before recommending them.
|
||||
|
||||
| Hook ID | Repo | Rev | Rationale |
|
||||
|---------|------|-----|-----------|
|
||||
| `shellcheck` | `https://github.com/jumanjihouse/pre-commit-hooks` | `3.0.0` | **Unverified — not in research corpus, verify upstream before use.** Static analysis for shell scripts; catches common errors |
|
||||
## Other repos
|
||||
|
||||
Recommended args: `args: [--severity=warning]`
|
||||
|
||||
## Python (`.py`)
|
||||
|
||||
| Hook ID | Repo | Rev | Rationale |
|
||||
|---------|------|-----|-----------|
|
||||
| `check-ast` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Validates Python files parse as valid AST |
|
||||
| `check-builtin-literals` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Enforces literal syntax for `dict()`, `list()` |
|
||||
|
||||
For formatting: check if `black`, `ruff`, or `isort` is already configured in `pyproject.toml` before recommending them.
|
||||
|
||||
## JSON (`.json`)
|
||||
|
||||
| Hook ID | Repo | Rev | Rationale |
|
||||
|---------|------|-----|-----------|
|
||||
| `check-json` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Validates JSON parses correctly |
|
||||
| `pretty-format-json` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Auto-formats JSON (fixer — warns user to re-stage after commit) |
|
||||
|
||||
## YAML (`.yaml`, `.yml`)
|
||||
|
||||
| Hook ID | Repo | Rev | Rationale |
|
||||
|---------|------|-----|-----------|
|
||||
| `check-yaml` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Validates YAML parses correctly |
|
||||
|
||||
For Kubernetes/Helm YAML with custom tags, add `args: ['--unsafe']` and `exclude: ^helm/templates/`.
|
||||
|
||||
## TOML (`.toml`)
|
||||
|
||||
| Hook ID | Repo | Rev | Rationale |
|
||||
|---------|------|-----|-----------|
|
||||
| `check-toml` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Validates TOML parses correctly |
|
||||
|
||||
## Secrets / security
|
||||
|
||||
| Hook ID | Repo | Rev | Rationale |
|
||||
|---------|------|-----|-----------|
|
||||
| `gitleaks` | `https://github.com/gitleaks/gitleaks` | `v8.30.1` | **Unverified — not in research corpus, verify upstream before use.** Scans for secrets and high-entropy strings |
|
||||
|
||||
## Commit message
|
||||
|
||||
| Hook ID | Repo | Rev | Stage | Rationale |
|
||||
|---------|------|-----|-------|-----------|
|
||||
| `conventional-pre-commit` | `https://github.com/compilerla/conventional-pre-commit` | `v2.4.0` | `commit-msg` | Enforces Conventional Commits format |
|
||||
|
||||
When adding commit-msg hooks, also add `default_install_hook_types: [pre-commit, commit-msg]` to the top-level config if not already present.
|
||||
| Hook ID | Repo | Rev | Notes |
|
||||
|---------|------|-----|-------|
|
||||
| `shellcheck` | `https://github.com/jumanjihouse/pre-commit-hooks` | `3.0.0` | **Unverified — not in research corpus, verify upstream before use.** Recommended args: `args: [--severity=warning]` |
|
||||
| `gitleaks` | `https://github.com/gitleaks/gitleaks` | `v8.30.1` | **Unverified — not in research corpus, verify upstream before use.** |
|
||||
| `conventional-pre-commit` | `https://github.com/compilerla/conventional-pre-commit` | `v2.4.0` | Stage `commit-msg`; also add `default_install_hook_types: [pre-commit, commit-msg]` to the top-level config if not already present |
|
||||
|
||||
## Meta-validation (add last, after all other repos)
|
||||
|
||||
@@ -125,4 +89,4 @@ Language choices for local hooks:
|
||||
|
||||
## Rev pin freshness
|
||||
|
||||
The revs above were last verified current at time of writing (matched against the plugin's own research corpus in `docs/research/docs/pre-commit/`; rows marked "Unverified" have no such backing and must be checked against upstream before use). Since the "Rev staleness" check in `references/modify-config.md` treats this table as ground truth, a pin that goes stale here produces false-positive staleness warnings for users who already have a newer, correct rev. Re-verify these pins periodically (e.g. against each repo's latest release tag). When in doubt, treat `pre-commit autoupdate`'s own output as the authoritative staleness signal, not a mismatch against this table.
|
||||
The revs above were last verified current at time of writing (matched against the plugin's own research corpus in `docs/research/docs/pre-commit/`; rows marked "Unverified" have no such backing and must be checked against upstream before use). Since the "Rev staleness" check in `references/modify-config.md` treats these tables as ground truth, a pin that goes stale here produces false-positive staleness warnings for users who already have a newer, correct rev. Re-verify these pins periodically (e.g. against each repo's latest release tag). When in doubt, treat `pre-commit autoupdate`'s own output as the authoritative staleness signal, not a mismatch against these tables.
|
||||
|
||||
@@ -36,10 +36,7 @@ Suggestions:
|
||||
|
||||
Cause: shellcheck found a shell script issue. The output includes the file path, line number, and SC-code.
|
||||
|
||||
Fix: Look up the SC-code on shellcheck.net or pass `--explain SCxxxx` to shellcheck for a detailed explanation. The most common fixes:
|
||||
- SC2086 (unquoted variable): wrap in double quotes.
|
||||
- SC2046 (unquoted command substitution): wrap in double quotes.
|
||||
- SC2181 (check exit code of `$?`): use `if command; then` directly.
|
||||
Fix: Look up the SC-code on shellcheck.net or pass `--explain SCxxxx` to shellcheck for a detailed explanation.
|
||||
|
||||
## `check-hooks-apply` fails
|
||||
|
||||
@@ -53,23 +50,6 @@ Cause: An `exclude` pattern matches no files.
|
||||
|
||||
Fix: Remove or fix the pattern.
|
||||
|
||||
## SSH cloning fails in CI
|
||||
|
||||
Cause: The CI environment lacks SSH credentials to clone hook repos over SSH.
|
||||
|
||||
Fix: Export `SSH_AUTH_SOCK` in the CI environment, or switch hook repo URLs to HTTPS.
|
||||
|
||||
## HTTP proxy needed
|
||||
|
||||
Cause: The CI/sandbox network requires a proxy to reach hook repos.
|
||||
|
||||
Fix:
|
||||
```bash
|
||||
export http_proxy=http://proxy.example.com:3128
|
||||
export https_proxy=http://proxy.example.com:3128
|
||||
export no_proxy=localhost,127.0.0.1
|
||||
```
|
||||
|
||||
## `rev` is a branch name — `autoupdate` broke it
|
||||
|
||||
Cause: Branch refs are mutable and drift over time; pre-commit resolves them once at install time, so pinning to a branch name (instead of a tag or commit SHA) leads to silent version drift.
|
||||
@@ -126,8 +106,4 @@ Or add `default_install_hook_types` to `.pre-commit-config.yaml` and re-run `pre
|
||||
|
||||
## `validate-config` schema error
|
||||
|
||||
Common causes:
|
||||
- Missing `id` under a hook block
|
||||
- Missing `rev` under a non-local repo block
|
||||
- `repo: local` hook missing `language` or `entry`
|
||||
- Indentation error (valid YAML but invalid pre-commit schema)
|
||||
Common causes: missing `id` under a hook block, missing `rev` under a non-local repo block, a `repo: local` hook missing `language` or `entry`, or an indentation error (valid YAML but invalid pre-commit schema).
|
||||
|
||||
Reference in New Issue
Block a user