PreCommit
A comprehensive skill for managing pre-commit hooks - the framework for multi-language pre-commit hook management that automates code quality, formatting, linting, and security scanning.
Quick Reference
| Command |
Description |
pre-commit install |
Install git hooks |
pre-commit run --all-files |
Run all hooks on all files |
pre-commit autoupdate |
Update hooks to latest versions |
pre-commit run <hook-id> |
Run specific hook |
Workflow Routing
| Workflow |
Trigger |
File |
| Setup |
"setup pre-commit", "initialize hooks", "create config" |
Workflows/Setup.md |
| AddHooks |
"add hook", "add linting", "add formatter", "add security" |
Workflows/AddHooks.md |
| Troubleshoot |
"fix pre-commit", "hook failing", "debug hooks" |
Workflows/Troubleshoot.md |
| CIIntegration |
"CI pipeline", "GitHub Actions", "GitLab CI" |
Workflows/CIIntegration.md |
| CustomHook |
"create custom hook", "local hook", "write hook" |
Workflows/CustomHook.md |
Documentation
| Document |
Purpose |
QuickStartGuide.md |
Installation and first-time setup |
HooksReference.md |
Comprehensive hook catalog by language/purpose |
ConfigurationGuide.md |
Advanced configuration options |
SecurityHooks.md |
Secret detection and security scanning |
Tools
| Tool |
Purpose |
Tools/PreCommitManager.ts |
CLI for managing pre-commit configurations |
Tools/HookGenerator.ts |
Generate .pre-commit-config.yaml templates |
Tools/HookValidator.ts |
Validate hook configurations |
Examples
Example 1: Setup pre-commit for a new project
User: "Setup pre-commit for my Python project"
→ Invokes Setup workflow
→ Creates .pre-commit-config.yaml with Python hooks (black, isort, flake8)
→ Runs pre-commit install
Example 2: Add Terraform hooks
User: "Add Terraform validation hooks"
→ Invokes AddHooks workflow
→ Adds terraform_fmt, terraform_validate, terraform_docs hooks
→ Configures tflint and checkov integration
Example 3: Add security scanning
User: "Add secret detection to pre-commit"
→ Invokes AddHooks workflow
→ Adds gitleaks, detect-secrets, trufflehog hooks
→ Configures appropriate exclusion patterns
Example 4: Debug failing hook
User: "My eslint pre-commit hook is failing"
→ Invokes Troubleshoot workflow
→ Checks hook configuration and dependencies
→ Provides fix recommendations
Supported Hook Categories
- Python: black, isort, flake8, mypy, bandit, pyupgrade
- JavaScript/TypeScript: prettier, eslint, biome
- Infrastructure: terraform, terragrunt, helm, kustomize
- Kubernetes: kubeconform, kubeval, checkov
- Security: gitleaks, detect-secrets, trufflehog, trivy
- General: yamllint, jsonlint, shellcheck, markdownlint
1---2name: precommit3description: Pre-commit hooks framework for multi-language code quality automation. USE WHEN setting up pre-commit OR configuring git hooks OR adding linting OR code formatting OR security scanning OR Terraform validation OR Kubernetes manifests OR Helm charts OR Python linting OR JavaScript formatting. Manages .pre-commit-config.yaml, hook installation, and CI integration.4metadata:5 source: https://skillmd.com/skills/levalencia/precommit6---78# PreCommit910A comprehensive skill for managing [pre-commit](https://pre-commit.com/) hooks - the framework for multi-language pre-commit hook management that automates code quality, formatting, linting, and security scanning.1112## Quick Reference1314| Command | Description |15|---------|-------------|16| `pre-commit install` | Install git hooks |17| `pre-commit run --all-files` | Run all hooks on all files |18| `pre-commit autoupdate` | Update hooks to latest versions |19| `pre-commit run <hook-id>` | Run specific hook |2021## Workflow Routing2223| Workflow | Trigger | File |24|----------|---------|------|25| **Setup** | "setup pre-commit", "initialize hooks", "create config" | `Workflows/Setup.md` |26| **AddHooks** | "add hook", "add linting", "add formatter", "add security" | `Workflows/AddHooks.md` |27| **Troubleshoot** | "fix pre-commit", "hook failing", "debug hooks" | `Workflows/Troubleshoot.md` |28| **CIIntegration** | "CI pipeline", "GitHub Actions", "GitLab CI" | `Workflows/CIIntegration.md` |29| **CustomHook** | "create custom hook", "local hook", "write hook" | `Workflows/CustomHook.md` |3031## Documentation3233| Document | Purpose |34|----------|---------|35| `QuickStartGuide.md` | Installation and first-time setup |36| `HooksReference.md` | Comprehensive hook catalog by language/purpose |37| `ConfigurationGuide.md` | Advanced configuration options |38| `SecurityHooks.md` | Secret detection and security scanning |3940## Tools4142| Tool | Purpose |43|------|---------|44| `Tools/PreCommitManager.ts` | CLI for managing pre-commit configurations |45| `Tools/HookGenerator.ts` | Generate .pre-commit-config.yaml templates |46| `Tools/HookValidator.ts` | Validate hook configurations |4748## Examples4950**Example 1: Setup pre-commit for a new project**51```52User: "Setup pre-commit for my Python project"53→ Invokes Setup workflow54→ Creates .pre-commit-config.yaml with Python hooks (black, isort, flake8)55→ Runs pre-commit install56```5758**Example 2: Add Terraform hooks**59```60User: "Add Terraform validation hooks"61→ Invokes AddHooks workflow62→ Adds terraform_fmt, terraform_validate, terraform_docs hooks63→ Configures tflint and checkov integration64```6566**Example 3: Add security scanning**67```68User: "Add secret detection to pre-commit"69→ Invokes AddHooks workflow70→ Adds gitleaks, detect-secrets, trufflehog hooks71→ Configures appropriate exclusion patterns72```7374**Example 4: Debug failing hook**75```76User: "My eslint pre-commit hook is failing"77→ Invokes Troubleshoot workflow78→ Checks hook configuration and dependencies79→ Provides fix recommendations80```8182## Supported Hook Categories8384- **Python**: black, isort, flake8, mypy, bandit, pyupgrade85- **JavaScript/TypeScript**: prettier, eslint, biome86- **Infrastructure**: terraform, terragrunt, helm, kustomize87- **Kubernetes**: kubeconform, kubeval, checkov88- **Security**: gitleaks, detect-secrets, trufflehog, trivy89- **General**: yamllint, jsonlint, shellcheck, markdownlint