Configure pre commit

From laurigates/claude-plugins · View interactive version

Configure pre commit is an AI agent skill from the GitHub repository laurigates/claude-plugins. Set up .pre-commit-config.yaml: hooks for the project type at current revs. Use when installing pre-commit in a repo, auditing stale hook revs, or migrating to pre-commit.

How to use this skill

Skill file

/configure:pre-commit

Check and configure pre-commit hooks against project standards.

When to Use This Skill

| Use this skill when... | Use another approach when... |

|------------------------|------------------------------|

| Setting up or validating pre-commit hooks | Project doesn't use pre-commit framework (use git hooks directly) |

| Checking compliance with project standards | Just running hooks manually (use pre-commit run command) |

| Installing project-type-specific hooks | Hooks are already properly configured |

| Migrating to pre-commit framework | Simple project with no quality checks needed |

| Updating hook configurations for detected tools | Need to disable pre-commit entirely |

Context

Parameters

Parse from $ARGUMENTS:

Execution

Execute this pre-commit compliance check:

Step 1: Detect project type

  1. Read .project-standards.yaml for project_type field if it exists
  2. If not found, auto-detect:
  1. Apply --type flag override if provided

Step 2: Check configuration file

  1. If .pre-commit-config.yaml is missing: report FAIL, offer to create from template
  2. If it exists: read and parse the configuration

Step 3: Verify hook versions against latest releases

CRITICAL: Take the latest revs from the tool, not from a pinned list or memory. After writing or auditing the config, run pre-commit autoupdate (it resolves each hook repo's newest tag), then pre-commit validate-config .pre-commit-config.yaml. A new config written from a template with older revs moved pre-commit-hooks v5.0.0 to v6.0.0, conventional-pre-commit v4.3.0 to v4.5.0, gitleaks v8.22.1 to v8.30.0 and actionlint v1.7.7 to v1.7.12 in one run.

autoupdate cannot resolve a repo: local hook; read a local hook's version from where it is pinned (for a Biome hook, package.json). Use WebSearch or WebFetch on a hook repo's releases page only when autoupdate fails for it. For --check-only, run it on a copy (cp .pre-commit-config.yaml tmp/pc.yaml && pre-commit autoupdate --config tmp/pc.yaml) and diff, so the audit writes nothing.

Step 4: Analyze compliance

Compare existing configuration against the project standards in REFERENCE.md:

Required Base Hooks (All Projects):

Frontend-specific:

Infrastructure-specific:

Python-specific:

Step 5: Generate compliance report

Print a report in this format:

Pre-commit Compliance Report
================================
Project Type: [type] ([detected|override])
Config File: .pre-commit-config.yaml ([found|missing])

Hook Status:
  [hook-name]     [version]   [PASS|WARN|FAIL] ([details])

Hook Types:
  default_install_hook_types  [pre-commit, commit-msg]  [PASS|FAIL]
  default_stages              [pre-commit]              [PASS|WARN] (missing: file hooks run twice per commit)

Outdated Hooks:
  - [hook]: [current] -> [standard]

Overall: [N] issues found

Step 6: Apply fixes (if requested)

If --fix flag is set or user confirms:

  1. Missing config file: Create from standard template for detected project type
  2. Missing hooks: Add required hooks with standard versions
  3. Outdated versions: Update rev: values to standard versions
  4. Missing hook types: Add default_install_hook_types with pre-commit and commit-msg, and default_stages: [pre-commit] beside it. Keep the explicit stages: [commit-msg] on conventional-pre-commit or commitizen hooks

After modification, run pre-commit install --install-hooks. default_install_hook_types makes that one command install both hook types; see REFERENCE.md for why default_stages is needed.

Step 7: Update standards tracking

Update or create .project-standards.yaml:

standards_version: "2025.1"
project_type: "[detected]"
last_configured: "[timestamp]"
components:
  pre-commit: "2025.1"

Agentic Optimizations

| Context | Command |

|---------|---------|

| Check if pre-commit installed | command -v pre-commit >/dev/null 2>&1 && echo "installed" \|\| echo "missing" |

| Validate config syntax | pre-commit validate-config .pre-commit-config.yaml 2>&1 |

| List configured hooks | grep -E '^\s+- id:' .pre-commit-config.yaml 2>/dev/null \| sed 's/.*id:[[:space:]]*//' |

| Check hook versions | pre-commit autoupdate --freeze 2>&1 |

| Quick compliance check | /configure:pre-commit --check-only |

| Auto-fix configuration | /configure:pre-commit --fix |

Flags

| Flag | Description |

|------|-------------|

| --check-only | Report status without offering fixes |

| --fix | Apply all fixes automatically without prompting |

| --type <type> | Override project type detection (frontend, infrastructure, python) |

Error Handling

See Also

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.