home / skills / laurigates / claude-plugins / pre-commit-standards

pre-commit-standards skill

/configure-plugin/skills/pre-commit-standards

This skill helps enforce pre-commit standards by configuring and validating hook sets across projects for consistent quality.

npx playbooks add skill laurigates/claude-plugins --skill pre-commit-standards

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
5.6 KB
---
model: haiku
created: 2025-12-16
modified: 2026-02-06
reviewed: 2025-12-16
name: pre-commit-standards
description: |
  Pre-commit hook standards and configuration. Use when configuring pre-commit hooks
  in repositories, checking hook compliance, or when the user mentions pre-commit,
  conventional commits, or hook configuration.
allowed-tools: Bash, Read, Write, Edit, Grep, Glob
---

# Pre-commit Standards

## Version: 2025.1

Standard pre-commit configuration for repository compliance.

## Standard Versions (2025.1)

| Hook | Version | Purpose |
|------|---------|---------|
| pre-commit-hooks | v5.0.0 | Core hooks (trailing-whitespace, check-yaml, etc.) |
| conventional-pre-commit | v4.3.0 | Conventional commit message validation |
| biome | v0.4.0 | Code formatting and linting (JS, TS, JSON) |
| gruntwork pre-commit | v0.1.29 | helmlint, tflint (infrastructure only) |
| actionlint | v1.7.7 | GitHub Actions validation (infrastructure only) |
| helm-docs | v1.14.2 | Helm documentation (infrastructure only) |
| gitleaks | v8.22.1 | Secret scanning (recommended) |

## Project Type Configurations

### Frontend App (Vue/React)

Required hooks for frontend applications:

```yaml
default_install_hook_types:
  - pre-commit
  - commit-msg

repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v5.0.0
    hooks:
      - id: trailing-whitespace
      - id: end-of-file-fixer
      - id: check-yaml
        exclude: ^(helm/templates/|skaffold/|k8s/).*\.ya?ml$
      - id: check-json
        exclude: tsconfig\.json$
      - id: check-added-large-files
        args: ['--maxkb=1000']
      - id: check-merge-conflict
      - id: detect-private-key

  - repo: https://github.com/compilerla/conventional-pre-commit
    rev: v4.3.0
    hooks:
      - id: conventional-pre-commit
        stages: [commit-msg]

  - repo: https://github.com/biomejs/pre-commit
    rev: v0.4.0
    hooks:
      - id: biome-check
        additional_dependencies: ["@biomejs/[email protected]"]

  # Optional: If project has Helm charts
  - repo: https://github.com/gruntwork-io/pre-commit
    rev: v0.1.29
    hooks:
      - id: helmlint
        files: ^helm/
```

### Infrastructure Repository

Required hooks for infrastructure (Terraform, Helm, ArgoCD):

```yaml
default_install_hook_types:
  - pre-commit
  - commit-msg

repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v5.0.0
    hooks:
      - id: trailing-whitespace
      - id: end-of-file-fixer
      - id: check-yaml
        args: [--allow-multiple-documents]
        exclude: argocd/.*templates/|helm/[^/]+/templates/
      - id: check-json
      - id: check-merge-conflict
      - id: check-symlinks
      - id: check-toml
      - id: check-added-large-files

  - repo: https://github.com/compilerla/conventional-pre-commit
    rev: v4.3.0
    hooks:
      - id: conventional-pre-commit
        stages: [commit-msg]

  - repo: https://github.com/gruntwork-io/pre-commit
    rev: v0.1.29
    hooks:
      - id: tflint
      - id: helmlint

  - repo: https://github.com/rhysd/actionlint
    rev: v1.7.7
    hooks:
      - id: actionlint

  - repo: https://github.com/norwoodj/helm-docs
    rev: v1.14.2
    hooks:
      - id: helm-docs
        args:
          - --chart-search-root=helm

  - repo: https://github.com/gitleaks/gitleaks
    rev: v8.22.1
    hooks:
      - id: gitleaks
```

### Python Service

Required hooks for Python projects:

```yaml
default_install_hook_types:
  - pre-commit
  - commit-msg

repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v5.0.0
    hooks:
      - id: trailing-whitespace
      - id: end-of-file-fixer
      - id: check-yaml
      - id: check-json
      - id: check-toml
      - id: check-added-large-files
      - id: check-merge-conflict
      - id: detect-private-key

  - repo: https://github.com/compilerla/conventional-pre-commit
    rev: v4.3.0
    hooks:
      - id: conventional-pre-commit
        stages: [commit-msg]

  - repo: https://github.com/astral-sh/ruff-pre-commit
    rev: v0.8.4
    hooks:
      - id: ruff
        args: [--fix]
      - id: ruff-format

  - repo: https://github.com/gitleaks/gitleaks
    rev: v8.22.1
    hooks:
      - id: gitleaks
```

## Compliance Checking

### Required Base Hooks (All Projects)

Every repository MUST have these hooks:

1. **pre-commit-hooks** (v5.0.0+)
   - `trailing-whitespace`
   - `end-of-file-fixer`
   - `check-yaml`
   - `check-json`
   - `check-merge-conflict`
   - `check-added-large-files`

2. **conventional-pre-commit** (v4.3.0+)
   - `conventional-pre-commit` in `commit-msg` stage

### Status Levels

| Status | Meaning |
|--------|---------|
| PASS | Hook present with compliant version |
| WARN | Hook present but version outdated |
| FAIL | Required hook missing |
| SKIP | Hook not applicable for project type |

### Version Comparison

When checking versions:
- Exact match or newer: PASS
- Older by patch version: WARN (functional but should update)
- Missing entirely: FAIL (must add)

## Exclusion Patterns

### Frontend Apps

Exclude Kubernetes/Helm templates from YAML/prettier checks:

```yaml
exclude: ^(helm/templates/|skaffold/|k8s/).*\.ya?ml$
```

### Infrastructure

Exclude ArgoCD and Helm templates:

```yaml
exclude: argocd/.*templates/|helm/[^/]+/templates/
```

### Python

No special exclusions needed for standard Python projects.

## Installation

After configuring `.pre-commit-config.yaml`:

```bash
pre-commit install
pre-commit install --hook-type commit-msg
```

Or simply:

```bash
pre-commit install --install-hooks
```

## Updating

To update all hooks to latest versions:

```bash
pre-commit autoupdate
```

Then verify versions match project standards.

Overview

This skill provides a standard pre-commit hook configuration and compliance rules for repositories. It defines required hooks, recommended versions, and curated templates for frontend, infrastructure, and Python projects to ensure consistent commit hygiene and automated checks.

How this skill works

The skill inspects a repository's .pre-commit-config.yaml and installed hook versions, then compares them against the 2025.1 standard. It reports PASS/WARN/FAIL/SKIP statuses based on presence and version parity, and highlights exclusions and project-type-specific requirements.

When to use it

  • Setting up pre-commit hooks for a new repository (frontend, infra, or Python).
  • Auditing an existing repo for pre-commit compliance and required hooks.
  • Enforcing conventional commit validation for commit messages.
  • Configuring secret scanning, actionlint, or helm-related hooks for infrastructure.
  • Troubleshooting failing commits due to missing or outdated hooks.

Best practices

  • Always include the required base hooks: pre-commit-hooks (v5.0.0+) and conventional-pre-commit (v4.3.0+) with commit-msg stage.
  • Use the template matching your project type (Frontend, Infrastructure, Python) and add optional hooks only when applicable.
  • Run pre-commit install and pre-commit install --hook-type commit-msg, or use --install-hooks to populate local hooks.
  • Exclude generated templates (Helm/ArgoCD/K8s) from YAML checks per project-type exclusion patterns.
  • Keep hooks updated with pre-commit autoupdate and address WARNs (older patch versions) promptly.

Example use cases

  • Add trailing-whitespace, end-of-file-fixer, and check-json hooks to a new React app to enforce clean diffs.
  • Enable conventional-pre-commit to block non-conventional commit messages and maintain changelog quality.
  • Configure actionlint, helmlint, and tflint for an infrastructure repo to validate CI config and charts.
  • Add gitleaks to scan for committed secrets as part of a security gate.
  • Run a compliance check to detect missing required hooks before merging a large change set.

FAQ

What happens if a required hook is present but older?

That reports WARN: the hook is functional but should be updated to the standard version or newer.

How do I exclude Helm templates from YAML checking in frontend projects?

Add the provided frontend exclusion pattern (^(helm/templates/|skaffold/|k8s/).*\.ya?ml$) to the check-yaml hook.