pre-commit
Skill8 starsChanged 49 days agoMITView on GitHub
Pre-commit quality gate. Scans the staged diff for known anti-patterns and security issues, runs the test + type-check suite, and blocks on any BLOCK-level hit. Run before every commit. Reinforced by the PreToolUse hook in hooks/settings.json.
11 other projects use a version of this.
Adopted by
Most recently taken up by
- GoogleCloudPlatform/cloud-solutionstheir own version, first seen Nov 1, 2026
- goulvenclech/dotclaudetheir own version, first seen Oct 13, 2026
- wellwelwel/pokutheir own version, first seen Oct 8, 2026
- mihai-dinculescu/tapotheir own version, first seen Oct 8, 2026
- RealDougEubanks/ClaudeMarketplacetheir own version, first seen Sep 10, 2026
- autowarefoundation/autoware-harnesstheir own version, first seen Aug 26, 2026
Other versions11 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 11
- wellwelwel/poku★ 1.2ksame name
- mihai-dinculescu/tapo★ 870same name
- GoogleCloudPlatform/cloud-solutions★ 139same name
- goulvenclech/dotclaude★ 5same name
- autowarefoundation/autoware-harness★ 4same name
- Cogni-AI-OU/cogni-ai-agent-skills★ 4same name
- alex-voloshin-dev/ai-skills★ 2same name
- flying-dice/pseudoscript★ 2same name
- Pradnyeshp/Claude-Skills★ 2same name
- Docat0209/SoloForge★ 1same name
1 more not listed
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 repository4 other files it gives its agents.
- assessSkill
- code-watchSkill
- humanizerSkill
- systematic-debuggingSkill
The file
We split this skill into the rules it gives an agent
5 rules. 0 are common, 3 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 11 edited versions we read keep these.
3
Distinctive
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
- Distinctive: line 25
ALWAYS before creating a git commit: Not optional. If the user asks you to commit, run this first.
- Very specific: line 36
If nothing is staged, fall back to git diff HEAD.
- Distinctive: line 38
Don't flag pre-existing code the change didn't touch.
- Distinctive: line 70
<Your stack's recurring footguns>: add the patterns you keep re-learning.
- Very specific: line 114
Be practical, not pedantic: If a pattern is obviously intentional (a test file exercising confirm()), don't flag it.
“Common” is measured: kept by at least 6 in 10 of the 11 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, quality gate before commit
Scan the staged diff for known anti-patterns before committing. This is the last
automated check before code ships. Unlike /assess (per-task rubric), this runs
the same global checks on every commit.
This is a genericized scaffold. The check categories and the BLOCK/WARN model are the reusable part. Replace the specific patterns with the anti-patterns that actually bite in your stack, the most valuable ones are the mistakes you keep repeating.
When to run
ALWAYS before creating a git commit. Not optional. If the user asks you to commit, run this first.
Steps
1. Get the staged diff
git diff --stagedIf nothing is staged, fall back to git diff HEAD. If there are no changes,
report "Nothing to check" and stop. Only check added lines (the + lines).
Don't flag pre-existing code the change didn't touch.
2. Anti-pattern checks
Assign each finding a severity: BLOCK (must fix before commit) or WARN (surface, let the user decide). A starter set, tune to your stack:
- Hardcoded secrets: strings shaped like API keys, tokens, or connection
strings (
sk-,key-, long alphanumerics,postgres://...@...). BLOCK. - Missing auth on new endpoints: a new server action / route handler that doesn't call your auth helper. BLOCK.
- Raw string interpolation into queries: template literals inside query builders. Use parameterized queries. BLOCK.
- Supply-chain config injection: a config file (
postcss.config.*,next.config.*,tailwind.config.*) with a run of 200+ spaces/tabs before code — the 2026 npm "whitespace-injector" RAT hides its payload off-screen to the right, invisible in editors and diffs.grep -nE '[[:blank:]]{200,}[^[:blank:]]'. BLOCK (stop, don't build, rotate any credential the build could read). - Unpinned
npx ...@latest: re-resolves to whatever's newest on every run — the supply-chain attack's entry point. Pin to an exact version. WARN. - Debug artifacts:
console.log, commented-out code blocks,TODO: remove. WARN. - Fire-and-forget async: unawaited promises in serverless handlers (they silently never complete). WARN.
- Generic error messages:
"Something went wrong"swallowing the real error. WARN. This matches literal strings, so it cannot see a message that is generic in other words, or whether the error reached anyone. It is a floor, not the rule. The rule, for your CLAUDE.md or arules/file: every failure message names something the reader can do, and every caught error reaches either the reader or your error monitoring, with the diff showing which. Show the error's own text when the reader can act on it. When it is a framework artifact they can't act on, report it to monitoring and show the action alone. - <Your stack's recurring footguns>: add the patterns you keep re-learning.
3. Tests and types
<your test command> # e.g. npm run test:run, failing tests are BLOCK
<your typecheck command> # e.g. npx tsc --noEmit, type errors are BLOCKNote passing results in the summary ("Tests: N passed", "Types: OK").
Test-coverage nudge (WARN): for each new or substantially changed logic file in the diff, check whether a sibling test file exists. Exclude thin wrappers, config, types, and UI-only files. This is a nudge, not a block.
4. Project-specific checks
Run any pre-commit checks the project declares for itself. Look for a section titled "Project-specific pre-commit checks" (or similar) in the project's CLAUDE.md, or for declarations under the project's .claude/. Run each command the project lists and apply its declared severity (BLOCK, WARN, or advisory). If the project declares none, skip this step silently.
These live in the project, not here, because the scripts and paths they name exist only in that repo. Hardcoding them in this skill makes it error or mislead everywhere else. Examples a project might declare: a docs-staleness script, a sitemap or structured-data check for its marketing site, or an integration-test suite that needs a local service.
5. Report
PRE-COMMIT CHECK
================
BLOCKED (must fix before committing):
✗ <finding> at <file:line>
Fix: <what to do>
WARNINGS (review before committing):
⚠ <finding> at <file:line>
PASSED: N checks passed
Result: <BLOCKED, fix above | All checks passed, ready to commit>Behavior
- BLOCK → do not proceed with the commit; the user must fix.
- WARN → show them; ask whether to proceed or fix first.
- All clear → proceed silently (just "All checks passed").
- Be practical, not pedantic. If a pattern is obviously intentional (a test
file exercising
confirm()), don't flag it. - Keep it fast. This runs on every commit. Don't read files unless a diff finding points you at one.
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.

