/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
- Pre-commit config: !
find . -maxdepth 1 -name '.pre-commit-config.yaml'
- Project standards: !
find . -maxdepth 1 -name '.project-standards.yaml'
- Project type in standards: !
find . -maxdepth 1 -name '.project-standards.yaml' -exec grep -m1 "^project_type:" {} +
- Has terraform: !
find . -maxdepth 2 \( -name '*.tf' -o -type d -name 'terraform' \) -print -quit
- Has helm: !
find . -maxdepth 2 -type d -name 'helm' -print -quit
- Has package.json: !
find . -maxdepth 1 -name 'package.json'
- Has pyproject.toml: !
find . -maxdepth 1 -name 'pyproject.toml'
Parameters
Parse from $ARGUMENTS:
--check-only: Report status without offering fixes
--fix: Apply all fixes automatically without prompting
--type <type>: Override project type detection (frontend, infrastructure, python)
Execution
Execute this pre-commit compliance check:
Step 1: Detect project type
- Read
.project-standards.yaml for project_type field if it exists
- If not found, auto-detect:
- infrastructure: Has
terraform/, helm/, argocd/, or *.tf files
- frontend: Has
package.json with vue/react dependencies
- python: Has
pyproject.toml or requirements.txt
- Apply
--type flag override if provided
Step 2: Check configuration file
- If
.pre-commit-config.yaml is missing: report FAIL, offer to create from template
- If it exists: read and parse the configuration
Step 3: Verify hook versions against latest releases
CRITICAL: Before flagging outdated hooks, verify latest releases using WebSearch or WebFetch:
- pre-commit-hooks: GitHub releases
- conventional-pre-commit: GitHub releases
- biome: GitHub releases
- ruff-pre-commit: GitHub releases
- gitleaks: GitHub releases
Step 4: Analyze compliance
Compare existing configuration against the project standards in REFERENCE.md:
Required Base Hooks (All Projects):
pre-commit-hooks v5.0.0+ with: trailing-whitespace, end-of-file-fixer, check-yaml, check-json, check-merge-conflict, check-added-large-files
conventional-pre-commit v4.3.0+ with commit-msg stage
Frontend-specific:
biome (pre-commit) v0.4.0+
helmlint (if helm/ directory exists)
Infrastructure-specific:
tflint, helmlint (gruntwork v0.1.29+)
actionlint v1.7.7+
helm-docs v1.14.2+
gitleaks v8.22.1+
Python-specific:
ruff-pre-commit v0.8.4+ (ruff, ruff-format)
gitleaks v8.22.1+
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])
Outdated Hooks:
- [hook]: [current] -> [standard]
Overall: [N] issues found
Step 6: Apply fixes (if requested)
If --fix flag is set or user confirms:
- Missing config file: Create from standard template for detected project type
- Missing hooks: Add required hooks with standard versions
- Outdated versions: Update
rev: values to standard versions
- Missing hook types: Add
default_install_hook_types with pre-commit and commit-msg
After modification, run pre-commit install --install-hooks to install hooks.
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
- No git repository: Warn but continue (pre-commit still useful)
- Invalid YAML: Report parse error, offer to replace with template
- Unknown hook repos: Skip (do not remove custom hooks)
- Permission errors: Report and suggest manual fix
See Also
/configure:all - Run all compliance checks
/configure:status - Quick compliance overview
- REFERENCE.md - Canonical hook list, pinned versions, per-project-type configurations
1---
2created: 2025-12-16
3modified: 2026-07-05
4reviewed: 2026-07-05
5description: "pre-commit hooks setup and validation. Use when installing hooks, configuring frontend/infrastructure/python project types, or migrating to pre-commit."
6allowed-tools: Glob, Grep, Read, Write, Edit, Bash, AskUserQuestion, TodoWrite, WebSearch, WebFetch
7args: "[--check-only] [--fix] [--type <frontend|infrastructure|python>]"
8argument-hint: "[--check-only] [--fix] [--type <frontend|infrastructure|python>]"
9name: configure-pre-commit
10---
11
12# /configure:pre-commit
13
14Check and configure pre-commit hooks against project standards.
15
16## When to Use This Skill
17
18| Use this skill when... | Use another approach when... |
19|------------------------|------------------------------|
20| Setting up or validating pre-commit hooks | Project doesn't use pre-commit framework (use git hooks directly) |
21| Checking compliance with project standards | Just running hooks manually (use `pre-commit run` command) |
22| Installing project-type-specific hooks | Hooks are already properly configured |
23| Migrating to pre-commit framework | Simple project with no quality checks needed |
24| Updating hook configurations for detected tools | Need to disable pre-commit entirely |
25
26## Context
27
28- Pre-commit config: !`find . -maxdepth 1 -name '.pre-commit-config.yaml'`
29- Project standards: !`find . -maxdepth 1 -name '.project-standards.yaml'`
30- Project type in standards: !`find . -maxdepth 1 -name '.project-standards.yaml' -exec grep -m1 "^project_type:" {} +`
31- Has terraform: !`find . -maxdepth 2 \( -name '*.tf' -o -type d -name 'terraform' \) -print -quit`
32- Has helm: !`find . -maxdepth 2 -type d -name 'helm' -print -quit`
33- Has package.json: !`find . -maxdepth 1 -name 'package.json'`
34- Has pyproject.toml: !`find . -maxdepth 1 -name 'pyproject.toml'`
35
36## Parameters
37
38Parse from `$ARGUMENTS`:
39
40- `--check-only`: Report status without offering fixes
41- `--fix`: Apply all fixes automatically without prompting
42- `--type <type>`: Override project type detection (`frontend`, `infrastructure`, `python`)
43
44## Execution
45
46Execute this pre-commit compliance check:
47
48### Step 1: Detect project type
49
501. Read `.project-standards.yaml` for `project_type` field if it exists
512. If not found, auto-detect:
52 - **infrastructure**: Has `terraform/`, `helm/`, `argocd/`, or `*.tf` files
53 - **frontend**: Has `package.json` with vue/react dependencies
54 - **python**: Has `pyproject.toml` or `requirements.txt`
553. Apply `--type` flag override if provided
56
57### Step 2: Check configuration file
58
591. If `.pre-commit-config.yaml` is missing: report FAIL, offer to create from template
602. If it exists: read and parse the configuration
61
62### Step 3: Verify hook versions against latest releases
63
64**CRITICAL**: Before flagging outdated hooks, verify latest releases using WebSearch or WebFetch:
65
661. **pre-commit-hooks**: [GitHub releases](https://github.com/pre-commit/pre-commit-hooks/releases)
672. **conventional-pre-commit**: [GitHub releases](https://github.com/compilerla/conventional-pre-commit/releases)
683. **biome**: [GitHub releases](https://github.com/biomejs/biome/releases)
694. **ruff-pre-commit**: [GitHub releases](https://github.com/astral-sh/ruff-pre-commit/releases)
705. **gitleaks**: [GitHub releases](https://github.com/gitleaks/gitleaks/releases)
71
72### Step 4: Analyze compliance
73
74Compare existing configuration against the project standards in [REFERENCE.md](REFERENCE.md):
75
76**Required Base Hooks (All Projects):**
77- `pre-commit-hooks` v5.0.0+ with: trailing-whitespace, end-of-file-fixer, check-yaml, check-json, check-merge-conflict, check-added-large-files
78- `conventional-pre-commit` v4.3.0+ with commit-msg stage
79
80**Frontend-specific:**
81- `biome` (pre-commit) v0.4.0+
82- `helmlint` (if helm/ directory exists)
83
84**Infrastructure-specific:**
85- `tflint`, `helmlint` (gruntwork v0.1.29+)
86- `actionlint` v1.7.7+
87- `helm-docs` v1.14.2+
88- `gitleaks` v8.22.1+
89
90**Python-specific:**
91- `ruff-pre-commit` v0.8.4+ (ruff, ruff-format)
92- `gitleaks` v8.22.1+
93
94### Step 5: Generate compliance report
95
96Print a report in this format:
97
98```
99Pre-commit Compliance Report
100================================
101Project Type: [type] ([detected|override])
102Config File: .pre-commit-config.yaml ([found|missing])
103
104Hook Status:
105 [hook-name] [version] [PASS|WARN|FAIL] ([details])
106
107Outdated Hooks:
108 - [hook]: [current] -> [standard]
109
110Overall: [N] issues found
111```
112
113### Step 6: Apply fixes (if requested)
114
115If `--fix` flag is set or user confirms:
116
1171. **Missing config file**: Create from standard template for detected project type
1182. **Missing hooks**: Add required hooks with standard versions
1193. **Outdated versions**: Update `rev:` values to standard versions
1204. **Missing hook types**: Add `default_install_hook_types` with `pre-commit` and `commit-msg`
121
122After modification, run `pre-commit install --install-hooks` to install hooks.
123
124### Step 7: Update standards tracking
125
126Update or create `.project-standards.yaml`:
127
128```yaml
129standards_version: "2025.1"
130project_type: "[detected]"
131last_configured: "[timestamp]"
132components:
133 pre-commit: "2025.1"
134```
135
136## Agentic Optimizations
137
138| Context | Command |
139|---------|---------|
140| Check if pre-commit installed | `command -v pre-commit >/dev/null 2>&1 && echo "installed" \|\| echo "missing"` |
141| Validate config syntax | `pre-commit validate-config .pre-commit-config.yaml 2>&1` |
142| List configured hooks | `grep -E '^\s+- id:' .pre-commit-config.yaml 2>/dev/null \| sed 's/.*id:[[:space:]]*//'` |
143| Check hook versions | `pre-commit autoupdate --freeze 2>&1` |
144| Quick compliance check | `/configure:pre-commit --check-only` |
145| Auto-fix configuration | `/configure:pre-commit --fix` |
146
147## Flags
148
149| Flag | Description |
150|------|-------------|
151| `--check-only` | Report status without offering fixes |
152| `--fix` | Apply all fixes automatically without prompting |
153| `--type <type>` | Override project type detection (frontend, infrastructure, python) |
154
155## Error Handling
156
157- **No git repository**: Warn but continue (pre-commit still useful)
158- **Invalid YAML**: Report parse error, offer to replace with template
159- **Unknown hook repos**: Skip (do not remove custom hooks)
160- **Permission errors**: Report and suggest manual fix
161
162## See Also
163
164- `/configure:all` - Run all compliance checks
165- `/configure:status` - Quick compliance overview
166- [REFERENCE.md](REFERENCE.md) - Canonical hook list, pinned versions, per-project-type configurations