- Home
- Skills
- Snowmead
- Guardrail Agent Skills
- Guardrail Commit Hooks
guardrail-commit-hooks_skill
- Shell
0
GitHub Stars
2
Bundled Files
2 months ago
Catalog Refreshed
3 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill snowmead/guardrail-agent-skills --skill guardrail-commit-hooks- LICENSE.txt1.0 KB
- SKILL.md16.6 KB
Overview
This skill helps create, analyze, and manage prek (pre-commit drop-in) git commit hooks to enforce code quality guardrails. It recommends context-aware hooks, generates a .pre-commit-config.yaml, installs prek hooks, and can update hook versions. Use it to prevent formatting, security, and commit-workflow issues before they reach the repo.
How this skill works
The skill inspects your repository for language indicators (package.json, pyproject.toml, go.mod, Cargo.toml, etc.), existing hook tools (.pre-commit-config.yaml, .husky, lefthook), and monorepo layout. It then fetches current prek documentation and upstream release tags to build a tailored hook list: universal hygiene hooks, file-type validators only when matching files exist, language-specific linters/formatters, and security scanners like gitleaks. It can generate the config file, run prek install, execute an initial --all-files run, and optionally update existing hook revs to the latest releases.
When to use it
- Initializing a new git repository and wanting automated guardrails
- You encounter formatting, lint, or secret-detection issues that hooks could prevent
- Your project lacks .pre-commit-config.yaml and you want recommended hooks
- Migrating from other hook managers (husky, lefthook) to prek
- You need to update existing hook versions across the repo
Best practices
- Always fetch latest documentation and release tags instead of hardcoding versions
- Include universal builtin hooks (trailing-whitespace, end-of-file-fixer, detect-private-key, check-merge-conflict)
- Only include file-format validators (check-yaml, check-json, check-toml) when matching files are present
- Ask the team before enabling no-commit-to-branch to avoid disrupting workflows
- Run prek --all-files after install and fix issues before committing the config
Example use cases
- Analyze a new project to produce a recommended prek config with universal and language-specific hooks
- Run the setup wizard to install prek, write .pre-commit-config.yaml, and install git hooks
- Migrate a repository currently using husky to prek and translate selected checks
- Update external hook revs (ruff, biome) to their latest releases and run tests
- Add gitleaks and other security hooks to prevent secrets from entering history
FAQ
No. The skill shows a proposed configuration and asks for explicit approval before writing .pre-commit-config.yaml or installing hooks.
How does it decide which hooks to include?
It detects project files and languages, always adds universal hygiene and security hooks, and only includes file-type or language hooks when matching files are found or you confirm workflow choices.