configure-pre-commit
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.
- License 许可
- MIT
- 最近更新
- 2026-11-12
- Stars
- ★ 59
- Forks
- 6
01 前言 Front Matter
- args
- [--check-only] [--fix] [--type <frontend|infrastructure|python>]
- name
- configure-pre-commit
- created
- 1765843200000
- modified
- 1793664000000
- reviewed
- 1783209600000
- description
- 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.
- allowed-tools
- Glob, Grep, Read, Write, Edit, Bash, AskUserQuestion, TodoWrite, WebSearch, WebFetch
- argument-hint
- [--check-only] [--fix] [--type <frontend|infrastructure|python>]
02 资源文件 1
- 参考文档REFERENCE.md6.5 KB
03 SKILL.md 正文
/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.yamlforproject_typefield if it exists - If not found, auto-detect:
- infrastructure: Has
terraform/,helm/,argocd/, or*.tffiles - frontend: Has
package.jsonwith vue/react dependencies - python: Has
pyproject.tomlorrequirements.txt
- infrastructure: Has
- Apply
--typeflag override if provided
Step 2: Check configuration file
- If
.pre-commit-config.yamlis 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-hooksv5.0.0+ with: trailing-whitespace, end-of-file-fixer, check-yaml, check-json, check-merge-conflict, check-added-large-filesconventional-pre-commitv4.3.0+ with commit-msg stagedefault_install_hook_typeslistingpre-commitandcommit-msg, plusdefault_stages: [pre-commit]whenevercommit-msgis installed. Flag a missingdefault_stagesas WARN: without it every unstaged file hook runs at both installed stages, so each commit runs the hook list twice
Frontend-specific:
biome(pre-commit) v0.4.0+helmlint(if helm/ directory exists)
Infrastructure-specific:
tflint,helmlint(gruntwork v0.1.29+)actionlintv1.7.7+helm-docsv1.14.2+gitleaksv8.22.1+
Python-specific:
ruff-pre-commitv0.8.4+ (ruff, ruff-format)gitleaksv8.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])
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:
- 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_typeswithpre-commitandcommit-msg, anddefault_stages: [pre-commit]beside it. Keep the explicitstages: [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
- 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
04 同仓库更多 Skills
kitty-show-image
Show the user an image with a note on what to judge, via a file send or a labelled kitty tab. Use when the user must see an image, or icat fails with no /dev/tty.
kitty-session-persistence
Snapshot and restore kitty terminal sessions on macOS. Use when surviving WindowServer hangs without losing tabs, configuring snapshots, or restoring after a force-reboot.
kitty-remote-control
Safe kitty remote control from an agent — read panes with kitty @ ls/get-text, notify, and never mutate the live terminal unasked. Use when running inside kitty.
docs-reference-check
Dangling doc-reference gate: flag markdown naming repo paths or relative links that no longer exist. Use when docs cite moved/deleted files, or wiring a doc-drift lint.
youtube-upload
Upload a video to YouTube via the Data API v3 and edit its title, description, tags or thumbnail afterwards. Use when publishing or retitling a YouTube video.
youtube-studio-share
Share a private YouTube video with a whole Google Workspace organization by scripting YouTube Studio in the browser. Use when a video must be org-only.