jrjsmrtn/project-orchestration-skills/setup-git-hooks
Claude Code and agent skill by jrjsmrtn/project-orchestration-skills
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
Configure two-stage git hooks (pre-commit + pre-push) for quality automation, with either pre-commit or lefthook as the hook manager. Use after bootstrap-project and setup-adrs, when adding quality gates to an existing project, or when standardizing quality automation.
Install
npx vskill@latest install jrjsmrtn/project-orchestration-skills/setup-git-hooksSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as jrjsmrtn/project-orchestration-skills/setup-git-hooks.
Setup Git Hooks
Configure two-stage git hooks — fast checks on commit, thorough checks on push — using either pre-commit or lefthook as the hook manager.
When to Use
- After running
bootstrap-projectandsetup-adrsskills - When adding quality gates to an existing project
- When standardizing quality automation across projects
Required Inputs
- Technology stack (Elixir, Python, TypeScript, etc.)
- Quality tools preference (can use defaults for each ecosystem)
- Multi-remote strategy (if using private + public remotes)
Two-Stage Strategy
Stage 1: Pre-commit (Fast, <30 seconds)
- File hygiene (whitespace, line endings, merge conflicts)
- Secret detection (critical security gate)
- Code formatting check
Stage 2: Pre-push (Thorough, <3 minutes)
- Linting with strict rules
- Type checking
- Security audit (dependencies)
- Fast tests (exclude slow/integration)
Workflow
Step 0: Create Quality Configuration Reference
Before configuring tools, create the single source of truth: docs/reference/quality-configuration.md
Every build-version selector in CI names the same pinned line (expect ONE distinct value):
grep -rhoE '(go|python|node|otp|elixir)-version:[[:space:]]*"?[^"[:space:]]+' .github/workflows/ \
Only the floor-compatibility job reads the floor from the manifest (expect exactly the jobs
listed in the per-call-site table above — nothing else):
grep -rn 'version-file' .github/workflows/
The floor still builds and tests (Go shown; use the ecosystem's pinning mechanism):
GOTOOLCHAIN=go[FLOOR] go build ./... && GOTOOLCHAIN=go[FLOOR] go test ./...
Vulnerability scanning is clean ON THE BUILD VERSION, not the floor:
[govulncheck ./... | pip-audit | cargo audit | mix deps.audit]
Local hooks and CI run the same commands (expect the same tool invocations on both sides):
grep -oE '(gofmt|go vet|go test|ruff|mix format|cargo fmt)[^"]' .lefthook.yml | sort -u grep -oE '(gofmt|go vet|go test|ruff|mix format|cargo fmt)[^"]' .github/workflows/ci.yml | sort -u
Pattern Reference: See CONSISTENT-QUALITY-GATES
Step 1: Create .editorconfig
Create .editorconfig matching the quality-configuration:
Step 2: Secret Detection Architecture
Secret detection works in three layers:
Layer 1: Global gitleaks config (~/.gitleaks.toml)
- Infrastructure-specific patterns (hostnames, domains, private IPs, custom ports)
- Allowlists for git-ignored files (CLAUDE.local.md, .envrc, vault files)
- RFC 5737/7042 documentation addresses excluded from false positives
Layer 2: Project gitleaks config (.gitleaks.toml, .gitleaksignore)
- Test fixture allowlists (generated keys, X.509 elements, mock data)
- Documentation allowlists (demo credentials in tutorials)
- Stop words for test data: test, example, sample, dummy, fake, mock, stub
Layer 3: Git hooks (pre-commit stage)
gitleaks protect --stagedon every commit- Catches secrets before they enter git history
Create .gitleaks.toml if the project has test fixtures or documentation with intentional fake credentials:
Use .gitleaksignore for specific false positives that can't be handled by rules:
Step 3: Sensitive Files in .gitignore
Ensure .gitignore covers all secret-bearing files:
.envrc and .envrc.local (direnv) are treated like .env — they may contain or derive secrets (e.g., Keychain lookups). If a project needs a committed .envrc for non-secret PATH setup, use .envrc.local for the secret overrides and source it from .envrc:
The list above is asserted, not just recommended: scripts/check-hygiene.sh (Step 5, Hygiene check) fails when a pattern is missing, and when .env.example is ignored because the !.env.example line is absent.
Step 4: Install Hook Framework
Preferred: lefthook (fast, no Python dependency, parallel execution):
Alternative: pre-commit (Python-based, wider ecosystem of third-party hooks):
Step 5: Create Configuration
Create hook configuration based on framework choice and technology stack:
Dependency vulnerability auditing
The pre-push stage runs a dependency vulnerability audit per ecosystem — this satisfies the OpenSSF Scorecard Vulnerabilities check and the Best Practices Badge's dependency-vulnerability criterion. The tools are not interchangeable; know what each checks:
| Ecosystem | Tool | Checks | Prerequisite | |
|---|---|---|---|---|
| Elixir | mix deps.audit | Known CVEs in dependencies | add {:mix_audit, "~> 2.1", only: [:dev, :test], runtime: false} to mix.exs | |
| Elixir | mix hex.audit | Retired Hex packages | built into Hex | |
| Python | pip-audit | Known CVEs (PyPI / OSV) | pip install pip-audit (or uv) | |
| Rust | cargo audit | RustSec advisory DB | cargo install cargo-audit |
For Elixir, run both: mix hex.audit flags retired/deprecated packages, while mix deps.audit (via the mix_audit package) flags packages with known CVEs — different failure modes, both needed. Elixir/BEAM advisories are increasingly issued by the Erlang Ecosystem Foundation, now a CVE Numbering Authority (CNA) for Hex.pm and the BEAM ecosystem under the EEF Ægis initiative — so mix deps.audit is only as good as the advisory feed it consumes, which the EEF now curates.
Lockfile and frozen installs
Commit the ecosystem lockfile and install from it deterministically — the OpenSSF Scorecard Pinned-Dependencies control, which makes builds reproducible and tamper-evident.
| Ecosystem | Lockfile (commit it) | Frozen/locked install (CI + containers) | |
|---|---|---|---|
| Python (uv) | uv.lock | uv sync --frozen | |
| Elixir | mix.lock | mix deps.get --check-locked (CI) | |
| Rust | Cargo.lock | cargo build --locked | |
| Node | package-lock.json | npm ci |
Ship the check as a pre-push and CI gate: the lockfile must be present and committed (present in the index — a lockfile that exists on disk but is git-ignored passes a plain ls), and it fails a manifest with no committed lock whatever its constraints say, which is stricter than flagging lower-bound (>= / ~>) constraints only: anyone installing without the lock resolves loosely. In a Containerfile, avoid COPY mix.lock* (optional glob): it silently masks a missing lockfile, and the check fails it.
Hygiene check — .gitignore and lockfiles
The script is `scripts/check-hygiene.sh`, in this skill's directory. Copy it into the project as scripts/check-hygiene.sh rather than retyping it, and run it from the repository root.
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/setup-git-hooks/SKILL.md
Popularity
- Repository stars
- 15
- 7-day trend score
- 14
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Extension points
hookPre/post lifecycle hooks
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/jrjsmrtn/project-orchestration-skills/setup-git-hooks)