precommit
Skill192 starsChanged 36 days agoMITView on GitHub
Pre-commit checks — lint:fix -> build -> test
7 other projects use a version of this.
Adopted by
Most recently taken up by
- mycelium-io/myceliumtheir own version, first seen Nov 1, 2026
- hmj1026/dhpktheir own version, first seen Oct 13, 2026
- dut00/ai-document-intelligence-platformtheir own version, first seen Oct 13, 2026
- jvalin17/agent-toolkittheir own version, first seen Oct 12, 2026
- dataplat/dbatoolstheir own version, first seen Oct 8, 2026
- apache/pinottheir own version, first seen Oct 8, 2026
Other versions7 projects use a version of this.
Word for word · 1
- sd0xdev/sd0x-harness★ 192100% same
Edited · 0
None found.
Wrote their own version · 6
- apache/pinot★ 6.2ksame name
- dataplat/dbatools★ 2.9ksame name
- mycelium-io/mycelium★ 127same name
- hmj1026/dhpk★ 2same name
- jvalin17/agent-toolkit★ 2same name
- dut00/ai-document-intelligence-platform★ 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 repository102 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- adrSkill
- agentctl-setupSkill
- architectureSkill
- askSkill
- best-practicesSkill
- bug-fixSkill
- bump-versionSkill
- check-coverageSkill
- claude-healthSkill
- code-exploreSkill
- code-investigateSkill
- codex-architectSkill
- codex-brainstormSkill
- codex-cli-reviewSkill
- codex-code-reviewSkill
- codex-explainSkill
- codex-implementSkill
- codex-review-branchSkill
- codex-review-docSkill
- codex-review-fastSkill
- codex-reviewSkill
- codex-securitySkill
- codex-setupSkill
- codex-test-genSkill
- codex-test-reviewSkill
- contract-decodeSkill
- create-prSkill
- create-requestSkill
- de-ai-flavorSkill
- debugSkill
- deep-analyzeSkill
- deep-exploreSkill
- deep-researchSkill
- dep-auditSkill
- deploy-flowSkill
- dev-security-auditSkill
- doc-refactorSkill
- doc-reviewSkill
- epic-mergeSkill
- feasibility-studySkill
- feature-devSkill
- feature-verifySkill
- fp-briefSkill
- generate-runnerSkill
- gh-stackSkill
- git-investigateSkill
- git-profileSkill
- install-hooksSkill
- install-rulesSkill
- install-scriptsSkill
- issue-analyzeSkill
- jiraSkill
- load-pr-reviewSkill
- merge-prepSkill
- necessity-auditSkill
- next-stepSkill
- obsidian-cliSkill
- op-sessionSkill
- orchestrateSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
5 rules. 0 are common, 2 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 5 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 34
Run pre-commit checks: lint:fix -> build -> test
- Very specific: line 38
Use Glob to check if .claude/scripts/precommit-runner.js exists in the project root.
- Very specific: line 41
If runner emits ## Overall: ✅ PASS, use its output and skip to the Output section.
- Very specific: line 43
If runner fails (## Overall: ❌ FAIL), treat as a real precommit failure (do not silently fallback).
- Distinctive: line 72
After lint:fix completes, run git diff --name-only to capture auto-fixed files.
“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Pre-Commit Checks (Full)
Trigger
- Keywords: precommit, pre-commit, lint and test, quality gate
When NOT to Use
- Quick checks without build (use
/precommit-fast) - Verification loop without lint:fix (use
/verify) - Just running tests (run directly)
Workflow Steps
| Step | Goal | Safety | Skip if Missing |
| comment_blocks | Reject over-long comment blocks (@rules/docs-writing.md § Code Comments) | read-only | yes |
| lint-fix | Auto-fix code style issues | read-write | yes |
| build | Verify compilation succeeds | read-only | yes |
| test-unit | Run full test suite | read-only | yes |
Failure behavior: continue-all (run all steps, report all results)
comment_blocks is a policy step, and the asymmetry is deliberate (POLICY_STEPS in scripts/precommit-runner.js): it can FAIL the run, but it never counts as "validation ran". A run where policy was the only thing that executed still reports ⚠️ NO CHECKS RUN, so a repo whose real checks are pytest/cargo cannot bank a ✅ PASS on a passing comment scan alone. It runs first because it is static and cheap.
Task
Run pre-commit checks: lint:fix -> build -> test
Step 1: Check for runner script
Use Glob to check if .claude/scripts/precommit-runner.js exists in the project root.
- Found → run:
node .claude/scripts/precommit-runner.js --mode full --tail 80- If runner emits
## Overall: ✅ PASS, use its output and skip to the Output section. - If runner emits
## Overall: ⚠️ NO CHECKS RUN, do NOT treat it as a pass — fall through to Step 2 ecosystem detection so the project's real checks run. The marker means no project validation executed and no policy step failed — every validation step was a skip orunavailable, and any policy step (comment_blocks) either skipped or passed (a FAILING policy step is❌ FAIL, never this marker — line 30's asymmetry) — whether because the repo declares no runnable checks or because the required tools were not available to the runner (which orchestrates the ecosystem table below itself: it detects pyproject.toml/Cargo.toml/go.mod/… and runs those checks as first-class steps). The runner self-notes its own verdict (review-state.js note precommit pass|fail); on⚠️ NO CHECKS RUNit notes nothing — the slot is untouched and the reminder persists, which is the correct reading of "nothing validated". - If runner fails (
## Overall: ❌ FAIL), treat as a real precommit failure (do not silently fallback).
- If runner emits
- NOT found → Auto-install attempt (see precommit-fast for identical auto-install logic), then fallback to Step 2.
Step 2: Fallback (no runner script)
Detect the project ecosystem to run steps manually.
Ecosystem detection:
| Manifest | Ecosystem | Lint-fix | Build | Test |
package.json | Node.js | {pm} lint:fix | {pm} build | {pm} test:ci / test / test:fast / test:unit |
pyproject.toml | Python | ruff check --fix . | — | pytest tests/unit/ |
Cargo.toml | Rust | cargo clippy --fix | cargo build | cargo test |
go.mod | Go | golangci-lint run --fix | go build ./... | go test ./... |
build.gradle / build.gradle.kts | Java (Gradle) | ./gradlew spotlessApply | ./gradlew build | ./gradlew test |
pom.xml | Java (Maven) | mvn spotless:apply | mvn compile | mvn test |
Gemfile | Ruby | bundle exec rubocop -a | — | bundle exec rspec |
How the runner executes this table (WB2b): a required tool missing from the environment (ruff, pytest, cargo, go, golangci-lint, mvn, bundle, the gradle wrapper — the runner never falls back to a global
gradle) marks that stepunavailable, which blocks ✅ PASS — incomplete validation must not let a sibling check mint the receipt. A repo-declared capability absent is an ordinary skip, but only on definitive non-membership evidence — never a manifest grep, and never an ambiguous probe failure (broken build config, broken task, network-dependent resolution), which staysunavailable: Ruby rubocop/rspec membership is read fromGemfile.locktext — rspec countsrspecor its executable providerrspec-core— afterbundle checkpasses (a failingbundle checkor unreadable lockfile isunavailable); Gradle spotless skips only on Gradle's ownTask 'spotlessApply' not founddiagnostic fromgradlew help --task spotlessApply(a marker-less failure isunavailable— Gradle realizes tasks lazily, so a configured-but-broken task fails the probe exactly like an absent one); Maven spotless skips only on theNo plugin found for prefixmarker frommvn help:describe -Dplugin=spotless— any other failure isunavailable. All probes are bounded (PRECOMMIT_PROBE_TIMEOUT_MS, default 120s; output capped) and logged; a probe timeout isunavailable, never a skip. Python tests runpytest tests/unit/when that directory exists, else barepytest(config-driven discovery — a repo with no tests fails loudly on exit 5 instead of silently skipping). Clippy runs with--allow-dirty --allow-staged: precommit operates on a dirty tree by definition.
For Node.js projects, auto-detect package manager from lockfile.
| Step | package.json script | If missing |
| lint:fix | lint:fix | Skip with note |
| build | build | Skip with note |
| test | test:ci → test → test:fast → test:unit | Skip with note |
After lint:fix completes, run git diff --name-only to capture auto-fixed files.
After a conclusive fallback run, self-note the outcome — the runner cannot see a run it did not
perform, and the rounds count stays path-independent (a failure is a failure whichever engine ran
it):
CHECKER=".claude/scripts/review-state.js"; [ -f "$CHECKER" ] || CHECKER="scripts/review-state.js"
node "$CHECKER" note precommit pass # every executed check passed
node "$CHECKER" note precommit fail # the checks ran and at least one failedAn inconclusive run (the checks could not execute at all) notes nothing — exactly like the
runner's ⚠️ NO CHECKS RUN: the slot stays untouched and the reminder persists. The note is
advisory; a failed note is reported and never fails the run.
Output
## Precommit (full)
## Results
| Step | Status | Notes |
|------|--------|-------|
| lint:fix | ✅/❌/⏭️/⛔ | ⏭️ = repo opted out (skip); ⛔ = required tool unavailable (blocks PASS) |
| build | ✅/❌/⏭️/⛔ | same legend |
| test | ✅/❌/⏭️/⛔ | same legend |
## Changed Files (after lint:fix)
- <files or "(none)">
## Overall: ✅ PASS / ❌ FAIL / ⚠️ NO CHECKS RUN (no project validation executed AND no policy step failed — validation steps all skipped/unavailable, policy steps skipped or passed; fall through to Step 2, needs human if nothing runnable exists)
## Checklist
- [ ] All available checks pass
- [ ] git status reviewedDoes 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.

