pre-commit-setup
Skill7 starsChanged 4 days agoMITView on GitHub
Sets up git pre-commit hooks (not agent hooks) running the project's own formatters, linters and a secret scan on staged files, mirrored in CI. Use when asked for pre-commit hooks, husky and lint-staged, lefthook, or to format or lint on commit.
- Installs packages
2 other projects use a version of this.
Adopted by
Most recently taken up by
- MKAbuMattar/skillstheir own version, first seen Jul 27, 2026
- bcmyguest/personal-skillstheir own version, first seen Jul 16, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- MKAbuMattar/skills★ 1same name
- bcmyguest/personal-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository71 other files it gives its agents.
- docs/llms.txtllms.txt
- a11y-fixerSkill
- ad-copy-generatorSkill
- agent-guardrailsSkill
- agent-memory-keeperSkill
- ai-slop-detectorSkill
- api-to-sdkSkill
- app-store-optimizerSkill
- architecture-doctorSkill
- brand-voice-guideSkill
- bug-detectiveSkill
- bus-factorSkill
- changelog-from-gitSkill
- codebase-explainerSkill
- codebase-time-machineSkill
- codebase-valuationSkill
- commit-craftSkill
- commit-roastSkill
- competitor-spySkill
- content-repurposerSkill
- copy-paste-detectorSkill
- cost-cutterSkill
- dead-code-funeralSkill
- demo-recorderSkill
- dependency-doctorSkill
- dependency-weigh-inSkill
- dev-wrappedSkill
- dockerize-anythingSkill
- domain-modelerSkill
- durable-agent-workflowsSkill
- e2e-flow-testerSkill
- email-campaign-writerSkill
- env-secrets-guardSkill
- gh-actions-auditorSkill
- github-portfolioSkill
- hook-generatorSkill
- incident-commanderSkill
- influencer-outreachSkill
- instagram-growth-managerSkill
- issue-triageSkill
- landing-page-roasterSkill
- launch-post-writerSkill
- meeting-notes-to-ticketsSkill
- merge-conflict-resolverSkill
- migration-wizardSkill
- name-checkerSkill
- plan-grillerSkill
- prompt-injection-scannerSkill
- pr-reviewer-proSkill
- readme-glow-upSkill
- repo-cardSkill
- repo-dietSkill
- roast-my-githubSkill
- screenshot-to-componentSkill
- seo-blog-writerSkill
- skill-creator-proSkill
- skill-finderSkill
- skills-doctorSkill
- social-analytics-reporterSkill
- social-media-calendarSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 36
Every plan adds a large-file check (new files over 500 KB, the same limit as pre-commit-hooks check-added-large-files) and gitleaks on the …
- Distinctive: line 67
Add a formatter or linter the project doesn't use, or change its config.
- Distinctive: line 68
Run tests, type checks or full-repo lint in pre-commit.
- Very specific: line 69
Use unpinned or invented revs.
- Distinctive: line 70
Commit the setup or the reformat unless the user asked.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Pre-commit Setup
A good hook is fast enough that nobody reaches for --no-verify: format and lint only the staged files, scan the staged diff for secrets, block giant files. Anything slow (type checks, tests, full-repo lint) goes in pre-push or CI. Every check the hook runs also runs in CI, because a hook is a convenience, not a gate.
1. Plan
python3 scripts/hooks_plan.py # stack, existing hooks, chosen manager, hook list, config text
python3 scripts/hooks_plan.py --json # same, machine-readable
python3 scripts/hooks_plan.py -C path/to/repoExit codes: 0 plan printed · 1 a hook setup already exists (reported, nothing written) · 2 not a git repository.
The script reads git ls-files (tracked and untracked, gitignore respected) and skips fixtures/, testdata/, vendor/ and node_modules/. Show the user the recommended manager and its reason, the hook list with where each tool was found, and any warnings.
2. If a setup already exists (exit 1)
Extend it, don't replace it. Add the missing hooks from the plan to the existing .pre-commit-config.yaml, .lintstagedrc* or lefthook.yml. If the repo has core.hooksPath or custom .git/hooks scripts, ask before switching managers: pre-commit install refuses to run while core.hooksPath is set, and lefthook install stops and asks for --force or --reset-hooks-path.
3. Which manager and why
| Repo | Manager | Config written |
| Python only (or no tooling found) | pre-commit framework | .pre-commit-config.yaml with revs pinned to real tags |
JS/TS, one package.json | husky v9 + lint-staged | .husky/pre-commit, .lintstagedrc.json |
Go, Rust, mixed languages, or a monorepo (workspaces, pnpm-workspace.yaml, nx.json, turbo.json, go.work, Cargo [workspace], several manifests) | lefthook | lefthook.yml using jobs, with root: per package |
Only tools the project already configures get a hook: ruff from [tool.ruff] or ruff.toml, ruff format only when [tool.ruff.format] exists or a Makefile, CI workflow or similar already runs it, black from [tool.black], eslint/prettier/biome from their config files or package.json keys, golangci-lint from .golangci.*. gofmt and cargo fmt --check come with the Go and Rust toolchains. If a tool is missing that the user wants, ask before adding it and its config.
Every plan adds a large-file check (new files over 500 KB, the same limit as pre-commit-hooks check-added-large-files) and gitleaks on the staged diff. In husky and lefthook, the gitleaks step prints a notice and skips if the binary isn't installed; CI still runs it.
4. Write and install
python3 scripts/hooks_plan.py --write # creates the files only if none exist and no setup is foundThen run the setup commands the plan prints. For pre-commit they are pipx install pre-commit, pre-commit install, pre-commit autoupdate (moves revs to the latest tags) and pre-commit run --all-files.
For husky, install with the project's package manager (npm install --save-dev husky lint-staged, or the pnpm, yarn or bun form), then npm pkg set scripts.prepare=husky and npx husky. Skip npx husky init after --write, because it overwrites .husky/pre-commit with npm test.
For lefthook, install the binary (brew install lefthook, npm install --save-dev lefthook, pipx install lefthook or go install), then run lefthook install and lefthook run pre-commit --all-files.
The first all-files run may reformat many files. Commit that as its own "apply formatter" commit, separate from the hook setup, and ask the user first if the diff is large.
5. Mirror in CI
Add the plan's CI commands as steps in the existing workflow (create one only if the user wants it). For pre-commit that is pre-commit run --all-files --show-diff-on-failure. For husky and lefthook the plan lists check-mode commands (eslint ., prettier --check ., biome ci ., ruff format --check ., test -z "$(gofmt -l .)", golangci-lint run) plus gitleaks git --redact --verbose, which needs fetch-depth: 0 on checkout to scan history. CI does not repeat the large-file check. For pinning and hardening the workflow, hand off to gh-actions-auditor.
6. Slow checks
Time the type check and tests (time npx tsc --noEmit, time pytest -q). Under about 10 seconds: a pre-push hook. Slower: CI only. Clippy and full golangci-lint run belong in pre-push or CI too.
Report
Manager and reason, the hooks and the config each came from, files written, setup commands run and their output, the CI steps added, and how to skip: git commit --no-verify (all hooks), SKIP=<hook-id> (pre-commit), HUSKY=0, LEFTHOOK=0.
Do not
- Overwrite or delete an existing hook config,
.git/hooksscript orcore.hooksPath. The script refuses; so should you. - Add a formatter or linter the project doesn't use, or change its config. Ask the user first.
- Run tests, type checks or full-repo lint in pre-commit.
- Use unpinned or invented revs. Revs in the plan were checked against the repos' tags; run
pre-commit autoupdaterather than editing them by hand. - Commit the setup or the reformat unless the user asked. Writing commit messages is commit-craft's job; Claude Code agent hooks are agent-guardrails'; scanning git history for leaked keys is env-secrets-guard's.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

